Page 38 - DCAP408_WEB_PROGRAMMING
P. 38
Windows Programming
Notes by Windows programmers, and all the data types utilized by the different functions and
subsystems. It defines a very huge number of Windows particular functions that can be utilized
in C. The Win32 API can be added to a C programming project by comprising the <windows.h>
header file and connecting to the appropriate libraries.
!
Caution To utilize functions in xxxx.dll, the program must be connected to xxxx.lib (or
libxxxx.dll.a in MinGW).
Did u know? Some headers are not connected with a .dll but with a static library (e.g.
scrnsave.h needs scrnsave.lib).
Self Assessment
Fill in the blanks:
1. The ......................... is a Windows-specific header file for the C programming language
which comprises declarations for all of the functions in the Windows API.
2. The Win32 API can be added to a C programming project by comprising the <windows.h>
header file and connecting to the appropriate ......................... .
3.2 WINMAIN Function
WINMAIN (also written as MAIN) is a user-defined function called by Windows to start execution
of an application.
Syntax
FUNCTION {WINMAIN | MAIN} ( _
BYVAL hInstance AS DWORD, _
BYVAL hPrevInst AS DWORD, _
BYVAL lpszCmdLine AS WSTRINGZ PTR, _
BYVAL nCmdShow AS LONG ) AS LONG
The WINMAIN function is called by Windows when an executable application primarily loads
and bstarts to run. It is frequently pointed to as the “entry point” for the application. When the
execution of WINMAIN is accomplished, the application is estimated to be completed, and
Windows releases the application memory back to the heap. WINMAIN obtains the following
parameters:
1. hInstance: The executable’s (EXE) instance handle. Each instance of a Windows application
has an exclusive handle. It is used as a parameter to a number of Windows API functions
which may want to differentiate among multiple instances of an application.
2. hPrevInst: It is not used by 32-bit Windows. It is there merely for compatibility with
current 16-bit code, and always returns zero in 32-bit applications.
3. lpszCmdLine: A pointer to an nul-terminated string that comprises a command-line.
32 LOVELY PROFESSIONAL UNIVERSITY