Jump to content

gui with _ispressed and mousegetpos


memnon
 Share

Recommended Posts

Hello,

i made a little gui with "ESC" to exit and a red cross on the right upper corner of the transparent gui to terminate it...

While Hotkeyset works, my try to close on the red "x" on the corner doesnt work - i changed mousecoordmode to 0 to have mousepositions relativly to my active gui - and i get the right coordinations on the console...

where is my error on my little script...?

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

Local $hDLL = DllOpen("user32.dll")

AutoItSetOption ("MouseCoordMode",0)
HotKeySet("{ESC}", "Terminate")

Local $sFile = "c:\a\rund.gif"

$pic = GUICreate("News", 625, 186, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
$pic_stay = GUICtrlCreatePic($sFile, 0, 0, 625, 186,-1, $GUI_WS_EX_PARENTDRAG)

$Zeile1="Das ist ein Test, Zeile1"
$Zeile2="Das ist ein Test, Zeile2"
$Zeile3="Das ist ein Test, Zeile3"
$Zeile4="Das ist ein Test, Zeile4"

$Group1 = GUICtrlCreateGroup("", 195, 40, 422, 137)
GUICtrlSetBkColor(-1, 0x004E98)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Label3 = GUICtrlCreateLabel($Zeile1 & @CRLF & $Zeile2 & @CRLF & $Zeile3 & @CRLF & $Zeile4 & @CRLF & @CRLF & "Für nähere Informationen bitte hier klicken", 200, 50, 400, 130)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
;GUICtrlSetColor(-1, 0x004e98)
GUICtrlSetColor(-1, 0xFFFFFF)

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)


while GUIGetMsg() <> $GUI_EVENT_CLOSE

    $aPos = MouseGetPos()
    if $aPos[0] > 595 and $aPos[0] < 620 and _IsPressed("01",$hDLL) then Exit 0

wend


Func Terminate()
    Exit 0
EndFunc

 

 

Edited by memnon

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

$Button_XClose = GUICtrlCreatePic($InstallDir & "\X.bmp", 570, 4, 22, 22)
GUICtrlSetTip($Button_XClose, 'Close Player', "Close", 1)
GUICtrlSetOnEvent($Button_XClose, "Quit")

why not like this?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

the thing is, the gui looks really freaky, and i "painted" all options on the pic - so all i need is queries to get the correct mouseposition and leftmouse click on that coordinates

 

its not only the "x" there are more spots i want to watch and apply action on clicks

btw it isnt even working, if i only use _ispressed, without the mousepos..

if _IsPressed("01",$hDLL) then Exit 0

 

and beside - i dont understand why my methode isnt working, i used coded already postet in forum - working

 

i am also not sure if its gui related or a general support question (where i posted that thread before)

Edited by memnon

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

please post the .gif so i can test

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I only asked for it because i got the idea that it is a special gif, with 4 parts/divided in 4 sections.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Ok but the idea is that with a click in each of 4 portions of the label, it should act and do an action right?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

aehm yes for example

 

the red x in upper right corner is like the normal "windows"-x you know from windows 7 to close a window

another area from the gui should open then a pdf if i click to that coordinates

,... not sure if 4 areas are enough, have to think about it , but i guess you know what i mean

ah sorry - engllish is not my main language...

the label you see with that 4 rows is nothing else than a quickinfo of the pdf you open, if you click on that whole area within the group1 zone, i only made for optical, the pdf should open

Edited by memnon

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

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

Local $hDLL = DllOpen("user32.dll")

Opt("MouseCoordMode", 0)
HotKeySet("{ESC}", "Terminate")

Local $sFile = "C:\Program Files (x86)\AutoIt3\Examples\GUI\merlin.gif";"c:\a\rund.gif"

