Implemented launching of date/time control panel applet

svn path=/trunk/; revision=5879
This commit is contained in:
Martin Fuchs 2003-08-27 10:00:26 +00:00
parent 8a964fafb7
commit 44eb89d031
4 changed files with 42 additions and 3 deletions

View file

@ -9,7 +9,7 @@
- implement Drag Drop from the tree view.
- activate accelerator keys like <DEL> in shell view folders
- program manager "progman" DDE server
- command line parameters like "/e,/root,c:\"
- command line parameters like "/e,/root,c:\" and "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}" (launch auf control panel)
- search functionality in start menu
- Windows-key combos
- Application Desktop Toolbars

View file

@ -303,6 +303,12 @@ LRESULT ClockWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Paint();
break;
case WM_LBUTTONDBLCLK:
//launch_file(_hwnd, _T("timedate.cpl"), SW_SHOWNORMAL); // This would be enough, but we want the fastest solution.
//launch_file(_hwnd, _T("rundll32.exe /d shell32.dll,Control_RunDLL timedate.cpl"), SW_SHOWNORMAL);
RunDLL(_hwnd, _T("shell32"), "Control_RunDLL", _T("timedate.cpl"), SW_SHOWNORMAL);
break;
default:
return super::WndProc(nmsg, wparam, lparam);
}

View file

@ -121,3 +121,33 @@ int find_window_class(LPCTSTR classname)
return 0;
}
typedef void (WINAPI*RUNDLLPROC)(HWND hwnd, HINSTANCE hinst, LPCTSTR cmdline, DWORD nCmdShow);
BOOL RunDLL(HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT nCmdShow)
{
HMODULE hmod = LoadLibrary(dllname);
if (!hmod)
return FALSE;
/*TODO
<Windows NT/2000>
It is possible to create a Unicode version of the function.
Rundll32 first tries to find a function named EntryPointW.
If it cannot find this function, it tries EntryPointA, then EntryPoint.
To create a DLL that supports ANSI on Windows 95/98/Me and Unicode otherwise,
export two functions: EntryPointW and EntryPoint.
*/
RUNDLLPROC proc = (RUNDLLPROC)GetProcAddress(hmod, procname);
if (!proc) {
FreeLibrary(hmod);
return FALSE;
}
proc(hwnd, hmod, cmdline, nCmdShow);
FreeLibrary(hmod);
return TRUE;
}

View file

@ -401,6 +401,9 @@ extern BOOL time_to_filetime(const time_t* t, FILETIME* ftime);
// search for windows of a specific classname
extern int find_window_class(LPCTSTR classname);
// create a bitmap from an icon
extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
// launch a program or document file
extern BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow);
#ifdef UNICODE
@ -409,8 +412,8 @@ extern BOOL launch_fileA(HWND hwnd, LPSTR cmd, UINT nCmdShow);
#define launch_fileA launch_file
#endif
// create a bitmap from an icon
extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
// call an DLL export like rundll32
BOOL RunDLL(HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT nCmdShow);
#ifdef __cplusplus