|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sun Apr 24, 2022 4:20 am Post subject: use setWindowPos in LUA |
|
|
hi there!!
Please excuse for boring, but I have try in many,many way.....
I have this ahk script with the follows:
Code: | Result := DllCall("SetWindowPos", "uint", id, "uint", HWND_TOP, "Int", 0, "Int", 0, "Int", width, "Int", height, "UInt", 0x400) |
May you help to convert it in LUA?
Thanks!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Apr 24, 2022 5:41 am Post subject: |
|
|
Code: |
HWND_TOP=0
HWND_TOPMOST=-1
HWND_NOTOPMOST=-2
HWND_BOTTOM=1
--flags
SWP_NOSIZE =0x0001
SWP_NOMOVE =0x0002
SWP_NOZORDER =0x0004
SWP_NOREDRAW =0x0008
SWP_NOACTIVATE =0x0010
SWP_DRAWFRAME =0x0020
SWP_FRAMECHANGES =0x0020
SWP_SHOWWINDOW =0x0040
SWP_HIDEWINDOW =0x0080
SWP_NOCOPYBITS =0x0100
SWP_NOOWNERZORDER =0x0200
SWP_NOREPOSITION =0x0200
SWP_NOSENDCHANGING=0x0400
SWP_DEFERERASE =0x2000
SWP_ASYNCWINDOWPOS=0x4000
function SetWindowPos(hWnd, hWndInsertAfter, X, Y, cx, cy,uFlags)
return executeCodeLocalEx("SetWindowPos", hWnd, hWndInsertAfter, X,Y,cx,cy,uFlags)
end
|
and then use it like
Code: |
SetWindowPos(MainForm.Handle,HWND_TOPMOST,0,0,200,200,SWP_NOSENDCHANGING)
|
_________________
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 |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Apr 24, 2022 5:57 am Post subject: |
|
|
Try this
Code: |
function setWindowPos(window, x, y, width, height, flags)
local handle = findWindow(nil, tostring(window))
if handle ~= nil then
return executeCodeLocalEx('User32.SetWindowPos', handle, 0, x, y, width, height, flags)
else
print('No window found')
return nil
end
end
setWindowPos('window_name', 0, 0, width, height, 0x400)
|
Edit: DB beat me to it haha. Nice
|
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sun Apr 24, 2022 6:11 am Post subject: |
|
|
Thanks @darkbyte,
your code is ok, it's only me that was not able in figuring the real problem....
My purpose is the follow:
I'm working on a script to "inside" CE is able pressing an hotkey to switch to the game who is actual open (and freezed) in CE, simulating alt-tab and mouse click, I have try SetForegroundWindow, but I only get the game it flashing in taskbar....
For reason specifically referred to a particular game, I may NOT use pause to freeze it, but i make use of speedhack=0.
My mistake: I believe that SetWindowPos maybe usefull, but it is NOT!!!
Code: |
[ENABLE]
{$Lua}
primavolta=true
--print "eseguito!!"
function toggleSpHack()
--print "siamo su function toggleSpHack"
if primavolta then
local mygame=getForegroundProcess()
gameHWND = getForegroundWindow() -- get the window handle
--print (gameHWND)
--Print "se il flag di attivazione si è disattivato ripetere l'operazione: attivare, andare su game e premere hotkey...."
openProcess(mygame)
speed = 1.0
primavolta=nil
end--end if primavolta
--come back to game
if speed == 0.0 then
speed = 1.0
speedhack_setSpeed(speed)
local t = createTimer()
t.Interval = 10
t.OnTimer = function(t)
if getForegroundProcess() ~= gameHWND then -- if game on top
executeCode('SetForegroundWindow',gameHWND)
t.destroy() -- stop now that we have the handle
end--if getForegroundProcess() ~= gameHWND
end--function local t = createTimer()
else
--goto CE
speed = 0.0
speedhack_setSpeed(speed)
sleep(300)
unhideMainCEwindow()
end--end if speed
end--end function togglespeedhack
if pauseHotkey~=nil then
pauseHotkey.destroy()
pauseHotkey=nil
end--end if pauseHotkey
pauseHotkey = createHotkey(toggleSpHack,VK_RSHIFT)
{$Asm}
//dimenticati del fatto che la casella non sia settata:
//funziona comunque!!
//{$Asm} {$ASM} pare non faccia differenze
[DISABLE]
{$Lua}
speedhack_setSpeed(1.0)
unpause ()
primavolta=nil
pauseHotkey.destroy()
object_destroy(t)
t = nil --//// to kill the timer as we want
--print "disabled*********"
{$Asm} |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|