farhadrahman2

GUI buttons are disappearing.

12 posts in this topic

Hi guys I need help with a script I have already compiled .But when I open it ,it works fine and as soon as I minimize it and maximize it after a while I see all my buttons and labels disappeared. I'm going to attach some files .

Please help me fix it.

Problem1.PNG

PROBLEM2.PNG

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Yeah I did set the background pic control to $Gui_disable and I tried both the methods but it's still not working.

Here is my script

#include <ColorConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <WinAPI.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()

    Local $hGUI = GUICreate("Launch It - By PC HACKZ", 640, 400)
    Local $idOK = GUICtrlCreateButton("Launch Notepad ", 5, 260, 90, 30, $BS_FLAT)
    _WinAPI_RedrawWindow(GUICtrlGetHandle($idOK))
    GUICtrlSetTip($idOK, "Click Here To Launch Notepad")
    Local $fucj = GUICtrlCreateButton("Launch  CMD ", 5, 295, 90, 30)
    GUICtrlSetTip($fucj, "Click Here To Launch Command Prompt")
    Local $fuck = GUICtrlCreateButton("Launch Paint ", 5, 330, 90, 30)
    GUICtrlSetTip($fuck, "Click Here To Launch Paint")
    Local $fucl = GUICtrlCreateButton("Launch Narrator ", 5, 365, 90, 30)
    GUICtrlSetTip($fucl, "Click Here To Launch Narrator")
    Local $fucg = GUICtrlCreateButton("Launch Wordpad ", 545, 260, 90, 30)
    GUICtrlSetTip($fucg, "Click Here To Launch Wordpad")
    Local $fucs = GUICtrlCreateButton("Launch System Info. ", 530, 295, 105, 30)
    GUICtrlSetTip($fucs, "Click Here To See Your System's Information")
    Local $fuch = GUICtrlCreateButton("Launch Registry Editor ", 520, 330, 115, 30)
    GUICtrlSetTip($fuch, "Click Here To Make Changes To Your Registry ")
    Local $fuci = GUICtrlCreateButton("Launch Resource Monitor ", 505, 365, 130, 30)
    GUICtrlSetTip($fuci, "Click Here To Monitor Your Resources")
    Local $about = GUICtrlCreateButton("About", 545, 5, 90, 30)
    GUICtrlSetTip($about, "Click Here To Get Some Intel About US")
    Local $label = GUICtrlCreateLabel("Click Here To Visit Pc Hackz ", 190, 355, 270, 20)
    GUICtrlSetCursor($label, 0)
    GUICtrlSetFont($label, 15, 700)
    GUICtrlSetBkColor($label, $GUI_BKCOLOR_TRANSPARENT)
    Local $label1 = GUICtrlCreateLabel("Welcome To Launch It ", 205, 180, 230, 25)
    GUICtrlSetFont($label1, 17, 700)
    GUICtrlSetBkColor($label1, $GUI_BKCOLOR_TRANSPARENT)
    _WinAPI_SetLayeredWindowAttributes($hGUI, 0x010101)
    GUISetState(@SW_SHOW)

    Local $idpic = GUICtrlCreatePic("E:\DEFAULT_GUI_PIC.jpg", 1, 1, 640, 400)
    GUISetState($idpic, $GUI_DISABLE)

    While 1
        Switch GUIGetMsg()
            Case $idOK
                ShellExecute("notepad.exe")
            Case $fucj
                ShellExecute("cmd.exe")
            Case $fuck
                ShellExecute("mspaint.exe")
            Case $fucl
                ShellExecute("Narrator.exe")
            Case $fucg
                ShellExecute("C:\Program Files\Windows NT\Accessories\wordpad.exe")
            Case $fucs
                ShellExecute("msinfo32.exe")
            Case $fuch
                ShellExecute("regedt32.exe")
            Case $fuci
                ShellExecute("resmon.exe")
            Case $about
                MsgBox(8256, "PC HACKZ - About", "LAUNCHY" & @CRLF & "" & @CRLF & "Version - 1.0" & @CRLF & "" & @CRLF & _
                "Made By PC HACKZ" & @CRLF & "" & @CRLF & "Like US & Share our posts." & @CRLF & "" & @CRLF & _
                "Visit www.pchackz.wordpress.com ." & @CRLF & "")
            Case $label
                ShellExecute("www.pchackz.wordpress.com")
            Case -3
                Dim $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(8244, "PC HACKZ ", "Are You Sure You Want To Close Our App? ")
                Select
                    Case $iMsgBoxAnswer = 6 ;Yes
                        Exit
                    Case $iMsgBoxAnswer = 7 ;No
                EndSelect
        EndSwitch
    WEnd
    
EndFunc   ;==>Example

 

 

Edited by Melba23
Added code tags

Share this post


Link to post
Share on other sites

farhadrahman2,

Welcome to the AutoIt forums.

When you post code please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks for correcting me .

I was wondering if anybody could give me the solution to my problem.

Thanks in advance.

Share this post


Link to post
Share on other sites

Just create Pic first and set it's state (not the Gui) to disable:

