win32 Overview

win32 intentionally entry function based on the existing framework is only one

We need to have a main entrance to all program functions are maincrtstartup

As the name suggests tydedef

window is based on the c, c ++ want to have their own unique data type based on type so C, C ++ do the redefined
1. c language does not distinguish the name implies
2. Package Information

Characteristics:
1. If the transfer is not by definition have said first type
2. stresses begin with a capital H in win32 handle inside
3.LP, at the beginning of the pointer P which represents win32
4.windows data type which all upper windows but is based on C, C ++ data type

Program performance of two-byte character sets and a plurality byte wide and wildcard character set

window is not just a music player installed a default music player

Learn to use written music programming windows

The above code is implemented as follows

1  // logic explicit partial section 
2 #include <the Windows.h>
 . 3  #pragma Comment (lib, "winmm.lib") // Library DLL file or static libraries 
. 4  // Windows entry function the WinMain 
. 5  int the WinMain ( hInstance the hINSTANCE _In_, // the application uses the handle 
. 6      _In_opt_ the hINSTANCE hPrevInstance, // parent application instance handle (current version is null) 
. 7      _In_ LPSTR lpCmdLine, // command line parameters 
. 8      _In_ int nShowCmd) // window display 
9  {
 10      MessageBoxA (nullptr, // window handle 
11          "abc " , // the message text box 
12          ," 123 " , // Message box title 
13          MB_YESNOCANCEL | MB_ICONWARNING // type of message box         
14          );
 15      // Windows is based on the c language c ++ and want to have their own data types so in c / c ++ done on the basis of the definition of punch
 16      @ multibyte 
. 17      char C = ' a ' ;
 18 is      char * PC = " ABC " ; // multibyte character string
 . 19          // PC = & C; 
20 is          int m strlen = (PC); //Seeking multibyte length
 21          // wide byte 
22 is          wchar_t WC = ' A ' ; // wide character 
23 is      wchar_t * L PWC = " ABCD " ; // wide byte strings 
24      m = wcslen (PWC); // width required length byte
 25      @ wildcard character set is represented by 
26 is      TCHAR TC = ' a ' ; // may change according to their needs byte type 
27      TCHAR * _T = PTC ( " ABC " ); // _T ( ) parameterized macro 
28      _tcslen (PTC);
 29      //1. Regardless of the character set can be used in the project itself may be set to a fixed type or the performance of a string of characters, char, or wchar_t
 30      // 2. can be unified using wildcard characters type
 31 is      // WAV music player 
32      the PlaySound (_T ( "" ), // file path name, relative path 
33 is          nullptr a, // application handle solid column 
34 is          SND_LOOP | SND_FILENAME | SND_ASYNC // file operation mode
 35          // SND_LOOP specified file SND_ASYNC asynchronous cycle SND_FILENAME 
36          );
 37      // mp3 music player 
38      mciSendString (_T ( " .... mp3 alias abc " ), // open a * .mp3 file do not take the name of the alias abc 
39         nullptr a, // receiving buffer information with, null indicates not receive information 
40          0 , // memory size of the second parameter 
41 is          nullptr a); // window handle of the callback function 
42 is      the mciSendString (_T ( " Play ABC " ), 0 , 0 , 0 );
 43 is      the MessageBox ( 0 , 0 , 0 , 0 ); // similar getchar () in the program can not be used because the windows 
44 is  
45      return  0 ;
 46 is }

 

Guess you like

Origin www.cnblogs.com/liugangjiayou/p/11403440.html