Sign in to follow this  
Followers 0
sd333221

Change window title in a compiled program?

13 posts in this topic

Is there a way to change f.ex.

the windowtitle of "Battlefield 2"

to "Bimboshield 2", in a compiled program?

I don't want a script with changes it manually.

I want to change the .exe itself...

Thank you

Share this post


Link to post
Share on other sites



I am using this atm:

Posted Image

Share this post


Link to post
Share on other sites

only way i know is to put it in a wrapper exe file

; Compile this to a new exe

; place program into the exe
$Program_1 = @TempDir & "\Temp.exe"
FileInstall("C:\Program Files\?FOLDER?\?NAME?.exe", $Program_1)

Run($Program_1)
WinWaitActive("")
WinSetTitle("?OLD TITLE?","", "?NEW TITLE?")

thats it

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

This wont work,

the program changes/refreshes

it's title over time :P

Hexing the program doesnt work.

Share this post


Link to post
Share on other sites

Try to refresh your changed titlebar too then and see if it works. If it doesn't, it doesn't.

Share this post


Link to post
Share on other sites

Hexing the program doesnt work.

So why not just run something that makes sure it's changed constantly with a 10 millesecond time delay using WinSetTitle()?

I mean, If you used a hexing method, and the program constantly checks to make sure it still has it's title intact, and if it doesn't... it changes it back... after you did the hexing... what makes you think without dissasembling it you'd be able to do it without using a constant loop?

$ApplicationTitle = 'Blah Blah Cookies'
While 1
    If WinExists($ApplicationTitle) Then WinSetTitle($ApplicationTitle, '', 'Ice Cream Is Better!')
    Sleep(10)
Wend

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Try to refresh your changed titlebar too then and see if it works. If it doesn't, it doesn't.

Yes, i already thought of that, but it makes cpu usage 60%, on an 1gb ram computer :P

Share this post


Link to post
Share on other sites

CPU and RAM are entirely different things. :P

You have not provided any code so a perfect solution cannot be offered. Perhaps this will be close:

Opt('WinWaitDelay', 0)

While 1
    WinWait('Battlefield 2')
    WinSetTitle('Battlefield 2', '', 'Bimboshield 2')
WEnd

Share this post


Link to post
Share on other sites

Perhaps this will be better again:

Opt('WinTitleMatchMode', 2)
Opt('WinWaitDelay', 0)

Local $PartTitle = 'Battlefield 2'

While 1
    WinWait($PartTitle)
    Local $FullTitle = WinGetTitle($PartTitle)
    Local $NewTitle = StringReplace($FullTitle, 'Battlefield', 'Bimboshield')
    WinSetTitle($FullTitle, '', $NewTitle)
WEnd

Share this post


Link to post
Share on other sites

Blah@WinWait() , I always skip over that option... nice catch :P


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Yes, i already thought of that, but it makes cpu usage 60%, on an 1gb ram computer :P

Yes but if you think a little more over it, you will understand that this has to do with time - and nothing more. Try not to query your CPU every 1ms. There are a lot of ways to do this. :lmao:

P.S. Provide some code if you want to help you more please.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

;Changes the title of a program of your choice.

CODE#include <GuiConstants.au3>
HotKeySet("{ESC}", "Terminate")
Opt("OnExitFunc", "_ScriptClose")


$hWnd = WinGetHandle("Windows Media Player");Name of the programs' title

            
    
while 1
WinSetTitle($hWnd, "", Random(100, 10000, 1))
sleep(10000)
WEnd

Func Terminate()
WinSetTitle($hWnd, "", "Windows Media Player")   
    Exit 
EndFunc

Func _ScriptClose()
    WinSetTitle($hWnd, "", "Windows Media Player")   
    Exit 
EndFunc

;Changes your script title
CODE#include <GuiConstants.au3>
#NoTrayIcon
HotKeySet("{ESC}", "Terminate")

Opt("GUICloseOnESC", 0)
Opt("OnExitFunc", "_ScriptClose")
Opt("GuiOnEventMode", 1)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$hWnd = WinGetHandle("MSN");Name of the programs' title

; Script title, random title changer

$gui = GUICreate(Random(100, 10000, 1), 135, 60, (@DesktopWidth-135)/2, (@DesktopHeight-75)/2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS - $WS_MAXIMIZEBOX - $WS_SIZEBOX)
GUISetOnEvent($GUI_EVENT_CLOSE, "_ScriptClose")

GUISetState()

$timer = TimerInit()

;title changes every 10 seconds (>=10000)
While WinExists($hWnd)
    If TimerDiff($timer) >= 10000 Then
        WinSetTitle($gui, "", Random(100, 10000, 1))
        $timer = TimerInit()
    EndIf
    
    If Not WinActive($hWnd) Then
        Sleep(100)
    EndIf
    
    
    Sleep(10)
WEnd


MsgBox(64, WinGetTitle($gui), "Program will now terminate.", 15)
_ScriptClose()


;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func _ScriptClose()
    Exit 0
EndFunc


Func Terminate()
    Exit 
EndFunc
Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0