windows程序一些函数用法求解?
[code=c]
问题一:static PMSG pmsg ;// 百度msdn均查不到啊,怎么办
问题二:cxClientMax = GetSystemMetrics (65) ; 这个括号里的参数可以随便填吗,只要是具体值就行吧?
问题三:case WM_SIZE:
if (message == WM_SIZE)
{
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
}
// Calculate scrolling rectangle
rectScroll.left = 0 ;
rectScroll.right = cxClient ;
rectScroll.top = cyChar ;
rectScroll.bottom = cyChar * (cyClient / cyChar) ;
InvalidateRect (hwnd, NULL, TRUE) ; //这里为什么要让矩形区域无效呢?
return 0 ;
问题四:wsprintf (szBuffer, szFormat [iType],
szMessage [pmsg[i].message - WM_KEYFIRST],//szMessage的用法?
pmsg[i].wParam,(PTSTR) (iType ? TEXT (" ") : szKeyName),
(TCHAR) (iType ? pmsg[i].wParam : ' '),
LOWORD (pmsg[i].lParam),
HIWORD (pmsg[i].lParam) & 0xFF,
0x01000000 & pmsg[i].lParam ? szYes : szNo,
0x20000000 & pmsg[i].lParam ? szYes : szNo,
0x40000000 & pmsg[i].lParam ? szDown : szUp,
0x80000000 & pmsg[i].lParam ? szUp : szDown)//这个wsprintf函数里面的参数这么多,它的功能是干什么啊?
[解决办法]
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644958%28v=vs.85%29.aspx
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG, *LPMSG;
int WINAPI GetSystemMetrics(
_In_ int nIndex
);
Parameters
nIndex [in]
Type: int
The system metric or configuration setting to be retrieved. This parameter can be one of the following values. Note that all SM_CX* values are widths and all SM_CY* values are heights. Also note that all settings designed to return Boolean data represent TRUE as any nonzero value, and FALSE as a zero value.
ValueMeaning
SM_ARRANGE
56
The flags that specify how the system arranged minimized windows. For more information, see the Remarks section in this topic.
SM_CLEANBOOT
67
The value that specifies how the system is started:
0 Normal boot
1 Fail-safe boot
2 Fail-safe with network boot
A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files.
SM_CXDLGFRAME,
SM_CYDLGFRAME Same as SM_CXFIXEDFRAME and SM_CYFIXEDFRAME.
SM_CXDOUBLECLK,
SM_CYDOUBLECLK Width and height, in pixels, of the rectangle around the location of a first click in a double-click sequence. The second click must occur within this rectangle for the system to consider the two clicks a double-click. (The two clicks must also occur within a specified time.)
SM_CXDRAG,
SM_CYDRAG Width and height, in pixels, of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
SM_CXEDGE,
SM_CYEDGE Dimensions, in pixels, of a 3-D border. These are the 3-D counterparts of SM_CXBORDER and SM_CYBORDER.
SM_CXFIXEDFRAME,
SM_CYFIXEDFRAME Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable. SM_CXFIXEDFRAME is the width of the horizontal border and SM_CYFIXEDFRAME is the height of the vertical border.
Same as SM_CXDLGFRAME and SM_CYDLGFRAME.
SM_CXFRAME,
SM_CYFRAME Same as SM_CXSIZEFRAME and SM_CYSIZEFRAME.
SM_CXFULLSCREEN, SM_CYFULLSCREEN Width and height of the client area for a full-screen window on the primary display monitor. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value.
SM_CXHSCROLL, SM_CYHSCROLL Width, in pixels, of the arrow bitmap on a horizontal scroll bar; and height, in pixels, of a horizontal scroll bar.
SM_CXHTHUMB Width, in pixels, of the thumb box in a horizontal scroll bar.
SM_CXICON,
SM_CYICON The default width and height, in pixels, of an icon. TheLoadIcon function can load only icons of these dimensions.
SM_CXICONSPACING, SM_CYICONSPACING Dimensions, in pixels, of a grid cell for items in large icon view. Each item fits into a rectangle of this size when arranged. These values are always greater than or equal to SM_CXICON and SM_CYICON.
SM_CXMAXIMIZED,
SM_CYMAXIMIZED Default dimensions, in pixels, of a maximized top-level window on the primary display monitor.
SM_CXMAXTRACK,
SM_CYMAXTRACK Default maximum dimensions, in pixels, of a window that has a caption and sizing borders. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message.
SM_CXMENUCHECK,
SM_CYMENUCHECK Dimensions, in pixels, of the default menu check-mark bitmap.
SM_CXMENUSIZE,
SM_CYMENUSIZE Dimensions, in pixels, of menu bar buttons, such as the child window close button used in the multiple document interface.
SM_CXMIN,
SM_CYMIN Minimum width and height, in pixels, of a window.
SM_CXMINIMIZED,
SM_CYMINIMIZED Dimensions, in pixels, of a normal minimized window.
SM_CXMINSPACING
SM_CYMINSPACING Dimensions, in pixels, of a grid cell for minimized windows. Each minimized window fits into a rectangle this size when arranged. These values are always greater than or equal to SM_CXMINIMIZED and SM_CYMINIMIZED.
SM_CXMINTRACK, SM_CYMINTRACK Minimum tracking width and height, in pixels, of a window. The user cannot drag the window frame to a size smaller than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message.
SM_CXSCREEN,
SM_CYSCREEN Width and height, in pixels, of the screen of the primary display monitor. These are the same values you obtain by callingGetDeviceCaps(hdcPrimaryMonitor, HORZRES/VERTRES).
SM_CXSIZE,
SM_CYSIZE Width and height, in pixels, of a button in a window's caption or title bar.
SM_CXSIZEFRAME,
SM_CYSIZEFRAME Thickness, in pixels, of the sizing border around the perimeter of a window that can be resized. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border.
Same as SM_CXFRAME and SM_CYFRAME.
SM_CXSMICON,
SM_CYSMICON Recommended dimensions, in pixels, of a small icon. Small icons typically appear in window captions and in small icon view.
SM_CXSMSIZE
SM_CYSMSIZE Dimensions, in pixels, of small caption buttons.
SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN Windows NT 5.0 and later; Windows 98 and later: Width and height, in pixels, of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN metrics are the coordinates of the top left corner of the virtual screen.
SM_CXVSCROLL, SM_CYVSCROLL Width, in pixels, of a vertical scroll bar; and height, in pixels, of the arrow bitmap on a vertical scroll bar.
SM_CYCAPTION Height, in pixels, of a normal caption area.
SM_CYKANJIWINDOW For double-byte character set versions of the system, this is the height, in pixels, of the Kanji window at the bottom of the screen.
SM_CYMENU Height, in pixels, of a single-line menu bar.
SM_CYSMCAPTION Height, in pixels, of a small caption.
SM_CYVTHUMB Height, in pixels, of the thumb box in a vertical scroll bar.
SM_DBCSENABLED TRUE or nonzero if the double-byte character set (DBCS) version of USER.EXE is installed; FALSE or zero otherwise.
SM_DEBUG TRUE or nonzero if the debugging version of USER.EXE is installed; FALSE or zero otherwise.
SM_MENUDROPALIGNMENT TRUE or nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; FALSE or zero if the menus are left-aligned.
SM_MIDEASTENABLED TRUE if the system is enabled for Hebrew and Arabic languages.
SM_MOUSEPRESENT TRUE or nonzero if a mouse is installed; FALSE or zero otherwise.
SM_MOUSEWHEELPRESENT Windows NT 4.0 and later, Windows 98: TRUE or nonzero if a mouse with a wheel is installed; FALSE or zero otherwise.
SM_NETWORK The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use.
SM_PENWINDOWS TRUE or nonzero if the Microsoft Windows for Pen computing extensions are installed; FALSE or zero otherwise.
SM_SECURE TRUE if security is present; FALSE otherwise.
SM_SAMEDISPLAYFORMAT Windows NT 5.0 and later; Windows 98 and later: TRUE if all the display monitors have the same color format, FALSE otherwise. Note that two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel's color value.
SM_SHOWSOUNDS TRUE or nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; FALSE, or zero, otherwise.
SM_SLOWMACHINE TRUE if the computer has a low-end (slow) processor; FALSE otherwise.
SM_SWAPBUTTON TRUE or nonzero if the meanings of the left and right mouse buttons are swapped; FALSE or zero otherwise.
SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN Windows NT 5.0 and later; Windows 98 and later: Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN metrics are the width and height of the virtual screen.
[解决办法]
C:\Program Files\Microsoft Visual Studio\VC98\Include\WINUSER.H
4596: /*
4597: * GetSystemMetrics() codes
4598: */
4599:
4600: #define SM_CXSCREEN 0
4601: #define SM_CYSCREEN 1
4602: #define SM_CXVSCROLL 2
4603: #define SM_CYHSCROLL 3
4604: #define SM_CYCAPTION 4
4605: #define SM_CXBORDER 5
4606: #define SM_CYBORDER 6
4607: #define SM_CXDLGFRAME 7
4608: #define SM_CYDLGFRAME 8
4609: #define SM_CYVTHUMB 9
4610: #define SM_CXHTHUMB 10
4611: #define SM_CXICON 11
4612: #define SM_CYICON 12
4613: #define SM_CXCURSOR 13
4614: #define SM_CYCURSOR 14
4615: #define SM_CYMENU 15
4616: #define SM_CXFULLSCREEN 16
4617: #define SM_CYFULLSCREEN 17
4618: #define SM_CYKANJIWINDOW 18
4619: #define SM_MOUSEPRESENT 19
4620: #define SM_CYVSCROLL 20
4621: #define SM_CXHSCROLL 21
4622: #define SM_DEBUG 22
4623: #define SM_SWAPBUTTON 23
4624: #define SM_RESERVED1 24
4625: #define SM_RESERVED2 25
4626: #define SM_RESERVED3 26
4627: #define SM_RESERVED4 27
4628: #define SM_CXMIN 28
4629: #define SM_CYMIN 29
4630: #define SM_CXSIZE 30
4631: #define SM_CYSIZE 31
4632: #define SM_CXFRAME 32
4633: #define SM_CYFRAME 33
4634: #define SM_CXMINTRACK 34
4635: #define SM_CYMINTRACK 35
4636: #define SM_CXDOUBLECLK 36
4637: #define SM_CYDOUBLECLK 37
4638: #define SM_CXICONSPACING 38
4639: #define SM_CYICONSPACING 39
4640: #define SM_MENUDROPALIGNMENT 40
4641: #define SM_PENWINDOWS 41
4642: #define SM_DBCSENABLED 42
4643: #define SM_CMOUSEBUTTONS 43
4644:
4645: #if(WINVER >= 0x0400)
4646: #define SM_CXFIXEDFRAME SM_CXDLGFRAME /* ;win40 name change */
4647: #define SM_CYFIXEDFRAME SM_CYDLGFRAME /* ;win40 name change */
4648: #define SM_CXSIZEFRAME SM_CXFRAME /* ;win40 name change */
4649: #define SM_CYSIZEFRAME SM_CYFRAME /* ;win40 name change */
4650:
4651: #define SM_SECURE 44
4652: #define SM_CXEDGE 45
4653: #define SM_CYEDGE 46
4654: #define SM_CXMINSPACING 47
4655: #define SM_CYMINSPACING 48
4656: #define SM_CXSMICON 49
4657: #define SM_CYSMICON 50
4658: #define SM_CYSMCAPTION 51
4659: #define SM_CXSMSIZE 52
4660: #define SM_CYSMSIZE 53
4661: #define SM_CXMENUSIZE 54
4662: #define SM_CYMENUSIZE 55
4663: #define SM_ARRANGE 56
4664: #define SM_CXMINIMIZED 57
4665: #define SM_CYMINIMIZED 58
4666: #define SM_CXMAXTRACK 59
4667: #define SM_CYMAXTRACK 60
4668: #define SM_CXMAXIMIZED 61
4669: #define SM_CYMAXIMIZED 62
4670: #define SM_NETWORK 63
4671: #define SM_CLEANBOOT 67
4672: #define SM_CXDRAG 68
4673: #define SM_CYDRAG 69
4674: #endif /* WINVER >= 0x0400 */
4675: #define SM_SHOWSOUNDS 70
4676: #if(WINVER >= 0x0400)
4677: #define SM_CXMENUCHECK 71 /* Use instead of GetMenuCheckMarkDimensions()! */
4678: #define SM_CYMENUCHECK 72
4679: #define SM_SLOWMACHINE 73
4680: #define SM_MIDEASTENABLED 74
4681: #endif /* WINVER >= 0x0400 */
4682: #if (WINVER >= 0x0500)
[解决办法]
(_WIN32_WINNT >= 0x0400)
4683: #define SM_MOUSEWHEELPRESENT 75
4684: #endif
4685: #if(WINVER >= 0x0500)
4686: #define SM_XVIRTUALSCREEN 76
4687: #define SM_YVIRTUALSCREEN 77
4688: #define SM_CXVIRTUALSCREEN 78
4689: #define SM_CYVIRTUALSCREEN 79
4690: #define SM_CMONITORS 80
4691: #define SM_SAMEDISPLAYFORMAT 81
4692: #endif /* WINVER >= 0x0500 */
4693:
4694: #if (WINVER < 0x0500) && (!defined(_WIN32_WINNT)
[解决办法]
(_WIN32_WINNT < 0x0400))
4695: #define SM_CMETRICS 76
4696: #else
4697: #define SM_CMETRICS 83
4698: #endif