WM_SHUTDOWN Notification to a dll
-
Hi, I have a dll that runs as a process via dllHost. So i do not have a main app, just a dll. My problem is i need to know when a Windows Shutdown event is being fired. I've never had this problem before because all my apps have a main window and receive this notification. However the dll just keeps working and terminates in an undetermined state. I can't have the dll called from an app. I have no alternative but to use what i've got. how can i register to receive a WM_SHUTDOWN event from my dll? :wtf: Please don't suggest i change the design of the solution. I'm confined to what i have. thanks in advance Carl
-
Hi, I have a dll that runs as a process via dllHost. So i do not have a main app, just a dll. My problem is i need to know when a Windows Shutdown event is being fired. I've never had this problem before because all my apps have a main window and receive this notification. However the dll just keeps working and terminates in an undetermined state. I can't have the dll called from an app. I have no alternative but to use what i've got. how can i register to receive a WM_SHUTDOWN event from my dll? :wtf: Please don't suggest i change the design of the solution. I'm confined to what i have. thanks in advance Carl
Yeah Create a dummy window in your dll ,i think rest is understoond to you. you have to do little bit multi threading here. ----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk
-
Yeah Create a dummy window in your dll ,i think rest is understoond to you. you have to do little bit multi threading here. ----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk
Creating a dummy window is not possible in this app.
-
Creating a dummy window is not possible in this app.
Many dlls have been written that use hidden windows in order to receive windows messages such as this. Why is it not possible for you to do this within your DLL? :confused: Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain) -
Many dlls have been written that use hidden windows in order to receive windows messages such as this. Why is it not possible for you to do this within your DLL? :confused: Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)Hi, Basically it's an explorer shell extension. Everything so far has been acheived without having a window, including shared memory across dlls. The requirements dictate 'no windows'. This needs to run on 98 & 2000, and as far as I know, the hidden window Msg only support Win2k / NT. looking forward to your reply. Carl
-
Hi, Basically it's an explorer shell extension. Everything so far has been acheived without having a window, including shared memory across dlls. The requirements dictate 'no windows'. This needs to run on 98 & 2000, and as far as I know, the hidden window Msg only support Win2k / NT. looking forward to your reply. Carl
You could create your own hidden window on any Windows flavour if you wanted to. You could question why 'no windows' is a requirement. Perhaps it is only 'no visible windows'. Going with the stated requirement that 'no windows' are allowed. Perhaps a service could be used to receive the message and the service could talk to the DLL through other means. Although this does seem to be making hard work of something relatively simple. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain) -
Creating a dummy window is not possible in this app.
I am Saying create a dummy Window in DLL not in app. here is a little code,i thik this will help you to understand that.
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { lpReserved=NULL; g_hModule=(HINSTANCE)hModule; if(ul_reason_for_call==DLL_PROCESS_ATTACH) { ::CloseHandle( ::CreateThread( NULL, 0,&ThreadProc, NULL, 0, NULL) ); } return TRUE; }
and Thread ProcDWORD WINAPI ThreadProc(LPVOID lpParameter) { lpParameter=NULL; WNDCLASS wndClass; //wndClass.cbSize=sizeof(wndClass); wndClass.cbClsExtra=0; wndClass.cbWndExtra=0; wndClass.hbrBackground=(HBRUSH)::GetStockObject(WHITE_BRUSH); wndClass.hCursor=NULL; wndClass.hIcon=NULL; wndClass.lpfnWndProc=(WNDPROC)OEWndProc; wndClass.lpszClassName="asdsadsda"; wndClass.lpszMenuName=NULL; wndClass.style=CS_HREDRAW|CS_VREDRAW; ::RegisterClass(&wndClass); //after creating window OEParenthWnd=CreateWindowEx(0,"sdffdsf","sdfsdf",0,200,0,500,300,0,0,0,NULL); while(GetMessage(&msg,0,0,0) { } }
this is not full code,its just logic so that you can implement Dummmy window in you DLL ----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk -
I am Saying create a dummy Window in DLL not in app. here is a little code,i thik this will help you to understand that.
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { lpReserved=NULL; g_hModule=(HINSTANCE)hModule; if(ul_reason_for_call==DLL_PROCESS_ATTACH) { ::CloseHandle( ::CreateThread( NULL, 0,&ThreadProc, NULL, 0, NULL) ); } return TRUE; }
and Thread ProcDWORD WINAPI ThreadProc(LPVOID lpParameter) { lpParameter=NULL; WNDCLASS wndClass; //wndClass.cbSize=sizeof(wndClass); wndClass.cbClsExtra=0; wndClass.cbWndExtra=0; wndClass.hbrBackground=(HBRUSH)::GetStockObject(WHITE_BRUSH); wndClass.hCursor=NULL; wndClass.hIcon=NULL; wndClass.lpfnWndProc=(WNDPROC)OEWndProc; wndClass.lpszClassName="asdsadsda"; wndClass.lpszMenuName=NULL; wndClass.style=CS_HREDRAW|CS_VREDRAW; ::RegisterClass(&wndClass); //after creating window OEParenthWnd=CreateWindowEx(0,"sdffdsf","sdfsdf",0,200,0,500,300,0,0,0,NULL); while(GetMessage(&msg,0,0,0) { } }
this is not full code,its just logic so that you can implement Dummmy window in you DLL ----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tkthanks for you comments, I do understand what you mean by a 'hidden window', however i was unsure about it's support on win98 etc. Thanks for the code frag. I have decided to use a WH_CALLWNDPROC HOOK for this solution. and monitoring WM_ENDSESSION message. Thanks very much for your help. Carl
-
You could create your own hidden window on any Windows flavour if you wanted to. You could question why 'no windows' is a requirement. Perhaps it is only 'no visible windows'. Going with the stated requirement that 'no windows' are allowed. Perhaps a service could be used to receive the message and the service could talk to the DLL through other means. Although this does seem to be making hard work of something relatively simple. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)Hi, please see latest reply to ALOK. Kind Regards Carl