$pic = GUICreate("News", 625, 186, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
$pic_stay = GUICtrlCreatePic($sFile, 0, 0, 625, 186,-1, $GUI_WS_EX_PARENTDRAG)

$Zeile1="Das ist ein Test, Zeile1"
$Zeile2="Das ist ein Test, Zeile2"
$Zeile3="Das ist ein Test, Zeile3"
$Zeile4="Das ist ein Test, Zeile4"

$Group1 = GUICtrlCreateGroup("", 195, 40, 422, 137)
GUICtrlSetBkColor(-1, 0x004E98)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Label3 = GUICtrlCreateLabel($Zeile1 & @CRLF & $Zeile2 & @CRLF & $Zeile3 & @CRLF & $Zeile4 & @CRLF & @CRLF & "Für nähere Informationen bitte hier klicken", 200, 50, 400, 120)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
;GUICtrlSetColor(-1, 0x004e98)
GUICtrlSetColor(-1, 0xFFFFFF)

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)


while GUIGetMsg() <> $GUI_EVENT_CLOSE
;=============================================================================
$Window = WinGetState($pic)
If BitAND($Window, 8) Then
$CursorInfo = GUIGetCursorInfo($pic)
    If $CursorInfo[4] = $Label3 Then
        If $CursorInfo[0] > 200 and $CursorInfo[0] < 600 Then
            If  $CursorInfo[1] > 50 and $CursorInfo[1] < 70 Then
            ;If _IsPressed("01",$hDLL) Then
                ConsoleWrite('Label 1 - '&@MSEC&@CRLF)
            ;EndIf
        ElseIf  $CursorInfo[1] > 70 and $CursorInfo[1] < 90 Then
            ;If _IsPressed("01",$hDLL) Then
                ConsoleWrite('Label 2 - '&@MSEC&@CRLF)
            ;EndIf
        ElseIf  $CursorInfo[1] > 90 and $CursorInfo[1] < 110 Then
            ;If _IsPressed("01",$hDLL) Then
                ConsoleWrite('Label 3 - '&@MSEC&@CRLF)
            ;EndIf
        ElseIf  $CursorInfo[1] > 110 and $CursorInfo[1] < 130 Then
            ;If _IsPressed("01",$hDLL) Then
                ConsoleWrite('Label 4 - '&@MSEC&@CRLF)
            ;EndIf
        EndIf
        EndIf
    EndIf
EndIf
;=============================================================================
Sleep(100)
wend


Func Terminate()
    Exit 0
EndFunc

If you uncomment the _ispressed there is a problem, possibly because of the layered flag, when you click, the window unfocuses.

But i think you get the general idea.

PS: i think it would work better with 4 separate labels, and an X image, and using the code like i posted up there.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

working NOW - _ISPressed not working with "GUI_WS_EX_PARENTDRAG" so i deleted it from source

 

Bug ?

 

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

Local $hDLL = DllOpen("user32.dll")

AutoItSetOption ("MouseCoordMode",0)
HotKeySet("{ESC}", "Terminate")

Local $sFile = "c:\a\rund6.gif"

$pic = GUICreate("News", 625, 186, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
$pic_stay = GUICtrlCreatePic($sFile, 0, 0, 625, 186,-1)
;, $GUI_WS_EX_PARENTDRAG)

$Zeile1="Das ist ein Test, Zeile1"
$Zeile2="Das ist ein Test, Zeile2"
$Zeile3="Das ist ein Test, Zeile3"
$Zeile4="Das ist ein Test, Zeile4"

$Group1 = GUICtrlCreateGroup("", 195, 40, 422, 137)
GUICtrlSetBkColor(-1, 0x004E98)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Label3 = GUICtrlCreateLabel($Zeile1 & @CRLF & $Zeile2 & @CRLF & $Zeile3 & @CRLF & $Zeile4 & @CRLF & @CRLF & "Für nähere Informationen bitte hier klicken", 200, 50, 400, 130)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
;GUICtrlSetColor(-1, 0x004e98)
GUICtrlSetColor(-1, 0xFFFFFF)

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUISetState(@SW_SHOW)

While 1
    If _IsPressed('01') Then

        $apos = MouseGetPos()
        Consolewrite($apos[0] & " " & $apos[1] & @CRLF)
        if $aPos[0] > 595 and $aPos[0] < 620 and $aPos[1] > 1 and $aPos[1] < 40 then Exit 0 ;red X

    endif
    sleep (200)

wend


Func Terminate()
    Exit 0
EndFunc

 

Edited by memnon

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

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...