Calling sysdm.cpl from MFC....
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,