Click here to Skip to main content
15,888,148 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: How to use WTL in dll? Pin
Alain Rist17-Nov-10 4:45
Alain Rist17-Nov-10 4:45 
GeneralRe: How to use WTL in dll? Pin
tank017-Nov-10 5:12
tank017-Nov-10 5:12 
GeneralRe: How to use WTL in dll? Pin
Alain Rist17-Nov-10 6:05
Alain Rist17-Nov-10 6:05 
GeneralRe: How to use WTL in dll? Pin
tank017-Nov-10 13:34
tank017-Nov-10 13:34 
GeneralRe: How to use WTL in dll? Pin
Alain Rist17-Nov-10 20:29
Alain Rist17-Nov-10 20:29 
QuestionOnQuit event of DWebBrowserEvents2 interface not called on IE8 on some Vista machin Pin
am 200916-Nov-10 17:04
am 200916-Nov-10 17:04 
AnswerRe: OnQuit event of DWebBrowserEvents2 interface not called on IE8 on some Vista machin Pin
KingsGambit18-Nov-10 19:37
KingsGambit18-Nov-10 19:37 
QuestionUsing WMI to Query for Currently Attached USB Device Pin
Jim Fell16-Nov-10 8:40
Jim Fell16-Nov-10 8:40 
I am writing an application wherein I need to scan the computer to see if either of two different USB devices are attached. The first device appears as a HID, and the second device appears as a virtual COM port. Which WMI classes should I be checking to see if each device is attached?

I am using this for the HID:

m_bstrScope = SysAllocString( _T("root\\CIMV2") );
m_bstrQuery = SysAllocString( _T("SELECT PNPDeviceID FROM Win32_PnPEntity") );


...and this for the virtual COM port device:

m_bstrScope = SysAllocString( _T("root\\CIMV2") );
m_bstrQuery = SysAllocString( _T("SELECT DeviceID,PNPDeviceID FROM Win32_SerialPort") );


This pseudo code shows how my scanning algorithm works:

if ( ScanForDevice1() ) // HID attached
{
    /* Success */
}
else if ( ScanForDevice2() ) // Virtual COM port device attached
{
    /* Success */
}
else
{
    /* Fail */
}


This seems to work, except when I change which device is connected between running the application. If device 1 is found, the scan for device 2 is aborted; the scan for device 2 only occurs if device 1 is not found. What happens is this:


  1. The application is run with both devices attached to the system. Device 1 is found, as expected. The application exits.
  2. Device 1 is unplugged from the system.
  3. The application is run with only device 2 attached to the system. Oddly, device 1 is found, even though it is not attached. The application exits.
  4. Both devices are unplugged from the system.
  5. The application is run with no devices attached. No devices are found, as expected. The application exits.
  6. Only device 2 is plugged back into the system.
  7. The application is run with only device 2 attached. The application finds device 2, as expected.


My best guess is that I am querying the wrong class(es). Which classes should my application be checking? Or, is there something else that I should be doing? Thanks.
QuestionCalling a com interface function ,but find a problem Pin
confideman200013-Nov-10 2:24
confideman200013-Nov-10 2:24 
AnswerRe: Calling a com interface function ,but find a problem Pin
Richard MacCutchan13-Nov-10 5:51
mveRichard MacCutchan13-Nov-10 5:51 
AnswerRe: Calling a com interface function ,but find a problem Pin
Stephen Hewitt13-Nov-10 18:14
Stephen Hewitt13-Nov-10 18:14 
Questionhello i have a problem with linux Pin
lxlenovostar11-Nov-10 15:19
lxlenovostar11-Nov-10 15:19 
AnswerRe: hello i have a problem with linux Pin
Dr.Walt Fair, PE11-Nov-10 17:10
professionalDr.Walt Fair, PE11-Nov-10 17:10 
Questionwindows c++ fstream log file rollover Pin
Alan Kurlansky10-Nov-10 4:18
Alan Kurlansky10-Nov-10 4:18 
AnswerRe: windows c++ fstream log file rollover Pin
Richard MacCutchan10-Nov-10 6:12
mveRichard MacCutchan10-Nov-10 6:12 
GeneralRe: windows c++ fstream log file rollover Pin
Alan Kurlansky12-Nov-10 4:18
Alan Kurlansky12-Nov-10 4:18 
QuestionWhy "FlatSB" is useless in WTL? ::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0. Pin
dancingfish9-Nov-10 20:01
dancingfish9-Nov-10 20:01 
AnswerRe: Why "FlatSB" is useless in WTL? ::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0. [modified] Pin
Alain Rist9-Nov-10 21:31
Alain Rist9-Nov-10 21:31 
GeneralRe: Why "FlatSB" is useless in WTL? ::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0. Pin
dancingfish10-Nov-10 17:11
dancingfish10-Nov-10 17:11 
AnswerRe: Why "FlatSB" is useless in WTL? ::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0. Pin
Alain Rist10-Nov-10 22:40
Alain Rist10-Nov-10 22:40 
GeneralRe: Why "FlatSB" is useless in WTL? ::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0. Pin
dancingfish10-Nov-10 23:20
dancingfish10-Nov-10 23:20 
AnswerRe: Why "FlatSB" is useless in WTL? ::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0. [modified] Pin
Alain Rist11-Nov-10 23:26
Alain Rist11-Nov-10 23:26 
QuestionImplementing Bookmark_Enabled OLE DB Provider/IDBSchemaRowset Pin
RezaAsAdi8-Nov-10 1:12
RezaAsAdi8-Nov-10 1:12 
Questionexception handling [modified] Pin
khomeyni7-Nov-10 8:41
khomeyni7-Nov-10 8:41 
AnswerRe: exception handling Pin
Sauro Viti7-Nov-10 10:55
professionalSauro Viti7-Nov-10 10:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.