WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Windows UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WinStyleTest UDF

 Keywords: WIndows Style StyleEx WinStyleTest UDF GetWindowLongA SetWindowLongA SetWindowPos

#DefineFunction WinStyleTest(title)
;Use at own risk.. some styles may stop your window working properly
;see http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx
;see http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx
        GWL_STYLE = -16
        GWL_EXSTYLE = -20
        WS_OVERLAPPED = 0;Same as WS_TILED   You could almost think of this as the generic default window for most applications.. It has a Title bar and a Border 
        WS_BORDER = 8388608
        WS_CAPTION = 12582912
        WS_DLGFRAME = 4194304
        WS_SIZEBOX = 262144;Same as WS_THICKFRAME
        WS_HSCROLL = 1048576
        WS_VSCROLL = 2097152

        WS_EX_CLIENTEDGE = 512
        WS_EX_DLGMODALFRAME = 1
        WS_EX_STATICEDGE = 131072
        WS_EX_TOOLWINDOW = 128
        WS_EX_WINDOWEDGE = 256


        hWnd=DllHwnd(title)
        DllUSER32=strcat(DirWindows(1),"USER32.DLL")
        Style=DllCall(DllUSER32,long:"GetWindowLongA",long:hWnd,long:GWL_STYLE)
        StyleEx=DllCall(DllUSER32,long:"GetWindowLongA",long:hWnd,long:GWL_EXSTYLE)

        Message("Current Styles: Style and StyleEx",Style:@CR:StyleEx)

        Style = Style ^ WS_DLGFRAME			    ; Add Style
        StyleEx=StyleEx ^ WS_EX_TOOLWINDOW	 ; Add StyleEx

   DllCall(DllUSER32,long:"SetWindowLongA",long:hWnd,long:GWL_STYLE,long:Style)

   DllCall(DllUSER32,long:"SetWindowLongA",long:hWnd,long:GWL_EXSTYLE,long:StyleEx)

DllCall(DllUSER32,long:"SetWindowPos", long:hWnd, long:0, long:0, long:0, long:0, long:0, long:32|2|1);Redraw
#EndFunction


;WinStyleTest("Untitled - Notepad")
WinStyleTest("Calculator")
Exit

Article ID:   W18421
Filename:   WinStyleTest UDF.txt
File Created: 2013:12:16:10:25:14
Last Updated: 2013:12:16:10:25:14