TINY APPS + SOURCES (MASM32) === WIN32 ASM & API PRACTICE
@  2lz
TINY APPS + SOURCES (MASM32)
09/11/2009 updated
MSDN Masm32

MS err
wi_exstyle (v.2009-04-19, 1.5 kb) - GetWindowInfo WINDOWINFO.dwExStyle error! // tested: XP-sp2/sp3, server 2k3/2k8, Vista-sp1, ... (but Win98SE - OK). winfo_err (v.2009-04-19, 1.8 kb) - aftereffects for CreateWindowEx. How to repair: I don't know the original value of undocumented mask WS_EX_ALLVALID (for WINDOWINFO.dwExStyle & WS_EX_ALLVALID), but try 0FFFF7FFh (also 0A5F77FFh).
*WindowFromPoint* (v.2009-06-14, 8 kb) - *WindowFromPoint* API tester // (tested on XP-pro-sp2) MSDN -> "ChildWindowFromPointEx Function": "If the point is within the parent window but not within any child window that meets the criteria, the return value is a handle to the parent window." But ChildWindowFromPoint(Ex)/RealChildWindowFromPoint need parent window client area ! MSDN -> "WindowFromPoint Function": "If the point is over a static text control, the return value is a handle to the window under the static text control." But it's right only for same thread with the static control without SS_NOTIFY ! MSDN -> "RealChildWindowFromPoint Function": nothing about wrong result when parent or other ancestor has WS_EX_LAYOUTRTL (a fortiori - with WS_EX_COMPOSITED)! + "MapWindowPoints Function" (see MSDN) dosn't help !
MS puzzle
MSDN -> "WM_NCHITTEST Notification" -> "HTSYSMENU In a window menu or in a Close button in a child window" SysButton (v.2009-05-31, 6 kb) -
T o o l s
HTSpy (v.2008-02-29_m, 51 kb) - HitTester // + HTLab inside // it's my comment to "WM_NCHITTEST" MSDN article
ParentOwner (v.2009-09-11, 27 kb) - WIN API Window Relationships: Parent, Owner, Z-order // + filtered window tree monitor Spy++ shows that "About Calculator"'s parent and owner are equal, but it is wrong... MSDN informs that "After creating an owned window, an application cannot transfer ownership of the window to another window", but it is almost FALSE info... Strange GetParent ... Etc
CBT_hook (v.2008-10-20, 10 kb) - HCBT monitor // HCBT_CREATEWND: any window is primarily message-only window ! // Tested: XP-pro-sp2
ExtraSpy (v.2008-10-01, 27 kb) - Sparring Dialog // "Is window dialog ?"
NCSysMetrics (v.2008-03-03, 10 kb) - GetSystemMetrics & SystemParametersInfo for window's nonclient area // Try it with "classic" and "Windows XP" themes
PrintLayered (v.2007-02-28, 20 kb) - Win32 API demonstrator (tester/monitor/handler) // OS >= Win 2k One of features: AlphaPrintWindow (Win2k) instead of PrintWindow (WinXP)
WinDrag (v.2006-06-23, 17 kb) - window size/pos/z-ord/parent + puncher + colorpicker + pen + screenshot + bmp + rgn // with help of The Customiser's cursor :-)
FrameRector (v.2008-08-31, 12 kb) - window spy/monitor "inside out" // window: choose, not search // hittest, pid/tid/z-ord filters, regions, alpha-channel, message-only windows // hasn't own window As experiment: plus FrameRector sends broadcast messages (so this archive contains also demo receiver FR_reader), for communication between apps FrameRector/FR_reader register unique window message via RegisterClipboardFormat/RegisterClass FrameRector as gentle spy/handler: Screensaver atop desktop, FrameRector atop screensaver:
WinTreeSnap (v.2007-05-20, 8 kb) - output text file = snapshot of current window tree (+ message-only windows) // about 30 parameters // hasn't own window Plus: foreground, focus, cursor-over-window indicator. Make a shortcut with hotkey, assignment to WTS (as Ctrl+Shift+W). MSDN -> Window Features -> Message-Only Windows : "A message-only window enables you to send and receive messages. It is not visible, has no z-order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages. To create a message-only window, specify the HWND_MESSAGE constant or a handle to an existing message-only window in the hWndParent parameter of the CreateWindowEx function. You can also change an existing window to a message-only window by specifying HWND_MESSAGE in the hWndNewParent parameter of the SetParent function. To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the FindWindowEx function. In addition, FindWindowEx searches message-only windows as well as top-level windows if both the hwndParent and hwndChildAfter parameters are NULL." "cannot be enumerated" = FALSE! EnumChildWindows(MessageWindow) enumerates all message-only windows! GetMessageWindow = GetAncestor(FindWindowEx(HWND_MESSAGE,0,0,0),GA_PARENT) ("Message Windows 2000/Windows XP: The class for a message-only window" (MSDN -> About Window Classes -> System Classes)) See sources of WinTreeSnap and FrameRector.
UpWinMon (v.2006-06-12, 4 kb) - top-level windows monitor // default text editor's window instead of own window MOWmon (v.2005-03-01, 3 kb) - message-only windows monitor (for Win OS >= Win 2k) // remaked UpWinMon Run MOWmon and UpWinMon together to observe how MO-window passes to top-level window and vice versa (class #32774, csrss.exe).
WinFinderPoster (v.2005-05-25, 8 kb) - selects window under cursor by means of alternative frame: window region instead of DrawFocusRect As experiment: plus WinFinderPoster sends broadcast messages (so this archive contains also demo receiver WFP_reader), for communication between apps WinFinderPoster and WFP_reader register unique window message via RegisterClass
DoubleSnapFromPoint (v.2006-01-21, 8 kb) - outputs: 1) 32-bit bmp file, 2) popup window-'copy' (face, region, alpha-channel) DoubleSnapFromPoint_mask (v.2005-04-04,10 kb) Plus rgn-file if region exists. Plus popup window-'copy' can receive bmp- and rgn- files (via drag'n'drop) as own new face. Plus graphic image of RGNDATA structure ("LastMask" bmp-file)
APIrator_shell (v.2004-10-31, 18 kb) - draft shell for APIrator (Win32 API demonstrator)
by_es_password (v.2007-03-16, 8 kb) - "bypass ES_PASSWORD via PostMessage" on Win 98/2k/XP (fixed on Vista) // + "ES_PASSWORD cases" This tool uses both Edit's buffers: 1) for SendMessage(WM_GET/SETTEXT) and 2) for Get/SetWindowText.
RegRange (v.2005-05-22, 2 kb) - current internal atom table(s) used by the system (via GetClipboardFormatName) : registered clipboard formats, registered window messages, registered window classes, ... (range uMsg >= 0xC000) Question: when i CAN'T use RegisterClipboardFormat or RegisterClass instead of RegisterWindowMessage ? Guess - i can do it always. This archive contains also FillRange - for experiments at your own risk :-)
drafts for MenuSpy (pre-version, 13 kb) - all current menus // draft
Puncher (v.2006-01-27, 2 kb) - holey window maker (region eraser) // hasn't own window
MsgReceiver + MsgSender (v.2005-05-15, 10 kb)
(C o n t r a r y) S a m p l e s
(hWnd+1) - lowly trick: Since the value of every hWnd is even we can use its 0-bit as flag. EditEdge (v.2009-05-03, 3 kb) - EDIT + WS_EX_CLIENTEDGE + Themes // XP style forgot WS_EX_CLIENTEDGE for EDIT... Point: SetThemeAppProperties (0) SendMessage (hWnd_Edit,WM_THEMECHANGED,0,0) SetThemeAppProperties (STAP_ALLOW_NONCLIENT or STAP_ALLOW_CONTROLS or STAP_ALLOW_WEBCONTENT) htcaption_minimize (v.2009-04-02, 1.5 kb) - via WM_WINDOWPOSCHANGING: disabled_button (v.2009-02-16, 2 kb) - disabled button, but... CSRSS_MsgBox (v.2008-11-28, 1.3 kb) - Message Box from CSRSS // WinXP-pro-sp2 mb_ghost (v.2008-09-02, 3 kb) - Ghost-window from Message Box // Try with FrameRector and ExtraSpy // WinXP NonDialog (v.2008-08-14, 2 kb) - Test RealGetWindowClass API Undocumented EditBox (v.2008-05-13, 9 kb) - Top-level window with independent titlebar/taskbar texts // Get/SetWindowText, SendMessage(WM_G/SETTEXT) // +DefWindow Undocumented msctls_statusbar32 (v.2008-05-14, 4 kb) - Undocumented ComboBox (v.2008-05-15, 4 kb) - ULW_case (v.2008-05-05, 3 kb) - glass/hole screen via WS_EX_LAYERED+UpdateLayeredWindow xform_4_region (v.2008-04-24, 3 kb) - Initial_Hidden_Modal_DialogBox (v.2008-02-20, 2 kb) - multimain (v.2008-01-27, 3 kb) - NCCALCSIZE (v.2007-12-26, 4 kb) - WM_NCCALCSIZE & WM_NCHITTEST // Try with HTSpy SizeBoxToo (v.2007-06-23, 6 kb) - SizeBox without WS_SIZEBOX: 1) via WM_NCHITTEST (limitation: WS_SYSMENU, Static), 2) via WM_SETCURSOR (+ send WM_SYSCOMMAND) cursor4button (v.2007-05-13, 2 kb) Test_FloatingLangBar (v.2007-04-18, 2 kb) TaskbarCases (v.2007-04-14, 3 kb) CmdParent (v.2007-02-04, 3 kb) - layered parent for console window (cmd.exe) // OS >= Win XP lwa4calc (v.2007-01-29, 5 kb) - "Backspace" button of non-layered XP calc becomes layered, but ... // used hook // OS >= Win XP LayeredChild (v.2007-01-16, 6 kb) - non-layered dialog with layered controls (via SetLayeredWindowAttributes) // OS >= Win XP PaintDesktop presents... (v.2006-12-15, 3 kb) - ... secrets of PrintWindow, WS_EX_COMPOSITED, WS_EX_LAYERED + SetLayeredWindowAttributes // Also try GetDCOrgEx ... Screenshots: PrintWindow , SetLayeredWindowAttributes zEquivalence2 (v.2006-12-19, 1 kb) - Z-equivalence EnumChildWindows and GetWindow(GW_CHILD/GW_HWNDNEXT) // 2 ways to build window tree zEquivalence (v.2006-11-29, 1 kb) - Z-equivalence EnumWindows and GetWindow(GW_HWNDNEXT) MoveableStatic (v.2006-11-29, 2 kb) - window dragging via SendMessage, DefWindowProc, DefDlgProc // MessageBox as child of Static WindowNesting (v.2006-11-06, 8 kb) - limits for NT window nesting (<50) ws_ex_composited (v.2006-09-29, 4 kb) - GroupBox on WS_CLIPCHILDREN DialogBox ; SetLayeredWindowAttributes(LWA_ALPHA+LWA_COLORKEY) + Multiline Scroll Edit ; ws_ex_transparent (v.2006-09-19, 3 kb) - moveable WS_EX_TRANSPARENT Static DrawCaptionTemp (v.2005-12-13, 7 kb) - using undocumented user32 DrawCaptionTemp(A/W) CoupledTrackBar (v.2005-12-04, 3 kb) - "1" track bar with 2 sliders WindowCases (v.2005-09-11, 7 kb) - just for tests (window regions, styles, ...) win2dlg (v.2005-08-14, 2 kb) - dialog (Tab, Enter, Esc, etc) via CreateWindowEx + IsDialogMessage, without subclassing. ncrbutton (v.2005-08-06, 3 kb) - standard caption buttons + right mouse click static2progress (v.2005-07-24, 3 kb) - custom progress bar AntiRen (v.2004-10-24, 2 kb) - joke: estops to rename file, folder, registry key // spy on SysListView32 + SysTreeView32 // hasn't own window
"Spy++ bez potaskuhi" (for Spy++ v6/v7) 4spyxx (v.2007-05-05, 5 kb) - Spy++ automation // Now Spy++ can monitor unstable windows + contra_spyxx (v.2007-04-30, 5 kb) - Spy++ errors.
For Spy by Kobi (v.2.70): Spy_loader (v.2006-09-03, 2 kb) - loader // on-fly displace Finder Tool from TTabSheet to Spy Window
For s0m-scripts: kit4s0m (v.2003-08-27, 28 kb) - external dialogs + examples kit4s0m_dll (v.2004-11-24, 6 kb) - plugin (export: Create_Dialog, Call_API_or_C_Function, Execute_Code) kit4s0m_msg_dll (v.2004-12-24, 5 kb) - plugin (same export) + examples: s0m-exe with embedded plugin (v.2004-11-25, 30 kb), s0m-exe with Msg-loop (v.2004-12-24, 8 kb)(31kb) // tested: 2k-pro-sp4, XP-pro-sp2
Some forum messages
"About HTSYSMENU" (rsdn.ru, 2009-04) // rus "WINDOWINFO.dwExStyle error" (rsdn.ru, 2009-04) // rus "ExtraSpy (+ critique on Iczelion's "Win32 API Tutorial - Dialog Box"" (wasm.ru, 2008-06) // rus "HTSpy (HitTester)" (wasm.ru, 2007-07) // rus "Spy++ bez potaskuhi" (rsdn.ru, 2007-05) // rus "Layered cmd" (rsdn.ru, 2007-02) // Layered console window // rus "PtInWindow ? - Part 2: Non-Layered Dialog with Layered Controls" (rsdn.ru, 2007-01) // rus "PaintDesktop presents..." (rsdn.ru, 2006-12) // rus False info from MSDN (about message-only windows)" (rsdn.ru, 2006-08) // rus "[Something instead of] RegisterWindowMessage" (rsdn.ru, 2005-05) // rus "Attention: PrintWindow (XP)" (asmcommunity.net, 2005-11) // eng "Duplicity Of Edit Control (+ Undocumented EditBox)" (asmcommunity.net, 2003-09 (+ 2008-07)) // eng
1