Jump to content
Sign in to follow this  
Zedna

Make application title different from window title in my GUI

Recommended Posts

Zedna

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

Share this post


Link to post
Share on other sites
PaulIA

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

Share this post


Link to post
Share on other sites
Zedna

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?

Share this post


Link to post
Share on other sites
kjactive
PaulIA

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

Share this post


Link to post
Share on other sites
Zedna

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.

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
Balmukundam

Hii I'm new to this tool and wanting to run my vbscript file without Doing any changing is it possible ? if not then please suggest....

Share this post


Link to post
Share on other sites
AutoBert
  • Did you looked on last responce date?
  • Which tool?
  • Did you know: this is not a vbscript forum?
Edited by AutoBert

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
Sign in to follow this  

×