uLib
User mode C/C++ extended API library for Win32 programmers.
|
User32 related functions. (UserUtil.cpp)
Groups | |
Clipboard Support | |
Floating Point Window Data | |
MessageBox Supplements | |
GUI Control Support | |
Macros | |
#define | SYSMET(Id) GetSystemMetrics( SM_##Id ) |
#define | GWL(hwnd, Item) GetWindowLong( hwnd, GWL_##Item ) |
#define | GWLP(hwnd, Item) GetWindowLongPtr( hwnd, GWLP_##Item ) |
#define | SYSICO(Id) LoadIcon( NULL, IDI_##Id ) |
#define | SYSCUR(Id) LoadCursor( NULL, IDC_##Id ) |
#define | LOADICO(Id) LoadIcon( hInstance, CSTR( Id )) |
#define | WS_VISICHILD (WS_CHILD | WS_VISIBLE) |
#define | WS_SCROLL (WS_VSCROLL | WS_HSCROLL) |
#define | CS_REDRAW (CS_HREDRAW | CS_VREDRAW) |
#define | WM_Cut(hCtl) SendMessage( hCtl, WM_CUT, 0,0 ) |
#define | WM_Copy(hCtl) SendMessage( hCtl, WM_COPY, 0,0 ) |
#define | WM_Paste(hCtl) SendMessage( hCtl, WM_PASTE, 0,0 ) |
#define | WM_Clear(hCtl) SendMessage( hCtl, WM_CLEAR, 0,0 ) |
#define | SimpleBeep() MessageBeep( -1 ) |
#define | GetAcceleratorCount(hacc) CopyAcceleratorTable( (HACCEL)(hacc), NULL, 0 ) |
#define | GetWndStyle(hwnd) GetWindowLong( hwnd, GWL_STYLE ) |
#define | SetWndStyle(hwnd, style) SetWindowLong( hwnd, GWL_STYLE, style ) |
#define | GetWndExStyle(hwnd) GetWindowLong( hwnd, GWL_EXSTYLE ) |
#define | SetWndExStyle(hwnd, style) SetWindowLong( hwnd, GWL_EXSTYLE, style ) |
#define | WM_GetFont(hwnd) (HFONT)SendMessage( hwnd, WM_GETFONT, 0,0 ) |
#define | WM_SetFont(hwnd, hfnt, rdrw) (void)SendMessage( hwnd, WM_SETFONT, (WPARAM)hfnt, rdrw ) |
#define | WM_SetRedraw(hwnd, on) SendMessage( hwnd, WM_SETREDRAW, on, 0 ) |
Functions | |
UINT | DispatchMessagesFor (HWND hWnd) |
UINT | GetWndHeight (HWND hWnd) |
UINT | GetWndWidth (HWND hWnd) |
bool | GetWndSize (HWND hWnd, SIZE *pSize) |
bool | GetWndPos (HWND hWnd, POINT *pPos) |
BOOL | GetWindowMinimizeRect (HWND hTrayApp, RECT *pRect) |
bool | CenterWindow (HWND hWnd, HWND hOwner) |
void | GetChildWndRect (HWND hCtrl, RECT *pRc) |
bool | EnableChildWnd (HWND Owner, UINT Id, bool Enable) |
HWND | GetChildWndWithId (HWND hParent, UINT ChildId) |
HWND | SetParentWnd (HWND hWnd, HWND newParent) |
HWND | CreateWindowIndirect (LPCREATESTRUCT pc) |
INT_PTR | DialogBoxParamEx (HINSTANCE hInst, CSTR Template, HWND hParent, DLGPROC DlgProc, LPARAM lParam, LANGID Language) |
HWND | CreateDialogParamEx (HINSTANCE hInst, CSTR Template, HWND hParent, DLGPROC DlgProc, LPARAM lParam, LANGID Language) |
bool | GetRequiredWindowSize (HWND hWnd, IN const PSIZE pClient, OUT PSIZE pWindow) |
bool | GetWindowClientSize (HWND hWnd, IN const PSIZE pWindow, OUT PSIZE pClient) |
bool | RefreshWnd (HWND hWnd) |
bool | RedrawWnd (HWND hWnd, UINT Flags) |
bool | RedrawWndRect (HWND hWnd, PRECT pRect, UINT Flags) |
bool | RedrawWndRgn (HWND hWnd, HRGN hRgn, UINT Flags) |
bool | MoveWnd (HWND hWnd, int X, int Y, bool Repaint) |
bool | ResizeWnd (HWND hWnd, int W, int H, bool Repaint) |
bool __cdecl | SetCaption (HWND hwnd, CSTR fmt,...) |
void WINAPI | SetRedraw (HWND hwnd, bool on) |
HICON WINAPI | LoadSmallIcon (HINSTANCE hInst, CSTR Id) |
PVOID WINAPI | LoadCustomResource (HMODULE hModule, CSTR Id, CSTR Type, UINT *pSize OPTOUT=NULL) |
PVOID WINAPI | LoadCustomResourceEx (HMODULE hModule, CSTR Id, CSTR Type, LANGID Language OPTIN=0, UINT *pSize OPTOUT=NULL) |
IPicture *WINAPI | LoadPictureResource (HMODULE hModule, CSTR Id, CSTR Type) |
IPicture *WINAPI | LoadPictureFile (CSTR FName) |
void WINAPI | PaintPicture (IPicture *pPic, HDC hdc, int x, int y, int cx=0, int cy=0) |
bool WINAPI | PaintPictureEx (IPicture *pPic, HDC hdc, long x, long y, long cx=0, long cy=0, long imx=0, long imy=0, long imw=0, long imh=0, PRECT prMeta=NULL) |
long WINAPI | HiMetricToPix (long hiMetric) |
long WINAPI | PixToHiMetric (long Pix) |
#define SYSMET | ( | Id | ) | GetSystemMetrics( SM_##Id ) |
Definition at line 923 of file UtilFunc.h.
#define GWL | ( | hwnd, | |
Item | |||
) | GetWindowLong( hwnd, GWL_##Item ) |
Definition at line 926 of file UtilFunc.h.
#define GWLP | ( | hwnd, | |
Item | |||
) | GetWindowLongPtr( hwnd, GWLP_##Item ) |
Definition at line 927 of file UtilFunc.h.
#define SYSICO | ( | Id | ) | LoadIcon( NULL, IDI_##Id ) |
Definition at line 930 of file UtilFunc.h.
#define SYSCUR | ( | Id | ) | LoadCursor( NULL, IDC_##Id ) |
Definition at line 931 of file UtilFunc.h.
Definition at line 934 of file UtilFunc.h.
#define WS_VISICHILD (WS_CHILD | WS_VISIBLE) |
Definition at line 938 of file UtilFunc.h.
#define WS_SCROLL (WS_VSCROLL | WS_HSCROLL) |
Definition at line 939 of file UtilFunc.h.
#define CS_REDRAW (CS_HREDRAW | CS_VREDRAW) |
Definition at line 942 of file UtilFunc.h.
#define WM_Cut | ( | hCtl | ) | SendMessage( hCtl, WM_CUT, 0,0 ) |
Definition at line 946 of file UtilFunc.h.
#define WM_Copy | ( | hCtl | ) | SendMessage( hCtl, WM_COPY, 0,0 ) |
Definition at line 947 of file UtilFunc.h.
#define WM_Paste | ( | hCtl | ) | SendMessage( hCtl, WM_PASTE, 0,0 ) |
Definition at line 948 of file UtilFunc.h.
#define WM_Clear | ( | hCtl | ) | SendMessage( hCtl, WM_CLEAR, 0,0 ) |
Definition at line 949 of file UtilFunc.h.
#define SimpleBeep | ( | ) | MessageBeep( -1 ) |
Definition at line 952 of file UtilFunc.h.
#define GetAcceleratorCount | ( | hacc | ) | CopyAcceleratorTable( (HACCEL)(hacc), NULL, 0 ) |
Definition at line 953 of file UtilFunc.h.
#define GetWndStyle | ( | hwnd | ) | GetWindowLong( hwnd, GWL_STYLE ) |
Definition at line 1121 of file UtilFunc.h.
#define SetWndStyle | ( | hwnd, | |
style | |||
) | SetWindowLong( hwnd, GWL_STYLE, style ) |
Definition at line 1122 of file UtilFunc.h.
#define GetWndExStyle | ( | hwnd | ) | GetWindowLong( hwnd, GWL_EXSTYLE ) |
Definition at line 1123 of file UtilFunc.h.
#define SetWndExStyle | ( | hwnd, | |
style | |||
) | SetWindowLong( hwnd, GWL_EXSTYLE, style ) |
Definition at line 1124 of file UtilFunc.h.
#define WM_GetFont | ( | hwnd | ) | (HFONT)SendMessage( hwnd, WM_GETFONT, 0,0 ) |
Definition at line 1127 of file UtilFunc.h.
#define WM_SetFont | ( | hwnd, | |
hfnt, | |||
rdrw | |||
) | (void)SendMessage( hwnd, WM_SETFONT, (WPARAM)hfnt, rdrw ) |
Definition at line 1128 of file UtilFunc.h.
#define WM_SetRedraw | ( | hwnd, | |
on | |||
) | SendMessage( hwnd, WM_SETREDRAW, on, 0 ) |
Definition at line 1132 of file UtilFunc.h.
UINT DispatchMessagesFor | ( | HWND | hWnd | ) |
Translate and dispatch all pending messages for hWnd (using PeekMessage).
Return nr of messages dispatched.. zero if none.
Definition at line 17 of file UserUtil.cpp.
UINT GetWndHeight | ( | HWND | hWnd | ) |
Definition at line 507 of file UserUtil.cpp.
UINT GetWndWidth | ( | HWND | hWnd | ) |
Definition at line 515 of file UserUtil.cpp.
bool GetWndSize | ( | HWND | hWnd, |
SIZE * | pSize | ||
) |
Get size of the window
Definition at line 523 of file UserUtil.cpp.
bool GetWndPos | ( | HWND | hWnd, |
POINT * | pPos | ||
) |
Get pos of the window, in screen coords.
Definition at line 537 of file UserUtil.cpp.
BOOL GetWindowMinimizeRect | ( | HWND | hTrayApp, |
RECT * | pRect | ||
) |
Undoc: user32.dll, Vista+, Export=Name/Ordinal
"If hTrayApp is an eligible tray window, the returned rect contains the
coords of the taskbar button."
Note: On test with a normal top level window it seems to return the taskbar area between [Start] and the tray icons.
Ergo, it could be used to get the taskbar height and position.
Definition at line 549 of file UserUtil.cpp.
bool CenterWindow | ( | HWND | hWnd, |
HWND | hOwner | ||
) |
Center hWnd over hOwner.
Definition at line 563 of file UserUtil.cpp.
void GetChildWndRect | ( | HWND | hCtrl, |
RECT * | pRc | ||
) |
Child wnd rect, in parent coords.
Definition at line 602 of file UserUtil.cpp.
bool EnableChildWnd | ( | HWND | Owner, |
UINT | Id, | ||
bool | Enable | ||
) |
Definition at line 608 of file UserUtil.cpp.
HWND GetChildWndWithId | ( | HWND | hParent, |
UINT | ChildId | ||
) |
Find child with given ID.
Definition at line 617 of file UserUtil.cpp.
HWND SetParentWnd | ( | HWND | hWnd, |
HWND | newParent | ||
) |
SetParentWnd adds some special handling to SetParent, permitting change from
top-level to child and vice-versa, which may be required in special situations,
such as when implementing a resource editor. Note: BE CAREFUL!
Definition at line 1167 of file UserUtil.cpp.
HWND CreateWindowIndirect | ( | LPCREATESTRUCT | pc | ) |
CreateWindowIndirect creates a window from the CREATESTRUCT spec.
Definition at line 1050 of file UserUtil.cpp.
INT_PTR DialogBoxParamEx | ( | HINSTANCE | hInst, |
CSTR | Template, | ||
HWND | hParent, | ||
DLGPROC | DlgProc, | ||
LPARAM | lParam, | ||
LANGID | Language | ||
) |
Execute a modal internationalized dialog.
If the internationalized dialog resource doesen't exist
the function returns -1, and GetLastError() returns ERROR_INVALID_PARAMETER.
hInst | Instance containing the dialog resource. |
Template | Id of the dialog |
hParent | Parent of the dialog |
DlgProc | Dialog proc callback |
lParam | Dialog creation parameter |
Language | Language of the dialog resource |
Definition at line 1061 of file UserUtil.cpp.
HWND CreateDialogParamEx | ( | HINSTANCE | hInst, |
CSTR | Template, | ||
HWND | hParent, | ||
DLGPROC | DlgProc, | ||
LPARAM | lParam, | ||
LANGID | Language | ||
) |
Create a modeless internationalized dialog. If the internationalized dialog resource doesen't exist
the function returns NULL, and GetLastError() returns ERROR_INVALID_PARAMETER.
hInst | Instance containing the dialog resource. |
Template | Id of the dialog |
hParent | Parent of the dialog |
DlgProc | Dialog proc callback |
lParam | Dialog creation parameter |
Language | Language of the dialog resource |
Definition at line 1077 of file UserUtil.cpp.
bool GetRequiredWindowSize | ( | HWND | hWnd, |
IN const PSIZE | pClient, | ||
OUT PSIZE | pWindow | ||
) |
[PRELIMINARY/TENTATIVE] Compute required window size for a given client size.
(Note: This function may be changed or removed).
Definition at line 1094 of file UserUtil.cpp.
bool GetWindowClientSize | ( | HWND | hWnd, |
IN const PSIZE | pWindow, | ||
OUT PSIZE | pClient | ||
) |
[PRELIMINARY/TENTATIVE] Get effective client size for a given window size.
(Note: This function may be changed or removed).
Definition at line 1109 of file UserUtil.cpp.
bool RefreshWnd | ( | HWND | hWnd | ) |
Combines InvalidateRect and UpdateWindow.
Definition at line 1126 of file UserUtil.cpp.
bool RedrawWnd | ( | HWND | hWnd, |
UINT | Flags | ||
) |
See [MSDN] RedrawWindow.
Definition at line 1134 of file UserUtil.cpp.
bool RedrawWndRect | ( | HWND | hWnd, |
PRECT | pRect, | ||
UINT | Flags | ||
) |
See [MSDN] RedrawWindow.
Definition at line 1139 of file UserUtil.cpp.
bool RedrawWndRgn | ( | HWND | hWnd, |
HRGN | hRgn, | ||
UINT | Flags | ||
) |
See [MSDN] RedrawWindow.
Definition at line 1144 of file UserUtil.cpp.
bool MoveWnd | ( | HWND | hWnd, |
int | X, | ||
int | Y, | ||
bool | Repaint | ||
) |
See [MSDN} SetWindowPos.
Definition at line 1151 of file UserUtil.cpp.
bool ResizeWnd | ( | HWND | hWnd, |
int | W, | ||
int | H, | ||
bool | Repaint | ||
) |
See [MSDN} SetWindowPos.
Definition at line 1159 of file UserUtil.cpp.
bool __cdecl SetCaption | ( | HWND | hwnd, |
CSTR | fmt, | ||
... | |||
) |
SetWindowText a'la printf..
The function uses an internal buffer of 256 TCHARs.
Definition at line 284 of file UserUtil.cpp.
void WINAPI SetRedraw | ( | HWND | hwnd, |
bool | on | ||
) |
Send WM_SETREDRAW, and if on is true call InvalidateRect()
to ensure a forthwith redraw of the window contents.
Definition at line 500 of file GdiUtil.cpp.
HICON WINAPI LoadSmallIcon | ( | HINSTANCE | hInst, |
CSTR | Id | ||
) |
Small icon convenience routine (wrap for LoadImage())
Definition at line 628 of file UserUtil.cpp.
Find, Load, and Lock a resource of arbitrary type.
PVOID WINAPI LoadCustomResourceEx | ( | HMODULE | hModule, |
CSTR | Id, | ||
CSTR | Type, | ||
LANGID Language | OPTIN = 0 , |
||
UINT *pSize | OPTOUT = NULL |
||
) |
Find, Load, and Lock a resource of arbitrary type in a specific language.
If the resource isn't found in the specified language, the default language is tried.
Load any IPicture supported file stored as a custom resource.
Note: Uses SHCreateMemStream, and is therefore not reentrant.
Definition at line 900 of file UserUtil.cpp.
IPicture* WINAPI LoadPictureFile | ( | CSTR | FName | ) |
Load any IPicture supported file.
Uses SHCreateStreamOnFile() and OleLoadPicture() to get an IPicture.
Definition at line 928 of file UserUtil.cpp.
void WINAPI PaintPicture | ( | IPicture * | pPic, |
HDC | hdc, | ||
int | x, | ||
int | y, | ||
int | cx = 0 , |
||
int | cy = 0 |
||
) |
Paint an IPicture on a normal MM_TEXT mode HDC.
The whole picture is rendered without aspect constraints.
pPic | Pointer to the IPicture to render. |
hdc | Display context to paint on, MM_TEXT mode is expected. |
x,y | Position in hdc of upper left corner, in pixels. |
cx,cy | Width and height to cover, in pixels. |
Definition at line 977 of file UserUtil.cpp.
bool WINAPI PaintPictureEx | ( | IPicture * | pPic, |
HDC | hdc, | ||
long | x, | ||
long | y, | ||
long | cx = 0 , |
||
long | cy = 0 , |
||
long | imx = 0 , |
||
long | imy = 0 , |
||
long | imw = 0 , |
||
long | imh = 0 , |
||
PRECT | prMeta = NULL |
||
) |
Paint an IPicture on a normal MM_TEXT mode HDC.
Supports all Render parameters using Pixel measures, not HiMetric.
pPic | Pointer to the IPicture to render. |
hdc | Display context to paint on, MM_TEXT mode is expected. |
x,y | Position in hdc of upper left corner, in pixels. |
cx,cy | Width and height to cover in hdc , in pixels. |
imx,imy | Position in picture of upper left corner to render, in pixels. |
imw,imh | Width and height of picure area to include, in pixels. |
Definition at line 999 of file UserUtil.cpp.
long WINAPI HiMetricToPix | ( | long | hiMetric | ) |
Return measure in pixels.
Definition at line 958 of file UserUtil.cpp.
long WINAPI PixToHiMetric | ( | long | Pix | ) |
Return measure in hi-metric units.
Definition at line 965 of file UserUtil.cpp.