Win32 is a library made of data types, variables, constants, functions, and classes (mostly structures) that can be used to create applications for the Microsoft Windows family of operating systems. A typical application is made of at least two objects: a control and a host object on which the control is positioned.
To create a Win32 application using Microsoft Visual C++:
- On the Start Page, you can click New Project
- On the main menu, you can click File -> New Project...
- On the Standard toolbar, you can click the New Project button
- You can press Ctrl + N
Any of these actions would display the New Project dialog box. From there, select Win32 Project item.
Just like a C++ program always has a main() function, a Win32 program uses a central function called WinMain. The syntax of that function is:
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow );
To support international characters, Microsoft Windows provides another version of this function named _tWinMain. This version uses the same syntax (same arguments) as the first.
Unlike the C++'s main() function, the arguments of the WinMain() function are not optional. Your program will need them to communicate with the operating system. Here is an example of starting a program with the WinMain() function:
#include <windows.h> INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { return 0; }
Comments
Post a Comment