Jump to content

guiCreate problem help.


marcus_tong
 Share

Recommended Posts

hi, all.

I am new to autoit, but  I find it quite useful to my usual work.

recently, I create a form, and add some frequent web links to that form.

I convert that form to exe program, and set it "always on top" on my windows deskotp.

i want to add other functions.

1、when I click to form's close button, it will not exit but minimize to the system tray.

2、when I pull the form to the edge of the screen, it will auto hide, when the mouse move to that edge, it can display.

3、when I click system tray icon of that form, it will show me the "exit" but no “Script paused“ menu.

4、finally, i want to add function like windows explorer, but how to make the "arrow" or "cross".

Attachment is the code, and the screenshot.

 

hopeFunction.jpg

WindowsExplore.jpg

FormScreenShot.jpg

SystemTrayMenu.jpg

TestFavrioutWeblink.au3

Link to comment
Share on other sites

Lucky i had a script with similar requirements already written, so i could copy&paste few lines into it:

#include <TrayConstants.au3>
#include <GUIConstantsEx.au3>
#include "GUIHyperLink.au3"
#include <WindowsConstants.au3>
Opt("TrayIconHide", 0)
Opt("TrayMenuMode", 11)
Opt("TrayOnEventMode", 0)
Opt("TrayAutoPause",0)
$hGUI = GUICreate("Access2Web", 200, 250, -1, -1, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)
$tLable = GUICtrlCreateLabel("Access2Web", 10, 10, 60, 15)
WinSetOnTop($hGUI, "", 1)
Global $GUIVISIBLE = 1 ;Set the initial state of the gui

Global $idExit = TrayCreateItem("Exit")
TraySetClick(16)

$SingleClickOpen = 1 ; Set to 1 to open the gui with 1 click on the tray, 0 for doubleclick

If $SingleClickOpen = 0 Then
    $TRAYCLICK = $TRAY_EVENT_PRIMARYDOUBLE
Else
    $TRAYCLICK = $TRAY_EVENT_PRIMARYUP
EndIf

$nAutoItScript_Com_HyperLink = _GUICtrlHyperLink_Create("Google", 25, 35, 155, 15, 0x0000FF, 0x551A8B, _
         -1, 'www.google.com', 'Visit: www.google.com', $hGUI)
$nAutoItScript_Com_HyperLink = _GUICtrlHyperLink_Create("Google1", 25, 65, 155, 15, 0x0000FF, 0x551A8B, _
         -1, 'www.google.com', 'Visit: www.google.com', $hGUI)



GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ;ConsoleWrite("test" & @CRLF) ;debug info
            GUISetState(@SW_HIDE, $hGUI)
    EndSwitch

    Switch TrayGetMsg()
        Case $idExit
            Exit
        Case $TRAYCLICK
            If $GUIVISIBLE = 0 Then
                GUISetState(@SW_SHOW, $hGUI)
                $GUIVISIBLE = 1
            Else
                GUISetState(@SW_HIDE, $hGUI)
                $GUIVISIBLE = 0
            EndIf
    EndSwitch
WEnd

Func _CreatoRLab_ShowInfo($nCtrlID, $h_GUI)
    MsgBox(64, 'Info', 'HyperLink Clicked:' & @CRLF & GUICtrlRead($nCtrlID), 0, $h_GUI)
EndFunc   ;==>_CreatoRLab_ShowInfo

Solved are your 
1.You can single click (changeable to doubleclick) the icon in the tray to open/hide the window.
3. You can click on close to hide the window.

I do not know what you want to do with the 4.

Edited by Dan_555
commented out a debug info line

Some of my script sourcecode

Link to comment
Share on other sites

  • 2 weeks later...

Here is what i do, first, when i do not know of a command (well, actually, auto it has so many commands that i must not know them all, just have to know where to read about it !)


Open the autoit-scite editor, paste the line and save it as test.au3

Then place the cursor right before the GuiCtrlCreateTreeView and press f1.

A help file will open. Scroll down, there will be an example file. Click on open this script. It will open in your scite editor and you can  test it.

Some of my script sourcecode

Link to comment
Share on other sites

On 2/1/2023 at 11:30 PM, Dan_555 said:

Here is what i do, first, when i do not know of a command (well, actually, auto it has so many commands that i must not know them all, just have to know where to read about it !)


Open the autoit-scite editor, paste the line and save it as test.au3

Then place the cursor right before the GuiCtrlCreateTreeView and press f1.

A help file will open. Scroll down, there will be an example file. Click on open this script. It will open in your scite editor and you can  test it.

hi, Dan_555, acording to the page,i tried to write the code, there is quite a lot of command and syntax i do not understand, but efficiently solve my 4 problem.

when i click google, it will execute ShellExecute("google.com").

it is perfect.

 

 

pic4.jpg

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