代码:
1 /*header file*/ 2 #include <Windows.h> 3 #include <stdio.h> 4 5 /*function windows data type demo*/ 6 7 int WINAPI WinMain( 8 HINSTANCE hInstance, 9 HINSTANCE hPrevInstance, 10 LPSTR lpCmdLine, 11 int nCmdShow 12 ) 13 { 14 //define string 15 LPSTR szString = "Windows data type,string."; 16 //define char arry 17 CHAR lpString[120]; 18 //define type of DWORD data 19 DWORD dwMax = 0xFFFFFFFF; 20 DWORD dwOne = 0x1; 21 //define int data 22 INT iMax = 0xFFFFFFFF; 23 INT iOne = 0x1; 24 25 //display string 26 MessageBox(NULL,szString,"LPSTR",MB_OK); 27 //copy mem 28 CopyMemory(lpString,szString,lstrlen(szString)+1); 29 MessageBox(NULL,lpString,"CHAR[]",MB_OK); 30 31 //compare DWORD and display result 32 if(dwMax>dwOne) 33 { 34 MessageBox(NULL,"DWORD type of data 0xFFFFFFFF > 0x1","DWORD",MB_OK); 35 } 36 //compare INT and display result 37 if(iMax<iOne) 38 { 39 MessageBox(NULL,"INT type of data 0xFFFFFFFF < 0x1","INT",MB_OK); 40 } 41 return 0; 42 }
测试截图:
时间: 2024-11-01 06:32:38