#include <ColorConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <WinAPI.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("Launch It - By PC HACKZ", 640, 400)
    Local $idpic = GUICtrlCreatePic("C:\Program Files\AutoIt3\Examples\GUI\msoobe.jpg", 1, 1, 640, 400)
    GUICtrlSetState($idpic, $GUI_DISABLE)           ;<============ GuiCtrlSetState
    Local $idOK = GUICtrlCreateButton("Launch Notepad ", 5, 260, 90, 30, $BS_FLAT)
    GUICtrlSetTip($idOK, "Click Here To Launch Notepad")
    Local $fucj = GUICtrlCreateButton("Launch  CMD ", 5, 295, 90, 30)
    GUICtrlSetTip($fucj, "Click Here To Launch Command Prompt")
    Local $fuck = GUICtrlCreateButton("Launch Paint ", 5, 330, 90, 30)
    GUICtrlSetTip($fuck, "Click Here To Launch Paint")
    Local $fucl = GUICtrlCreateButton("Launch Narrator ", 5, 365, 90, 30)
    GUICtrlSetTip($fucl, "Click Here To Launch Narrator")
    Local $fucg = GUICtrlCreateButton("Launch Wordpad ", 545, 260, 90, 30)
    GUICtrlSetTip($fucg, "Click Here To Launch Wordpad")
    Local $fucs = GUICtrlCreateButton("Launch System Info. ", 530, 295, 105, 30)
    GUICtrlSetTip($fucs, "Click Here To See Your System's Information")
    Local $fuch = GUICtrlCreateButton("Launch Registry Editor ", 520, 330, 115, 30)
    GUICtrlSetTip($fuch, "Click Here To Make Changes To Your Registry ")
    Local $fuci = GUICtrlCreateButton("Launch Resource Monitor ", 505, 365, 130, 30)
    GUICtrlSetTip($fuci, "Click Here To Monitor Your Resources")
    Local $about = GUICtrlCreateButton("About", 545, 5, 90, 30)
    GUICtrlSetTip($about, "Click Here To Get Some Intel About US")
    Local $label = GUICtrlCreateLabel("Click Here To Visit Pc Hackz ", 190, 355, 270, 20)
    GUICtrlSetCursor($label, 0)
    GUICtrlSetFont($label, 15, 700)
    GUICtrlSetBkColor($label, $GUI_BKCOLOR_TRANSPARENT)
    Local $label1 = GUICtrlCreateLabel("Welcome To Launch It ", 205, 180, 230, 25)
    GUICtrlSetFont($label1, 17, 700)
    GUICtrlSetBkColor($label1, $GUI_BKCOLOR_TRANSPARENT)
    ;_WinAPI_SetLayeredWindowAttributes($hGUI, 0x010101)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $idOK
                ShellExecute("notepad.exe")
            Case $fucj
                ShellExecute("cmd.exe")
            Case $fuck
                ShellExecute("mspaint.exe")
            Case $fucl
                ShellExecute("Narrator.exe")
            Case $fucg
                ShellExecute("C:\Program Files\Windows NT\Accessories\wordpad.exe")
            Case $fucs
                ShellExecute("msinfo32.exe")
            Case $fuch
                ShellExecute("regedt32.exe")
            Case $fuci
                ShellExecute("resmon.exe")
            Case $about
                MsgBox(8256, "PC HACKZ - About", "LAUNCHY" & @CRLF & "" & @CRLF & "Version - 1.0" & @CRLF & "" & @CRLF & "Made By PC HACKZ" & @CRLF & "" & @CRLF & "Like US & Share our posts." & @CRLF & "" & @CRLF & "Visit www.pchackz.wordpress.com ." & @CRLF & "")
            Case $label
                ShellExecute("www.pchackz.wordpress.com")
            Case -3
                Dim $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(8244, "PC HACKZ ", "Are You Sure You Want To Close Our App? ")
                Select
                    Case $iMsgBoxAnswer = 6 ;Yes
                        Exit
                    Case $iMsgBoxAnswer = 7 ;No
                EndSelect
        EndSwitch
    WEnd
EndFunc   ;==>Example

and as Melba23 said: use Code tags as i did.

Share this post


Link to post
Share on other sites

Awesome job man!!!

Now it's working perfect .

Can you do me a favor and tell me how to make the picture on my GUI transparent. 

Thanks for the time and help.

Share this post


Link to post
Share on other sites

Afaik not possible with JPG's, only with PNG's.

Share this post


Link to post
Share on other sites

Okay then I will convert the image to PNG and then will it work.

 

Share this post


Link to post
Share on other sites

A example from @UEZ:

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

_GDIPlus_Startup()
Global Const $SC_DRAGMOVE = 0xF012
Global $iW, $iH, $hImage, $hBitmap, $hGUI
$hImage = _GDIPlus_BitmapCreateFromFile("C:\Program Files\AutoIt3\Examples\GUI\Torus.png")
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$iW = _GDIPlus_ImageGetWidth($hImage)
$iH = _GDIPlus_ImageGetHeight($hImage)
$hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetState()
_WinAPI_BitmapDisplayTransparentInGUI($hBitmap, $hGUI)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_WinAPI_DeleteObject($hBitmap)
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_Shutdown()
GUIDelete()

Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True)
    If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0)
    Local $tDim = DllStructCreate($tagBITMAP)
    If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0)
    Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION)
    Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap)
    $tSize.X = $tDim.bmWidth
    $tSize.Y = $tDim.bmHeight
    $tBlend.Alpha = $iOpacity
    $tBlend.Format = 1
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteDC($hMemDC)
    If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap)
    Return True
EndFunc


Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc   ;==>_WM_LBUTTONDOWN

 

Share this post


Link to post
Share on other sites

Thanks . It helped me a lot.

See you around.:)

Share this post


Link to post
Share on other sites

#12 ·  Posted

hey guys i found something

Try this to set the pic and the gui to transparent.

 

WinSetTrans(#hgui,"",230)

Have a good day

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