| View previous topic :: View next topic |
| Author |
Message |
Antoshick Advanced Cheater
Reputation: 0
Joined: 02 Nov 2018 Posts: 56
|
Posted: Thu Jan 16, 2020 8:35 am Post subject: SetForegroundWindow for trainer form |
|
|
I want to make a hotkey for the set trainer form as SetForegroundWindow.
Because the game always captures the cursor, so this option in the trainer will be useful
But as i found in myself, CE exe trainer won't use SetForegroundWindow for his form, only another windows, like games, notepad. etc.
I tried using
| Code: | x=findWindow(nil,'UDF1')
executeCodeLocal('SetForegroundWindow',x) |
also
| Code: | w=getWindow(getForegroundWindow(), GW_HWNDFIRST)
pid=getOpenedProcessID()
game_window_handle = 0
while w and (w~=0) do
if getWindowProcessID(w)==pid then
game_window_handle = w
end
w=getWindow(w,GW_HWNDNEXT)
end
executeCodeLocal('SetForegroundWindow',game_window_handle )
|
Nothing works
Maybe CE have default option for make his for as SetForegroundWindow?
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Jan 16, 2020 9:36 am Post subject: |
|
|
Maybe (not tested):
| Code: | function getAttachedProcessName()
local m = enumModules();
if (#m > 0) then
return m[1].Name;
end
return nil;
end
local game = 'solitaire.exe'
function ActivateApp(p)
p = getAttachedProcessName()
-- print(p)
if p ~= game or p == nil then
showMessage('No process opened')
return nil
else
--executeCodeLocal('LockSetForegroundWindow',p[0])
x=findWindow(nil,'UDF1')
executeCodeLocalEx('LockSetForegroundWindow',x)
end
end
-- example
UDF1.show()
ActivateApp('solitaire.exe') |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Antoshick Advanced Cheater
Reputation: 0
Joined: 02 Nov 2018 Posts: 56
|
Posted: Thu Jan 16, 2020 11:04 am Post subject: |
|
|
| Corroder wrote: | Maybe (not tested):
| Code: | function getAttachedProcessName()
local m = enumModules();
if (#m > 0) then
return m[1].Name;
end
return nil;
end
local game = 'solitaire.exe'
function ActivateApp(p)
p = getAttachedProcessName()
-- print(p)
if p ~= game or p == nil then
showMessage('No process opened')
return nil
else
--executeCodeLocal('LockSetForegroundWindow',p[0])
x=findWindow(nil,'UDF1')
executeCodeLocalEx('LockSetForegroundWindow',x)
end
end
-- example
UDF1.show()
ActivateApp('solitaire.exe') |
|
Does not work. I put it script on a timer (3 sec) and generate an exe, and run this exe. But the form is still in the background.
Also i tried simple
| Code: | x=findWindow(nil,'UDF1')
executeCodeLocal('SetForegroundWindow',x) |
in a timer on exe trainer, too doesn't work.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Thu Jan 16, 2020 11:27 am Post subject: |
|
|
try
| Code: |
UDF1.bringToFront()
|
or try
| Code: |
UDF1.FormStyle='fsSystemStayOnTop'
|
also, UDF1.Handle gets you the handle, no need to findWindow
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Antoshick Advanced Cheater
Reputation: 0
Joined: 02 Nov 2018 Posts: 56
|
Posted: Thu Jan 16, 2020 11:59 am Post subject: |
|
|
| Dark Byte wrote: | try
| Code: |
UDF1.bringToFront()
|
or try
| Code: |
UDF1.FormStyle='fsSystemStayOnTop'
|
also, UDF1.Handle gets you the handle, no need to findWindow |
From this all works only
| Code: |
function UDF1_CETimer1Timer(sender)
UDF1.FormStyle='fsSystemStayOnTop'
end
|
But the focus is still on the game window and the mouse cursor is still captured
I thought SetForegroundWindow would switch to the trainer form and make a free cursor, but it not work for me.
***********************************************************
Just tested on CE 6.8.3 this script
| Code: | x=findWindow(nil,'UDF1')
executeCodeLocalEx('LockSetForegroundWindow',x) |
Works perfectly and the effect is as from
| Code: |
UDF1.FormStyle='fsSystemStayOnTop'
|
But focus and cursor still on game window.
Is this a normal effect? Maybe the game shouldn't make the cursor free.
|
|
| Back to top |
|
 |
|