[Qt-interest] winEvent

Thomas Dähling t.daehling at googlemail.com
Sat Jul 4 19:35:00 CEST 2009


According to the MSDN, the dbcc_name property of
PDEV_BROADCAST_DEVICEINTERFACE is an ANSI string when received via
WM_DEVICECHANGE (as opposed to the service calls, where it's always a
unicode string), maybe that's the issue?

2009/7/4 OS Prog <osprog at gmail.com>:
> Hi,
>
> I try to find the attached USB PID and VID.
>
> bool MainWindow::winEvent ( MSG * message, long * result )
>
> {
>
> PDEV_BROADCAST_DEVICEINTERFACE pdbd;
>
> if (WM_DEVICECHANGE == message->message)
>
> {
>
> switch(message->wParam)
>
> {
>
> case DBT_DEVICEARRIVAL:
>
> qDebug("DBT_DEVICEARRIVAL");
>
> qDebug("lParam:%08X", message->lParam);
>
> if(message->lParam)
>
> {
>
> pdbd = (PDEV_BROADCAST_DEVICEINTERFACE)message->lParam;
>
> qDebug("%s", qPrintable(QString::fromUtf16((ushort*)(pdbd->dbcc_name))));
>
> }
>
> break;
>
> <snip>
>
> When I attach an USB Flash drive, I get only '?"' for dbcc_name. I expect
> some string with PID and VID inside.
>
> What I'm doing wrong?
>
> It's Qt4.5 on Vista.
>
> Regards,
>
> Nikolay
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>



More information about the Qt-interest-old mailing list