Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[SOLVED] sendMessage() is not working

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Thu May 07, 2020 1:31 pm    Post subject: [SOLVED] sendMessage() is not working Reply with quote

so I have been searching for too much tie on how to use sendMessage() and what I found is this
Code:
local hWndWordPad = findWindow('Notepad');
local hWndChild = getWindow(hWndWordPad, 5); -- Get the child edit control..
sendMessage(hWndChild, 0x0100, 0x48, 0); -- Send WM_KEYDOWN
sendMessage(hWndChild, 0x0101, 0x48, 0); -- Send WM_KEYUP
sendMessage(hWndChild, 0x0102, 0x48, 0);
 
then i tried
Code:
local hWndWordPad = findWindow('WordPadClass');
local hWndChild = getWindow(hWndWordPad, 5); -- Get the child edit control..
sendMessage(hWndChild, 0x0100, 0x48, 0); -- Send WM_KEYDOWN
sendMessage(hWndChild, 0x0101, 0x48, 0); -- Send WM_KEYUP
sendMessage(hWndChild, 0x0102, 0x48, 0);
but unfortunatly it did not work I dont know why so I wanted to ask for your help and can you give me one more example about it??? I hope you will hep me out Smile
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink


Last edited by Oxijen on Sun May 10, 2020 5:42 am; edited 1 time in total
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu May 07, 2020 5:05 pm    Post subject: Reply with quote

What you trying to do with Notepad window?
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Fri May 08, 2020 7:14 am    Post subject: Reply with quote

I am not really trying to do anything with Notepad it was just for test. I was testing a code I found in a cheat engine post, so I tried using it and it worked fine with Notepad but then I tried using it on another app. But unfortunately, I made a mistake that I don't recognize.
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri May 08, 2020 8:13 am    Post subject: Reply with quote

I ask because of your code:

Code:
local hWndChild = getWindow(hWndWordPad, 5); -- Get the child edit control..
sendMessage(hWndChild, 0x0100, 0x48, 0); -- Send WM_KEYDOWN
sendMessage(hWndChild, 0x0101, 0x48, 0); -- Send WM_KEYUP


Mean, set to notepad window and click on the Notepad Edit menu and click 'Find' or 'Paste' while nothing to find or paste to the Notepad window. And what is 0x48 for?. Is it letter 'H' code or is WM_POWER = 0x48 code?.

Anyhow, see this:

https://forum.cheatengine.org/viewtopic.php?t=613870

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Fri May 08, 2020 3:50 pm    Post subject: Reply with quote

Quote:
Mean, set to notepad window and click on the Notepad Edit menu and click 'Find' or 'Paste' while nothing to find or paste to the Notepad window. And what is 0x48 for?. Is it letter 'H' code or is WM_POWER = 0x48 code?.

It is the letter 'H'.
And talking about the link :
Quote:
forum.cheatengine.org/viewtopic.php?t=613870

I liked this code
Code:
-- test open note File Menu
ps1 = 'start notepad.exe'
p1 = os.execute(ps1)
sleep(1000)
openProcess('notepad.exe')
w=getWindow(getForegroundWindow(), GW_HWNDFIRST)
pid=getOpenedProcessID()

while w and (w~=0) do
 if (getWindowProcessID(w)==pid) and (executeCodeLocal("IsWindowVisible",w)~=0) then
    keyDown(VK_MENU)
    keyDown(VK_F)
    sleep(100)
    keyUp(VK_MENU)
    keyUp(VK_F)
 end
 w=getWindow(w, GW_HWNDNEXT)
end

but the problem is that it is not for a background window or inactive window so I can't really use my computer while it is running and about the
Code:
function FindWindowN(lpClassName, lpWindowName)
 return executeCodeLocalEx("user32.FindWindowA", lpClassName, lpWindowName)
end

function PostMessage(hWnd, Msg, wParam, lParam )
 return executeCodeLocalEx("user32.PostMessageA", hWnd, Msg, wParam, lParam)
end

