Sign in to follow this  
Followers 0
Klexen

Change the shape of the Gui?

14 posts in this topic

Is this at all possible with autoit?

Share this post


Link to post
Share on other sites



Is this at all possible with autoit?

Fantastic method here for custom GUI shapes based upon a .PNG

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Here is an example based on Larry's script

#include <GUIConstants.au3>
HotKeySet("{ESC}", "Terminate")
Func Terminate()
    GUIDelete($gui)
    Exit
EndFunc   ;==>Terminate
Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc   ;==>SetWindowRgn
$gui = GUICreate("", 600, 383, -1, -1, $WS_POPUP)
GUICtrlCreatePic(".\superman.bmp", 0, 0, 600, 383)
$a = DllCall(".\BMP2RGN.dll", "int", "BMP2RGN", _
        "str", ".\superman.bmp", _
        "int", 255, _
        "int", 255, _
        "int", 255)
SetWindowRgn($gui, $a[0])
GUISetState(@SW_SHOW, $gui)
While 1
    Sleep(50)
WEnd

attached files required.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thanks guys, I will definately check this out. I was also wondering if it would be possible to remove the gray background on my radio buttons? I have them ontop of an image, and it looks dumb because you have an image with a long gray rectangle.

Share this post


Link to post
Share on other sites

using Big Dods info...

... This will do the trick!!!

#include <GUIConstants.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
Global Const $WM_SYSCOMMAND = 0x0112

Dim $XS_n
Dim $Pic_File = "c:\temp\superman.bmp" 

HotKeySet("{ESC}", "Terminate")

$gui = GUICreate("", 600, 383, -1, -1, $WS_POPUP)
XPStyle (1)
$pic = GUICtrlCreatePic($Pic_File, 0, 0, 600, 383, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetState($pic, $GUI_DISABLE)
$chk_bx = GUICtrlCreateCheckbox("this is a checkbox", 220, 10, 120, 20)
GUICtrlSetColor($chk_bx, 0xFF0000)
GUICtrlSetBkColor($chk_bx, "")
XPStyle (0)
GUISetState()

SetWindowRgn($gui, $Pic_File)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")

While 1
    Sleep(50)
WEnd

Func _WinMove($HWnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func XPStyle ($OnOff = 1)
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>XPStyle

Func Terminate()
    GUIDelete($gui)
    Exit
EndFunc   ;==>Terminate

Func SetWindowRgn($h_win, $p_rgn)
    $a = DllCall(".\BMP2RGN.dll", "int", "BMP2RGN", "str", $p_rgn, "int", 255, "int", 255, "int", 255)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $a[0], "int", 1)
EndFunc   ;==>SetWindowRgn

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

using Big Dods info...

... This will do the trick!!!

#include <GUIConstants.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
Global Const $WM_SYSCOMMAND = 0x0112

Dim $XS_n
Dim $Pic_File = "c:\temp\superman.bmp" 

HotKeySet("{ESC}", "Terminate")

$gui = GUICreate("", 600, 383, -1, -1, $WS_POPUP)
XPStyle (1)
$pic = GUICtrlCreatePic($Pic_File, 0, 0, 600, 383, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetState($pic, $GUI_DISABLE)
$chk_bx = GUICtrlCreateCheckbox("this is a checkbox", 220, 10, 120, 20)
GUICtrlSetColor($chk_bx, 0xFF0000)
GUICtrlSetBkColor($chk_bx, "")
XPStyle (0)
GUISetState()

SetWindowRgn($gui, $Pic_File)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")

While 1
    Sleep(50)
WEnd

Func _WinMove($HWnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func XPStyle ($OnOff = 1)
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>XPStyle

Func Terminate()
    GUIDelete($gui)
    Exit
EndFunc   ;==>Terminate

Func SetWindowRgn($h_win, $p_rgn)
    $a = DllCall(".\BMP2RGN.dll", "int", "BMP2RGN", "str", $p_rgn, "int", 255, "int", 255, "int", 255)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $a[0], "int", 1)
EndFunc   ;==>SetWindowRgn

8)

I get this error when trying to run script...

ERROR: $WM_SYSCOMMAND previously declared as a 'Const'

Global Const $WM_SYSCOMMAND = 0x0112

Share this post


Link to post
Share on other sites

Thats because you are using beta, just comment out that line with a ";"

Like this

;Global Const $WM_SYSCOMMAND = 0x0112

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Wow man you're awesome.

Thanks....

So I can change the color, but can I make it transparent?

What do I lose from commenting this out? Global Const $WM_SYSCOMMAND = 0x0112 ?

Share this post


Link to post
Share on other sites

What do I lose from commenting this out? Global Const $WM_SYSCOMMAND = 0x0112 ?

Nothing. The constant has already been declared in one of your #include files.

<_<


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

What do I lose from commenting this out? Global Const $WM_SYSCOMMAND = 0x0112 ?

Nothing, there is no problem, it just wont work with the public release of Autoit without that line

*********

another way to "skin the cat" with checkbox and transparency is

#include <GUIConstants.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
;Global Const $WM_SYSCOMMAND = 0x0112

Dim $XS_n
Dim $Pic_File = "c:\temp\superman.bmp" 

HotKeySet("{ESC}", "Terminate")

$gui = GUICreate("", 600, 383, -1, -1, $WS_POPUP)
XPStyle (1)
$pic = GUICtrlCreatePic($Pic_File, 0, 0, 600, 383, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetState($pic, $GUI_DISABLE)
$chk_bx = GUICtrlCreateCheckbox("", 205, 10, 13, 13)
$lbl = GUICtrlCreateLabel("This is a checkbox", 220, 10, 120, 15)
GUICtrlSetColor($lbl, 0xFF0000)
GUICtrlSetBkColor($lbl, $GUI_BKCOLOR_TRANSPARENT )
XPStyle (0)
GUISetState()

SetWindowRgn($gui, $Pic_File)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")


While 1
    Sleep(50)
WEnd

Func _WinMove($HWnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func XPStyle ($OnOff = 1)
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>XPStyle

Func Terminate()
    GUIDelete($gui)
    Exit
EndFunc   ;==>Terminate

Func SetWindowRgn($h_win, $p_rgn)
    $a = DllCall(".\BMP2RGN.dll", "int", "BMP2RGN", "str", $p_rgn, "int", 255, "int", 255, "int", 255)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $a[0], "int", 1)
EndFunc   ;==>SetWindowRgn

*****************

Welcome!!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Wow this is great, it looks really good. Only thing is I need to use a radio button. Well not exactly NEED to, but would like to. Since the Checkbox is square, you get no color behind it. But if u use a radio with a -w13 -h13 you still see a little grey behind it. Anything I can do about that?

Share this post


Link to post
Share on other sites

when i run your first example (valuater) i get an error:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Owner\Desktop\temp.au3"

C:\Documents and Settings\Owner\Desktop\temp.au3 (54) : ==> Subscript used with non-Array variable.:

DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $a[0], "int", 1)

DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $a^ ERROR

>Exit code: 1 Time: 0.313


[center][/center]

Share this post


Link to post
Share on other sites

nevermind i got it working just didnt need the array value just $a


[center][/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0