Jump to content

Recommended Posts

Posted (edited)

In Delphi it's done by

Application.Title := 'Something';

I need this for my Autoit GUI application which will be running with it's GUI at background or minimized

and I want to have in application title on taskbar icon for that app some quick read informations.

Please point me to some related API functions/structures so I could make it.

I don't know where to start and search on forum didn't help me too.

post-6483-1181258185_thumb.png

Edited by Zedna
Posted

In Delphi it's done by

Application.Title := 'Something';

I need this for my Autoit GUI application which will be running with it's GUI at background or minimized

and I want to have in application title on taskbar icon for that app some quick read informations.

Please point me to some related API functions/structures so I could make it.

I don't know where to start and search on forum didn't help me too.

Delphi creates a hidden form (TApplication) that contains the application title. The program's main form contains the caption that you see when the app is running. To see this, create a new app and set Application.Title to 'Something' right before Application.Run. Leave the default form caption set to 'TForm1'. Run the application and then run WinSight. You'll see that there is an invisible TApplication instance running with a title of 'Something' and a visible TForm1 instance that is running with a caption of 'TForm1'.

Just one of the wonders of Delphi. :)

Auto3Lib: A library of over 1200 functions for AutoIt
Posted

Delphi creates a hidden form (TApplication) that contains the application title. The program's main form contains the caption that you see when the app is running. To see this, create a new app and set Application.Title to 'Something' right before Application.Run. Leave the default form caption set to 'TForm1'. Run the application and then run WinSight. You'll see that there is an invisible TApplication instance running with a title of 'Something' and a visible TForm1 instance that is running with a caption of 'TForm1'.

Just one of the wonders of Delphi. :)

I know about that "hidden" Delphi's window (with size 0,0) which represent Application. There are also scripts to visualise it (set visible and some bigger size). So is it something like this possible also in Autoit?

Posted

I know about that "hidden" Delphi's window (with size 0,0) which represent Application. There are also scripts to visualise it (set visible and some bigger size). So is it something like this possible also in Autoit?

You'd have to create an "application" window that's hidden all the time and then create another "form" window that has the application window as it's parent. I'm guessing you could do the same thing in AutoIt, but it sounds like a lot of work to replicate one Delphi feature. :)
Auto3Lib: A library of over 1200 functions for AutoIt
Posted

You'd have to create an "application" window that's hidden all the time and then create another "form" window that has the application window as it's parent. I'm guessing you could do the same thing in AutoIt, but it sounds like a lot of work to replicate one Delphi feature. :)

After kjactive post I did think about exactly the same.

I will try it. I wonder if I must also synchronize all minimize/restore/... events between these two windows.

I will post here some test scripts later...

Thanks all for suggestions.

Posted (edited)

Here is what I did. It really has visual bugs with minimize/restore as I expected.

I did some workarounds so result is quite good.

Note: I must make hidden window at least 1x1 pixel

because with 0x0 pixel it will not be on the taskbar.

Also in WM_MOVE event I couldn't get position from wParam so I used WinGetPos()

#NoTrayIcon
#include <GUIConstants.au3>
#include <Misc.au3>

Global Const $WM_SYSCOMMAND = 0x0112
Global Const $SC_MINIMIZE = 0xF020
Global Const $SC_RESTORE = 0xF120
Global Const $WM_MOVE = 0x3
;~ Global Const $WM_SIZE = 0x05

$app = GUICreate("Application title", 1, 1,-1,-1,$WS_POPUP)
GUISetState(@SW_SHOW, $app)
$gui = GUICreate("Form title", 300, 200, -1, -1, -1, -1, $app)
GUISetState(@SW_SHOW, $gui)

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")
GUIRegisterMsg($WM_MOVE, "WM_MOVE")

Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
    Switch $wParam
        Case $SC_MINIMIZE
            _SendMessage($app, $WM_SYSCOMMAND, $SC_MINIMIZE, 0)
            GUISetState(@SW_HIDE, $gui)
            Return 0
        Case $SC_RESTORE
            _SendMessage($app, $WM_SYSCOMMAND, $SC_RESTORE, 0)
            GUISetState(@SW_SHOW, $gui)
            Return 0
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
;~  If $hWnd = $gui Then
        $pos = WinGetPos($gui)
        WinMove($app, '', $pos[0], $pos[1])
;~      ConsoleWrite('wparam:' & $wParam & ' x:' & $pos[0] & ' y:' & $pos[1] & @CRLF)
;~      WinMove($app, '', _LoWord($wParam), _HiWord($wParam))
;~      ConsoleWrite('wparam:' & $wParam & ' x:' & _LoWord($wParam) & ' y:' & _HiWord($wParam) & @CRLF)
;~  EndIf
    Return $GUI_RUNDEFMSG
EndFunc

Func _HiWord($x)
    Return BitShift($x, 16)
EndFunc

Func _LoWord($x)
    Return BitAND($x, 0xFFFF)
EndFunc
Edited by Zedna
  • 8 years later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...