function test()
 local iHwnd = FindWindowN("notepad", 0)
 PostMessage(iHwnd, 0x0111, 0x0005, 0x0)   -- Will open submenu Page Setup in notepad app.
    -- 0x0111 = notepad menu 'File'
    -- 0x0005 = notepad sub-menu File -> Page Setup
end

test()
my problem is in
Code:
FindWindow()
I don't know how to use it, I don't know what to put in it, I wanted another example other than notepad. I know that I need to put in it class, etc... but I tried on notepad++ and it did not work and also I tried on my game but still. O_O
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Sat May 09, 2020 10:58 am    Post subject: Reply with quote

and I also tried this a code from XEOME youtube channel
Code:
local W_LBUTTONDOWN = 0x0201
local W_LBUTTONUP = 0x0202
local W_RBUTTONDOWN = 0x0204
local W_RBUTTONUP = 0x0205



function SendMessageA(hwnd, wMsg, wParam, LParam)
    return executeCodeLocalEx("user32.SendMessageA", hwnd, wMsg, wParam, lParam)
end

function FindWindowA(lpClassName, lpWindowName)
    return executeCodeLocalEx("user32.SendMessageA", hwnd, wMsg, wParam, lParam)
end


function FindWindowExA(hWnd1, hWnd2, lpsz1, lpsz2)
    return executeCodeLocalEx("user32.SendMessageA", hWnd1, hWnd2, lpsz1, lpsz2)
end

function makelparam(x, y)
    return (y << 16) | (x & 0xFFFF)
end

local iHwnd = FindWindowA("Pixel Worlds", 0)
local iHwndChild = FindWindowExA(iHwnd, 0, "AppClass", 0)
SendMessageA(iHwndChild, W_LBUTTONDOWN, 1, makelparam(400, 100))
sleep(100)
SendMessageA(iHwndChild, W_LBUTTOUP, 0, makelparam(400, 100))

but it didnt really seem to work i change FROM
Code:
local iHwnd = FindWindowA("Growtopia", 0)
TO
Code:
local iHwnd = FindWindowA("Pixel Worlds", 0)
but still it gives no effect Sad
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat May 09, 2020 2:59 pm    Post subject: Reply with quote

DEMON_BOUNTY wrote:
and I also tried this a code from XEOME youtube channel....

function SendMessageA(hwnd, wMsg, wParam, LParam)
return executeCodeLocalEx("user32.SendMessageA", hwnd, wMsg, wParam, lParam)
end

function FindWindowA(lpClassName, lpWindowName)
return executeCodeLocalEx("user32.SendMessageA", hwnd, wMsg, wParam, lParam)
end


function FindWindowExA(hWnd1, hWnd2, lpsz1, lpsz2)
return executeCodeLocalEx("user32.SendMessageA", hWnd1, hWnd2, lpsz1, lpsz2)
end


....but still it gives no effect Sad



Be careful with copy-paste, check again your script. Three functions above contain the same instructions:

Code:

return executeCodeLocalEx("user32.SendMessageA", hwnd, wMsg, wParam, lParam)


I can't test your code because I am not play Growtophia and also I think Growtophia is a online game. This forum not support for online game.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Sat May 09, 2020 7:47 pm    Post subject: Reply with quote

Quote:
function SendMessageA(hwnd, wMsg, wParam, LParam)
return executeCodeLocalEx("user32.SendMessageA", hwnd, wMsg, wParam, lParam)
end

As i see i changed
Code:
LParam
to
Code:
lParam

Or maybe it dont really matter 😤😥

_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat May 09, 2020 7:58 pm    Post subject: Reply with quote

Oh really?. What I mean to check again your script is here (see the attached picture).

You are even not read your own script carefully Razz



Capture.JPG
 Description:
 Filesize:  97.32 KB
 Viewed:  5317 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Sun May 10, 2020 5:22 am    Post subject: Reply with quote

Oh Embarassed . Sorry, I am sooooo dumb i did not notice that there is 3 functions with SendMessageA. I wanted to not waste time writting. And now i discovered I just wasted my time😅😅😅. Thank you for helping me 😀
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites