5. How to add other applications?
I remember this seems to be a problem with high appearance.
Three SDK functions WINEXEC, Shellexecute, and createProcess can be used.
Winexec is the easiest, two parameters, the previous specified path, the latter specified display method. The latter parameter is worth mentioning, such as the mud with sw_showmaxmize how to add a program without maximizing the button, huh, NETERM, CALC, etc. There will be no normal form, but it has been added to the task list. SHELLEXECUTE is flexible than WinExex, you can specify a work directory, the following EXAMPLE is open directly C: /TEMP/1.txt, without adding an application associated with TXT files, many installations will open a window after completion, to display Readme or FAQ, even if it is this.
Shellexecute (NULL, NULL, _T ("1.txt"), NULL, _T ("C: // Temp"), sw_showmaxmized;
CreateProcess is the most complex, with a total of ten parameters, but most of them can be replaced with null, which can specify the security attributes of the process, inherit information, priority, etc., come to see very simple EXAMPLE:
StartupInfo Stinfo; // Start the window information
ProcessInfo procinfo; // process information
CreateProcess (NULL, _T ("NOTEPAD.EXE"), NULL, NULL.FALSE, NORMAL_PRIORITY_
Class, Null, Null, & Stinfo, & Procinfo;
6. Determine the path to the application
Some people have asked this question before.
Use getModuleFileName Get the path to the application and then remove the executable file name.
EXAMPLE:
Tchar exefullpath [max_path]; // max_path is defined in the API, as if it is 128
GetModuleFileName (NULL, EXEFULLPATH, MAX_PATH)
7. Get various directory information
Windows directory: Use "getWindowsDirectory"
System directory under Windows: Use "getsystemdirectory"
Temp Directory: Uses "getTemppath"
Current Directory: Use "getcurrentdirectory"
Please note the first parameter of the first two functions as a directory variable name, and then one is a buffer; the next two opposite.
8. How to customize the message
Some people have asked, in fact, it is not difficult.
(1) Manually defined the message, can you write #define WM_MY_MESSAGE (WM_USER 100),
MS recommended at least WM_USER 100;
(2) Write the message processing function, use WPARAM, LPARAM Returns LRESULT.
Lresult CMAINFRAME :: ONMYMESSAGE (WPARAM WPARAM, LPARAM LPARAM)
{
/ / Add your handler
}
(3) Declaration at the AFX_MSG of the class, that is, "macro map"