Click here to Skip to main content
15,895,142 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: how to validate a date using c++ Pin
Russell'14-Sep-07 7:30
Russell'14-Sep-07 7:30 
QuestionVisual Studio 2005 bug? Pin
devvvy13-Sep-07 22:07
devvvy13-Sep-07 22:07 
AnswerRe: Visual Studio 2005 bug? Pin
KarstenK13-Sep-07 22:59
mveKarstenK13-Sep-07 22:59 
GeneralRe: Visual Studio 2005 bug? Pin
devvvy14-Sep-07 20:26
devvvy14-Sep-07 20:26 
AnswerRe: Visual Studio 2005 bug? Pin
Scott Dorman14-Sep-07 8:49
professionalScott Dorman14-Sep-07 8:49 
GeneralRe: Visual Studio 2005 bug? Pin
devvvy14-Sep-07 20:28
devvvy14-Sep-07 20:28 
GeneralRe: Visual Studio 2005 bug? Pin
Scott Dorman15-Sep-07 4:25
professionalScott Dorman15-Sep-07 4:25 
Questionnot getting device inserted notification?????? Pin
$w0rdf1$h13-Sep-07 2:44
$w0rdf1$h13-Sep-07 2:44 
hey hi all... i made a c++ program in which i need to detect USB device inserted event... but my windowProc function is not getting called.. i don't know whats wrong with the program.... i also tried to check the error by using GetLastError() but i got nothing.. code goes like this

#ifdef WINVER
#undef WINVER
#endif
#define WINVER 0x0501

#include
#include
#include
#include
#include

DEFINE_GUID(GUID_DEVINTERFACE_VOLUME, 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
// don't know if this is the correct GUID for USB device interface... i got it from MSDN website....
#define guid GUID_DEVINTERFACE_VOLUME

using namespace std;

HDEVNOTIFY RegisterDeviceNotificationA(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
);

#define RegisterDeviceNotification RegisterDeviceNotificationA


LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // device-change event
LPARAM lParam // event-specific data
);


int main( )
{
HWND hwnd = FindWindow( "ConsoleWindowClass", NULL);

cout<<hwnd<<endl; to="" check="" if="" im="" able="" get="" hwnd="" or="" not......

dev_broadcast_deviceinterface="" notificationfilter;
zeromemory(="" &notificationfilter,="" sizeof(notificationfilter)="" );
notificationfilter.dbcc_size="sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype" =="" dbt_devtyp_deviceinterface;
notificationfilter.dbcc_classguid="guid;

HDEVNOTIFY" hdevnotify;
hdevnotify="RegisterDeviceNotification(" hwnd,="" device_notify_window_handle);

cout<<hdevnotify<<endl;="" the="" value

if(="" !hdevnotify="" )
{
cout<<"registration="" of="" device="" notification="" failed"<<endl;
}
else
{
cout<<"registration="" complete"<<endl;
}
dword="" dword;
dword="GetLastError(" );

cout<<dword<<endl;="" for="" any="" error="" any....
while(1)
{
sleep(1000);
}

return="" 0;
}

lresult="" callback="" windowproc(="" uint="" umsg,="" wparam="" wparam,="" lparam="" )
{
cout<<"windowproc="" called"<<endl;="" its="" getting="" called="" not.......

if(="" umsg="=" wm_devicechange="" )
{
cout<<"device="" change"<<endl;
}
return="" defwindowproc(hwnd,umsg,wparam,lparam);="" call="" window="" api="" function="" defwindowproc()="" which
="" provides="" default="" message="" processing="" messages="" that="" were="" not="" processed="" by="" this="" window.
}



output="" is



0x290392="" hwnd
0x245d08="" hdevnotify
registration="" complete
0="" getlasterror()


and="" nothing="" is="" happening="" when="" inserting="" usb.....nyone="" knw="" about="" this

bye="" have="" a="" nice="" day.....

bye="" day.....=""

<div="" class="ForumSig">bye have a nice day.....
AnswerRe: not getting device inserted notification?????? Pin
Duncan Edwards Jones13-Sep-07 2:50
professionalDuncan Edwards Jones13-Sep-07 2:50 
GeneralRe: not getting device inserted notification?????? Pin
$w0rdf1$h13-Sep-07 3:35
$w0rdf1$h13-Sep-07 3:35 
GeneralRe: not getting device inserted notification?????? Pin
Luc Pattyn13-Sep-07 4:15
sitebuilderLuc Pattyn13-Sep-07 4:15 
GeneralRe: not getting device inserted notification?????? Pin
$w0rdf1$h13-Sep-07 4:59
$w0rdf1$h13-Sep-07 4:59 
GeneralRe: not getting device inserted notification?????? Pin
Luc Pattyn13-Sep-07 5:08
sitebuilderLuc Pattyn13-Sep-07 5:08 
GeneralRe: not getting device inserted notification?????? Pin
$w0rdf1$h13-Sep-07 5:23
$w0rdf1$h13-Sep-07 5:23 
GeneralRe: not getting device inserted notification?????? Pin
Luc Pattyn13-Sep-07 5:35
sitebuilderLuc Pattyn13-Sep-07 5:35 
GeneralRe: not getting device inserted notification?????? Pin
Duncan Edwards Jones13-Sep-07 6:14
professionalDuncan Edwards Jones13-Sep-07 6:14 
GeneralRe: not getting device inserted notification?????? Pin
$w0rdf1$h13-Sep-07 6:30
$w0rdf1$h13-Sep-07 6:30 
Questionnewbie: value-type -vs- reference type Pin
devvvy12-Sep-07 22:50
devvvy12-Sep-07 22:50 
AnswerRe: newbie: value-type -vs- reference type Pin
George L. Jackson13-Sep-07 0:19
George L. Jackson13-Sep-07 0:19 
GeneralRe: newbie: value-type -vs- reference type [modified] Pin
devvvy13-Sep-07 16:09
devvvy13-Sep-07 16:09 
GeneralRe: newbie: value-type -vs- reference type [modified] Pin
George L. Jackson13-Sep-07 23:58
George L. Jackson13-Sep-07 23:58 
QuestionHttp Request Pin
devvvy12-Sep-07 22:49
devvvy12-Sep-07 22:49 
AnswerRe: Http Request Pin
led mike13-Sep-07 4:22
led mike13-Sep-07 4:22 
QuestionHi I want to know how to distinguish two mouse signal. Pin
Charles of Korea12-Sep-07 15:49
Charles of Korea12-Sep-07 15:49 
AnswerRe: Hi I want to know how to distinguish two mouse signal. Pin
Christian Graus12-Sep-07 15:57
protectorChristian Graus12-Sep-07 15:57 

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.