Yesterday, I made a depressed API problem. Although I just didn't have the brain, I still have a little gain, that is, I don't understand the Windows mechanism, so today, still start from my head, find the Come Windows program design, Tiy to find smething #include
Int WinApi Winmain (Hinstance Hinstance, Hinstance Hprevinstance,
PSTR SZCMDLINE, INT ICMDSHOW)
{
MessageBox (Null, Text ("Hello, Windows 98!"), Text ("Hellomsg"), 0);
Return 0;
} Knowledge a simple program that is similar to HelloWord, which calls the MessageBox. There are some differences: 1. Program entry declaration: int WinAPI Winmain is different from usual int main2. And a series of parameters: Hinstance Hinstance: execution The body handle, the handle uniquely identifies the program (关 于: In the Windows programming design, the handle is only an application to identify the number of something.) Hinstance Hprevinstance: Determines whether the other other executive entity is running. It can then skip some complicated work and move some data to its own data area from the previous executive entity. In earlier versions of Windows, when running the same program multiple times, you create the "Multiple Instances" of the program. All implementing entity sharing programs and read-only memory (usually resources such as menus and dialog templates). In the 32-bit Windows version, the concept has been abandoned. The second parameter passed to WinMain is always NULL (defined as 0). PSTR SZCMDLINE: The command column for executing the program. Some Windows applications use it to load files when the program starts. INT ICMDSHOW: Indicates that the program is originally displayed, or it can be normal or maximized full screen, or minimize displayed in the work column.
PS: Some Concepts: API Application Programming Interfacekernel processes all transactions in traditional operating system core processing-memory management, file I / O, and multitasking management. (Recently, 16-bit KRNL386.EXE and 32-bit kernel32.dll) USER refers to the user interface, which is actually all window operation mechanisms. (The 16-bit USER.EXE and 32-bit User32.dll are actually the GDI is a graphics device interface, allowing the program to display text and graphics on the screen and printer. (From 16-bit GDI.EXE and 32-bit GDI32.DLL implementation) DLL DYNAMIC LINKING LIBRARY, the dynamic link library dynamic link Execute a Windows program, which is connected to Windows through a process called "Dynamic Link". A reference data for a different dynamic link library in a Windows .Exe file, the function used in those dynamic link libraries. When the Windows program is loaded into the memory, the call in the program is directed to the entry of the DLL function. If the DLL is not in the memory, load it into memory. Reference Link Library Mport Library, contains a dynamic link library name and reference information for all Windows function calls. The connection program uses this information to create a table in the .exe file, when the program is loaded, Windows uses it converts the call to a Windows function. Still not understanding the word link