Jump to content

_GUICreateDlgFrame()


Recommended Posts

With the rover`s example, I wrote a function _GUICreateDlgFrame(). But there is one small problem. The program is listed, when you press ALT-TAB. How do I remove it from there?

Thanks.

#Include <WinAPI.au3>
#Include <WindowsConstants.au3>

global const $GCL_HICON = -14
global const $GCL_HICONSM = -34

_GUICreateDlgFrame('Test', 380, 160, -1, -1, 0, 0, GUICreate('Test_Parent'))
GUISetState()

do
until GUIGetMsg() = -3

func _GUICreateDlgFrame($sTitle, $iWidth = -1, $iHeight = -1, $iLeft = -1, $iTop = -1, $iStyle = 0, $iExStyle = 0, $hParent = 0)

    local $hWnd = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop, BitOR($WS_CAPTION, $WS_SYSMENU, $iStyle), BitOR($WS_EX_DLGMODALFRAME, $iExStyle), $hParent)
    
    if (@error) or ($hWnd = 0) then
        return SetError(1, 0, 0)
    endif
    
    _WinAPI_DestroyIcon(_WinAPI_GetClassLong($hWnd, $GCL_HICON))
    _WinAPI_SetClassLong($hWnd, $GCL_HICON, 0)
    _WinAPI_SetClassLong($hWnd, $GCL_HICONSM, 0)
    
    return SetError(0, 0, $hWnd)
endfunc; _GUICreateDlgFrame

func _WinAPI_GetClassLong($hWnd, $nIndex)
    
    local $ret = DllCall('user32.dll', 'int', 'GetClassLong', 'hwnd', $hWnd, 'int', $nIndex)
    
    if (@error) or ($ret[0] = 0) then
        return 0
    endif
    return $ret[0]
endfunc; _WinAPI_GetClassLong

func _WinAPI_SetClassLong($hWnd, $nIndex, $dwNewLong)
    
    local $ret = DllCall('user32.dll', 'int', 'SetClassLong', 'hwnd', $hWnd, 'int', $nIndex, 'long', $dwNewLong)
    
    if (@error) or ($ret[0] = 0) then
        return 0
    endif
    return $ret[0]
endfunc; _WinAPI_SetClassLong
Link to comment
Share on other sites

With $WS_EX_TOOLWINDOW:

#Include <WinAPI.au3>
#Include <WindowsConstants.au3>

global const $GCL_HICON = -14
global const $GCL_HICONSM = -34

_GUICreateDlgFrame('Test', 380, 160, -1, -1, 0, $WS_EX_TOOLWINDOW, GUICreate('Test_Parent'))
GUISetState()

do
until GUIGetMsg() = -3

func _GUICreateDlgFrame($sTitle, $iWidth = -1, $iHeight = -1, $iLeft = -1, $iTop = -1, $iStyle = 0, $iExStyle = 0, $hParent = 0)

    local $hWnd = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop, BitOR($WS_CAPTION, $WS_SYSMENU, $iStyle), BitOR($WS_EX_DLGMODALFRAME, $iExStyle), $hParent)
   
    if (@error) or ($hWnd = 0) then
        return SetError(1, 0, 0)
    endif
   
    _WinAPI_DestroyIcon(_WinAPI_GetClassLong($hWnd, $GCL_HICON))
    _WinAPI_SetClassLong($hWnd, $GCL_HICON, 0)
    _WinAPI_SetClassLong($hWnd, $GCL_HICONSM, 0)
   
    return SetError(0, 0, $hWnd)
endfunc; _GUICreateDlgFrame

func _WinAPI_GetClassLong($hWnd, $nIndex)
   
    local $ret = DllCall('user32.dll', 'int', 'GetClassLong', 'hwnd', $hWnd, 'int', $nIndex)
   
    if (@error) or ($ret[0] = 0) then
        return 0
    endif
    return $ret[0]
endfunc; _WinAPI_GetClassLong

func _WinAPI_SetClassLong($hWnd, $nIndex, $dwNewLong)
   
    local $ret = DllCall('user32.dll', 'int', 'SetClassLong', 'hwnd', $hWnd, 'int', $nIndex, 'long', $dwNewLong)
   
    if (@error) or ($ret[0] = 0) then
        return 0
    endif
    return $ret[0]
endfunc; _WinAPI_SetClassLong
Link to comment
Share on other sites

Link to comment
Share on other sites

This works for me :)

$hiddenGUI = GUICreate('Test_Parent',0,0,0,0,0,$WS_EX_TOOLWINDOW)
_GUICreateDlgFrame('Test', 380, 160, -1, -1, 0, 0, $hiddenGUI )

and no other changes to your code.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

I checked it out to test and see if i could help... and nothing came up!! I closed the replacement, and it now appears... and i am confused... I have looked into it, and I haven't set any exceptions that would apply to that window... but even if i disable them all, same result.

don't worry, its not your problem, neither does it doesn't answer yours.

MDiesel

Link to comment
Share on other sites

This works for me :)

$hiddenGUI = GUICreate('Test_Parent',0,0,0,0,0,$WS_EX_TOOLWINDOW)
_GUICreateDlgFrame('Test', 380, 160, -1, -1, 0, 0, $hiddenGUI )

and no other changes to your code.

Ahh..., it really works. x8 thanks to you, ProgAndy.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...