| View previous topic :: View next topic |
| Author |
Message |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Aug 15, 2008 12:03 am Post subject: |
|
|
what's that BOOL doing there... also you already fixed the unicode error.
Like I said you have to do FindWindowEx. _________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Aug 15, 2008 12:04 am Post subject: |
|
|
Project -> Project Settings -> General -> Character set - Change to "Multi-Byte Character Set" _________________
|
|
| Back to top |
|
 |
Negima I post too much
Reputation: 6
Joined: 22 May 2007 Posts: 2221
|
Posted: Fri Aug 15, 2008 12:07 am Post subject: |
|
|
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 |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Fri Aug 15, 2008 12:11 am Post subject: |
|
|
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
or change the settings to multi-byte. Don't do both. |
|
| Back to top |
|
 |
Negima I post too much
Reputation: 6
Joined: 22 May 2007 Posts: 2221
|
Posted: Fri Aug 15, 2008 12:30 am Post subject: |
|
|
| 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
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 |
|
 |
Renkokuken GO Moderator
Reputation: 4
Joined: 22 Oct 2006 Posts: 3249
|
Posted: Fri Aug 15, 2008 12:32 am Post subject: |
|
|
| VK_ENTER doesn't exist. You're looking for VK_RETURN. |
|
| Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Fri Aug 15, 2008 12:32 am Post subject: |
|
|
Sorry.
It's VK_RETURN |
|
| Back to top |
|
 |
Negima I post too much
Reputation: 6
Joined: 22 May 2007 Posts: 2221
|
Posted: Fri Aug 15, 2008 12:37 am Post subject: |
|
|
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 |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Fri Aug 15, 2008 12:51 am Post subject: |
|
|
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 |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Fri Aug 15, 2008 12:51 am Post subject: |
|
|
It compiled correctly for me. Probably your compiler settings...
EDIT - Are you compiling as 'C'? |
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Fri Aug 15, 2008 12:57 am Post subject: |
|
|
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 |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Fri Aug 15, 2008 1:00 am Post subject: |
|
|
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 |
|
 |
Negima I post too much
Reputation: 6
Joined: 22 May 2007 Posts: 2221
|
Posted: Fri Aug 15, 2008 1:22 am Post subject: |
|
|
| 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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Aug 15, 2008 4:51 am Post subject: |
|
|
| 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 |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Fri Aug 15, 2008 6:35 am Post subject: |
|
|
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 |
|
 |
|