Sign in to follow this  
Followers 0
nguyenbason

Transparent GUI movable

6 posts in this topic

#1 ·  Posted (edited)

Dear all,

I'm going to create a program like a launcher. I create GUI and set as transparent properties, then i create a pic control use GUICtrlCreatePic and load a picture to fill out all the GUI. The problem here is: I want to move the GUI when click move the Pic. Please help me out. Here is my code.

Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=E:\Sanh Dieu Online Season\ddr_online.ico
#AutoIt3Wrapper_outfile=Launcher.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Sanh Dieu Online
#AutoIt3Wrapper_Res_Description=Sanh Dieu Online
#AutoIt3Wrapper_Res_Fileversion=6.4.0.0
#AutoIt3Wrapper_Res_LegalCopyright=LiveVN.com
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <Inet.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>

Opt('TrayIconHide', 1)
Opt("GUIOnEventMode", 1)
Opt("MouseCoordMode", 0);see Level I or Search Help for "options".
Opt("PixelCoordMode", 0)

; ====================================================================================================
===========================
; Global variables
; ====================================================================================================
===========================
#Region ### START Koda GUI section ### Form=c:\users\sonnb\desktop\sanhdieu_launcher\form1.kxf
; ====================================================================================================
===========================
; Set image for form
; ====================================================================================================
===========================
;_GDIPlus_Startup()
$Face = @TempDir & "\Face.jpg"
FileInstall("Face.jpg", $Face)
$GUI = GUICreate("Sanh Dieu Online", 657, 600, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetState(@SW_SHOW)
; ====================================================================================================
===========================
;OK Button
; ====================================================================================================
===========================
$OK_Pics = @TempDir & "\Bitmap_154.bmp"
FileInstall("Bitmap_154.bmp", $OK_Pics)
$OK = GUICtrlCreateButton("(Not allowed)", 152, 544, 90, 33, BitOR($BS_PUSHBOX, $BS_BITMAP))
GUICtrlSetImage(-1, $OK_Pics, 0)
GUICtrlSetState(-1, $GUI_Disable)
GUICtrlSetOnEvent($ok,"StartGame")
; ====================================================================================================
===========================
;Mini Button
; ====================================================================================================
===========================
$Mini_Pics = @TempDir & "\Bitmap_169.bmp"
FileInstall("Bitmap_169.bmp", $Mini_Pics)
$Mini = GUICtrlCreateButton("(Not allowed)", 272, 544, 90, 33, BitOR($BS_PUSHBOX, $BS_BITMAP))
GUICtrlSetImage(-1, $Mini_Pics, 0)
;GUICtrlSetState(-1, $GUI_Disable)
; ====================================================================================================
===========================
;Exit Button
; ====================================================================================================
===========================
$Exit_Pics = @TempDir & "\Bitmap_160.bmp"
FileInstall("Bitmap_160.bmp", $Exit_Pics)
$Exit = GUICtrlCreateButton("(Not allowed)", 392, 544, 90, 33, BitOR($BS_PUSHBOX, $BS_BITMAP))
GUICtrlSetImage(-1, $Exit_Pics, 0)
GUICtrlSetOnEvent($Exit,"ExitLauncher")
; ====================================================================================================
===========================
;Website interface
; ====================================================================================================
===========================
$w = ObjCreate("Shell.Explorer.2")
$Breaktime = GUICtrlCreateObj($w, 42, 85, 573, 335)
;Make a label for starup status
$StatusLable = GUICtrlCreateLabel("Dang kiem tra phien ban. Xin vui long cho trong giay lat", 128, 456, 292, 17)
;Get web navigate url from patch.ini file
$PatchFile = @ScriptDir & "\patch.ini"
$w_url = IniRead($PatchFile,"url","Thanh Pho TRE!","?")
;Get local current version from ver.ini file

    If not FileExists("ver.ini") Then
        FileWriteLine("ver.ini","[version]")
        FileWriteLine("ver.ini","version = 20090505")
    EndIf
$VerFile = @ScriptDir & "\ver.ini"
$Ver = IniRead($VerFile,"version","version","?")
;Get patch url from patch.ini file
$Patch_url = IniRead($PatchFile,"region","Thanh Pho TRE!","?")
;Download ver_check.ini from patch url
;MsgBox (0,"",$Patch_url & "/ver.txt")
InetGet("http://" & $Patch_url & "/ver.txt",@ScriptDir & "\ver_check.ini",1,1)
;Get Gateway url
$gw_url = IniRead($PatchFile,"gateway","Thanh Pho TRE!","?")
;Get gateway ip address from url
;$gw_ip = _GetIP($gw_url)
$Pic1 = GUICtrlCreatePic($Face, 0, 0, 657, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

    $w.navigate($w_url)

;While @InetGetActive
;   Sleep(1000)
;WEnd
    
    $VerCheckFile = @ScriptDir & "\ver_check.ini";Location of server currently version file
    $VerCheck = IniRead($VerFile,"version","version","?");Get server currently version

    If $Ver < $VerCheck Then; compare client and server currently version
        ShellExecute("Sanh Dieu.exe")
        IniWrite($VerFile,"version","version",$VerCheck)
        ExitLauncher()
    Else
        GUICtrlSetData($StatusLable,"Ban da cai phien ban moi nhat. Nhan Dong y de vao game")
        GUICtrlSetState($OK, $GUI_enable)
    EndIf   

While 1
    $nMsg = GUIGetMsg()

    Switch $nmsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

; ====================================================================================================
===========================
; Exit launcher when exit button is pressed
; ====================================================================================================
===========================
Func ExitLauncher()
    Exit
EndFunc

; ====================================================================================================
===========================
; Start game when ok button is pressed
; ====================================================================================================
===========================
Func StartGame()
    Run ( 'BugRep.bin x.x.x.x xxx 1  1')
    Exit
EndFunc

And one addition question: Can i get a ip of a url? Like in the VB6 i can use module and get IP. Eg: text1.text = GetIP("www.autoitscript.com") then the text box will display the IP of website. But i cannot find out how to do it in autoit.

Thanks you all for any help and reading.

Best Regards,

Edited by nguyenbason

UnderWorldVN- Just play the way you like it

Share this post


Link to post
Share on other sites



Function Ping(MyHostName)
' This function returns True if the specified host could be pinged.
' myHostName can be a computer name or IP address.
' The Win32_PingStatus class used in this function requires Windows XP or later.
' This function is based on the TestPing function in a sample script by Don Jones
' http://www.scriptinganswers.com/vault/computer%20management/default.asp#activedirectoryquickworkstationinventorytxt

    ' Standard housekeeping
    Dim colPingResults, objPingResult, strQuery

    ' Define the WMI query
    strQuery = "SELECT * FROM Win32_PingStatus WHERE Address = '" & myHostName & "'" '& " AND ResolveAddressNames = " & True 

    ' Run the WMI query
    Set colPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery( strQuery )

    ' Translate the query results to either True or False
    For Each objPingResult In colPingResults
        If Not IsObject( objPingResult ) Then
            Ping = False
        ElseIf objPingResult.StatusCode = 0 Then
            'WScript.Echo objPingResult.ProtocolAddress
            'Ping = True
            Ping = "True, With the IP" & objPingResult.ProtocolAddress
        Else
            Ping = False
        End If
    Next
    Set colPingResults = Nothing
End Function

this is the code i use for checking if a proper internet address is online and get its ip address its in vbs of course, it would be easy to get it in autoit.

Share this post


Link to post
Share on other sites

;Global Const = $GUI_WS_EX_PARENTDRAG = 0x00100000 ;ref: windowsconstants.au3

GUICtrlCreatePic($Face, 0, 0, 657, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$GUI_WS_EX_PARENTDRAG))

should work ?

Don't work. Have other way?

I also tried GDIPlus and can move it but the control button and web control cannot display (mean you cannot see it but when you click at its position it still works)


UnderWorldVN- Just play the way you like it

Share this post


Link to post
Share on other sites

I'm still looking for a solution. Anyone have a better way?


UnderWorldVN- Just play the way you like it

Share this post


Link to post
Share on other sites

;Global Const = $GUI_WS_EX_PARENTDRAG = 0x00100000 ;ref: windowsconstants.au3

GUICtrlCreatePic($Face, 0, 0, 657, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$GUI_WS_EX_PARENTDRAG))

should work ?

It should be

GUICtrlCreatePic($Face, 0, 0, 657, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS),$GUI_WS_EX_PARENTDRAG)

Work fine now. Thanks so much :)


UnderWorldVN- Just play the way you like it

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