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 


Post Message not working
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Fri Aug 15, 2008 12:03 am    Post subject: Reply with quote

what's that BOOL doing there... also you already fixed the unicode error.
Like I said you have to do FindWindowEx.

_________________
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Fri Aug 15, 2008 12:04 am    Post subject: Reply with quote

Project -> Project Settings -> General -> Character set - Change to "Multi-Byte Character Set"
_________________
Back to top
View user's profile Send private message
Negima
I post too much
Reputation: 6

Joined: 22 May 2007
Posts: 2221

PostPosted: Fri Aug 15, 2008 12:07 am    Post subject: Reply with quote

WTF, I added the L and that now I get this...

Code:
#include <iostream>
#include <windows.h>

int main()
{
   HWND hNotepad=FindWindow(NULL, L"Notepad");
   PostMessage( hNotepad, WM_KEYDOWN, 0, WM_KEYUP );
   system("pause"); //dont flame plz
   return 0;
}


Code:
------ Build started: Project: NegiBot, Configuration: Debug Win32 ------
Compiling...
NegiBot.cpp
Linking...
NegiBot.obj : error LNK2028: unresolved token (0A000279) "extern "C" int __stdcall PostMessageW(struct HWND__ *,unsigned int,unsigned int,long)" (?PostMessageW@@$$J216YGHPAUHWND__@@IIJ@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
NegiBot.obj : error LNK2028: unresolved token (0A000286) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
NegiBot.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall PostMessageW(struct HWND__ *,unsigned int,unsigned int,long)" (?PostMessageW@@$$J216YGHPAUHWND__@@IIJ@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
NegiBot.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
C:\Users\Joseph\Documents\Visual Studio 2008\Projects\NegiBot\Debug\NegiBot.exe : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://c:\Users\Joseph\Documents\Visual Studio 2008\Projects\NegiBot\NegiBot\Debug\BuildLog.htm"
NegiBot - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Back to top
View user's profile Send private message Visit poster's website
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Fri Aug 15, 2008 12:11 am    Post subject: Reply with quote

PostMessage( hNotepad, WM_KEYDOWN, 0, WM_KEYUP );

This don't make no sense.

PostMessage( hNotepad, WM_KEYDOWN, VK_ENTER, 0 );

also, you EITHER put L in front of notepad
Code:

L"Notepad"


or change the settings to multi-byte. Don't do both.
Back to top
View user's profile Send private message
Negima
I post too much
Reputation: 6

Joined: 22 May 2007
Posts: 2221

PostPosted: Fri Aug 15, 2008 12:30 am    Post subject: Reply with quote

Zand wrote:
PostMessage( hNotepad, WM_KEYDOWN, 0, WM_KEYUP );

This don't make no sense.

PostMessage( hNotepad, WM_KEYDOWN, VK_ENTER, 0 );

also, you EITHER put L in front of notepad
Code:

L"Notepad"


or change the settings to multi-byte. Don't do both.
Didn't fix it...

Code:
------ Build started: Project: NegiBot, Configuration: Debug Win32 ------
Compiling...
NegiBot.cpp
.\NegiBot.cpp(7) : error C2065: 'VK_ENTER' : undeclared identifier
Build log was saved at "file://c:\Users\Joseph\Documents\Visual Studio 2008\Projects\NegiBot\NegiBot\Debug\BuildLog.htm"
NegiBot - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Back to top
View user's profile Send private message Visit poster's website
Renkokuken
GO Moderator
Reputation: 4

Joined: 22 Oct 2006
Posts: 3249

PostPosted: Fri Aug 15, 2008 12:32 am    Post subject: Reply with quote

VK_ENTER doesn't exist. You're looking for VK_RETURN.
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Fri Aug 15, 2008 12:32 am    Post subject: Reply with quote

Sorry. Rolling Eyes

It's VK_RETURN
Back to top
View user's profile Send private message
Negima
I post too much
Reputation: 6

Joined: 22 May 2007
Posts: 2221

PostPosted: Fri Aug 15, 2008 12:37 am    Post subject: Reply with quote

Same error as before..

Code:
#include <iostream>
#include <windows.h>

int main()
{
   HWND hNotepad=FindWindow(NULL, "Notepad");
    PostMessage( hNotepad, WM_KEYDOWN, VK_RETURN, 0 );
   system("pause"); //dont flame plz
   return 0;
}


Code:
------ Build started: Project: NegiBot, Configuration: Debug Win32 ------
Compiling...
NegiBot.cpp
Linking...
NegiBot.obj : error LNK2028: unresolved token (0A0002C7) "extern "C" int __stdcall PostMessageA(struct HWND__ *,unsigned int,unsigned int,long)" (?PostMessageA@@$$J216YGHPAUHWND__@@IIJ@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
NegiBot.obj : error LNK2028: unresolved token (0A0002DA) "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
NegiBot.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall PostMessageA(struct HWND__ *,unsigned int,unsigned int,long)" (?PostMessageA@@$$J216YGHPAUHWND__@@IIJ@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
NegiBot.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
C:\Users\Joseph\Documents\Visual Studio 2008\Projects\NegiBot\Debug\NegiBot.exe : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://c:\Users\Joseph\Documents\Visual Studio 2008\Projects\NegiBot\NegiBot\Debug\BuildLog.htm"
NegiBot - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Back to top
View user's profile Send private message Visit poster's website
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Fri Aug 15, 2008 12:51 am    Post subject: Reply with quote

replace
PostMessage( hNotepad, WM_KEYDOWN, VK_RETURN, 0 );
with
PostMessage( hNotepad, WM_KEYDOWN, (LPARAM)VK_RETURN, (WPARAM)0 );


Last edited by pkedpker on Fri Aug 15, 2008 12:53 am; edited 1 time in total
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Fri Aug 15, 2008 12:51 am    Post subject: Reply with quote

It compiled correctly for me. Probably your compiler settings...

EDIT - Are you compiling as 'C'?
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Fri Aug 15, 2008 12:57 am    Post subject: Reply with quote

ya Zand is right its a settings problem!

http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/9e3beb3c-a332-452f-bfbb-a735d3101950/


I recommand you use Visual C++ 6.0 its much better then Visual Studio 2008 or whatever that compiles to CRL aka .NET framework crap!! i know it has option to go into native mode and make real assembly but it doesn't even have a nice dialog editor! and never had problems with Visual C++ 6.0 I can't post you link cuz i'll get banned for warez like I did last time trying to help people.. but search around you will find it.
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Fri Aug 15, 2008 1:00 am    Post subject: Reply with quote

VS2008 is fine. Just somehow your settings ...

Ok try this

Project | Properties | Linker | Input | Additional Dependencies. Add
user32.lib to the list.

OR

add this

#pragma comment(lib, "User32.lib")
Back to top
View user's profile Send private message
Negima
I post too much
Reputation: 6

Joined: 22 May 2007
Posts: 2221

PostPosted: Fri Aug 15, 2008 1:22 am    Post subject: Reply with quote

Zand wrote:
VS2008 is fine. Just somehow your settings ...

Ok try this

Project | Properties | Linker | Input | Additional Dependencies. Add
user32.lib to the list.

OR

add this

#pragma comment(lib, "User32.lib")
first one worked, thanks a ton man!
Back to top
View user's profile Send private message Visit poster's website
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Fri Aug 15, 2008 4:51 am    Post subject: Reply with quote

Sending clicks to Notepad will require you to get hWnd to the child window using FindWindowEx as Sponge has already said multiple times. The actual clicking won't work until then.
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Fri Aug 15, 2008 6:35 am    Post subject: Reply with quote

Why would you want to send clicks to notepad anyway?

Last edited by Zand on Fri Aug 15, 2008 6:41 am; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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