Jump to content

button


Vaeb
 Share

Recommended Posts

I fixed the Script:

#include <GuiConstants.au3>
Global $hWnd
Global $Width = 440, $Height = $Width
Global $Good = 1

$hWnd = GuiCreate('MyButton', $Width, $Height)

For $i = 1 to 6
For $j = 1 to 6
  $Button = GUICreate("AButton", 70, 70, 10 + 70*($i-1), 10 + 70*($j-1),  $WS_POPUP,  BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd)
  GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif", 0, 0, 0, 0)
    GUISetState(@SW_SHOW, $Button)
    
next
$Invisible = GUICreate("invisible gui",100,100,100,100,  $WS_POPUP,  BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd)
    GUISetState(@SW_SHOW, $Invisible)
next
$Invisible2 = GUICreate("invisible gui2",100,100,100,100,  $WS_POPUP,  BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd)
    GUISetState(@SW_SHOW, $Invisible2)
    GUISetState(@SW_SHOW, $hWnd)

    
    
While 1
$Msg = GUIGetMsg(1)
  If WinActive('AButton','') then
      MsgBox(0,'','Hi!')
      WinActivate('invisible gui','')
  endif
Select
  case $Msg[0] = $GUI_EVENT_CLOSE
    exit
  endselect
WEnd
Link to comment
Share on other sites

Well. You can start from the begining.

Try this script:

#include <GuiConstants.au3>
Global $hWnd
Global $Width = 400, $Height = $Width
Global $Good = 1

$hWnd = GuiCreate('MyButton', $Width, $Height)

$Button = GUICreate("AButton", 70, 70, 10, 10,  $WS_POPUP,  BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd)
GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif", 0, 0, 0, 0)

GUISetState(@SW_SHOW, $Button)
GUISetState(@SW_SHOW, $hWnd)

While 1
$Msg = GUIGetMsg(1)
  If WinActive('AButton','') then
      MsgBox(0,'','Hi!')
      WinActivate('MyButton','')
  endif
Select
  case $Msg[0] = $GUI_EVENT_CLOSE
    exit
  endselect
WEnd

Click Merlin. He will open Message Box with "Hi!".

Now you can press {Alt+Tab}. Or open other window. Merlin will silent.

Isn't it valid for you?

The point of world view

Link to comment
Share on other sites

Valery's script works fine for me

Try this...

#include <GuiConstants.au3>
Global $hWnd
Global $Width = 400, $Height = $Width
Global $Good = 1

$hWnd = GUICreate('MyButton', $Width, $Height)

$Button = GUICreate("AButton", 70, 70, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hWnd)
$pic = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 0, 0, 0, 0)

GUISetState(@SW_SHOW, $Button)
GUISetState(@SW_SHOW, $hWnd)

While 1
    $Msg = GUIGetMsg(1)
    If $Msg[0] = $pic Then
        MsgBox(0, '', 'Hi!',2)
        WinActivate('MyButton', '')
    EndIf
    Select
        Case $Msg[0] = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

How should the script look like when I use 2 buttons?

This is my try to get two buttons:

#include <GuiConstants.au3>
Global $hWnd
Global $Width = 400, $Height = $Width
Global $Good = 1

$hWnd = GUICreate('MyButton', $Width, $Height)

    $og2 = GUICreate("Obergeschoss 2", 124, 32, 280, 830, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hWnd)
    $obg2 = GUICtrlCreatePic(@ScriptDir & "\System\Unused Buttons\GlossyRoundButton.bmp", 0, 0, 0, 0)
    
    $og1 = GUICreate("Obergeschoss 1", 124, 32, 130, 830, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hWnd)
    $obg1 = GUICtrlCreatePic(@ScriptDir & "\System\Unused Buttons\GlossyRoundButton.bmp", 0, 0, 0, 0)
    
GUISetState(@SW_SHOW, $og1)
GUISetState(@SW_SHOW, $og2)
GUISetState(@SW_SHOW, $hWnd)


    While 1
        $Msg = GUIGetMsg(1)
        Switch $Msg
            Case $Msg[0] = $obg1
                MsgBox(0,"I want","2 buttons!",2)
                WinActivate('MyButton', '')
            Case $Msg[0] = $obg2
                MsgBox(0,"I do","too!",2)
                WinActivate('MyButton', '')
            Case $Msg[0] = $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

The script opens msgbox1 before i click on button 1...

why?

Thanks Valery and Valuater

Greets

Vaeb

Edited by Vaeb
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...