Hi,
I want to have one process of my app running at a time. How can I do this?
OK, that's the basic question. Now I'll give some more details:
I'm making a control panel app. I've kept it pretty basic for testing purpose. So this is the code:
So when it starts, I create a modal dialog box, without a parent. This is what I want (non parent) because then it is displayed in the taskbar. (or is there another way to put it there with a parent) But now if you create multiple instances of it, it kinda works and doesn't work. There's only one instance created (the second call does nothing, I don't know why), but the window doesn't get focus and that's also what I want.Code:BOOL CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CLOSE: EndDialog(hWnd, 0); return true; } return false; } LONG CALLBACK CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2) { CPLINFO * CL; switch (uMsg) { case CPL_INIT: // first message, sent once return true; break; case CPL_GETCOUNT: // second message, sent once return 1; case CPL_INQUIRE: // third message, sent once per app CL = (CPLINFO *) lParam2; CL->idIcon = IDI_MAIN; CL->idInfo = IDS_INFO; CL->idName = IDS_NAME; break; case CPL_SELECT: // applet icon selected break; case CPL_DBLCLK: // applet icon double-clicked DialogBox(g_hMod, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc); break; case CPL_STOP: // sent once per app. before CPL_EXIT break; case CPL_EXIT: // sent once before FreeLibrary is called break; default: break; } return 0; }
If I give the dialog box a parent it does get focus (but like I said I want it in the task bar).
Is there a way around this?
And another question. I create control panels with "rundll32.exe shell32.dll,Control_RunDLL file.cpl". So there all controlled by rundll, which I guess only opens the control panel app one time, so subsequent calls to the same cpl are ignored?
I hope you could follow it, if not just say so and I'll try again
Joren



LinkBack URL
About LinkBacks



