Thank you David.
I appreciate the effort.
Yep, I traced it through. And it does execute twice.
I guess it is just peculiar behaviour.
Thanks again.
"Cameron_C" <CameronC@discussions.microsoft.com> wrote in message
news:A97511CE-757F-4535-AA8C-0671F24DC076@microsoft.com...
Hello once again,
Today I am here asking if anyone has ever called SYSDM.cpl from an MFC
program.
I have written my application to invoke sysdm.cpl from a button inside the
About Dialog box.
To be honest, I was being lazy and rather than define a bunch of system
related fields for a "systems Information" type of display, I thought I
could
simply pop open the system dialog box.
This all works fine one time. When I click the button subsequent times,
nothing appears to happen. The click is processed, and the call is
executed,
but that is all I have seen.
Here is the code fragment I have been working with.
/*
The User is inquiring on their system.
*/
void CAboutDlg::OnBnClickedAboutSystem()
{
PFN_ENTRY pfnEntryPoint=NULL;
HINSTANCE hInstance=AfxGetInstanceHandle();
HMODULE hModule=AfxLoadLibrary(_T("Shell32.dll"));
if (hModule)
#ifdef _UNICODE
pfnEntryPoint = (PFN_ENTRY) GetProcAddress(hModule, "Control_RunDLLW");
#else
pfnEntryPoint = (PFN_ENTRY) GetProcAddress(hModule, "Control_RunDLLA");
#endif
if (pfnEntryPoint)
pfnEntryPoint(m_hWnd, hInstance, "sysdm.cpl,,0", SW_SHOW);
AfxFreeLibrary(hModule);
}
This same code seems to work fine multiple times if I use ncpa.cpl or
timedate.cpl.
I just can't seem to get sysdm.cpl running more than one.
If I close the About Dialog, and re-open it, the system information does
work.
Does anyone have any ideas I could try here?
Thanks,
Have you debugged this and ensured that pfnEntryPoint() is indeed called the
second time? If so, perhaps you should pass NULL for the first parameter
(and not m_hWnd). The fact that it works if you open the About dialog anew
(with a different HWND) may have something to do with it.
-- David