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 


C++ a little code help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
wizardolu
Newbie cheater
Reputation: 0

Joined: 01 Jun 2007
Posts: 23

PostPosted: Mon Sep 15, 2008 6:00 pm    Post subject: Reply with quote

thank you!!! testing now

hmm the errors are still there
Back to top
View user's profile Send private message
BirdsEye
Advanced Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 94

PostPosted: Mon Sep 15, 2008 6:24 pm    Post subject: Reply with quote

This should compile fine under unicode.
Are you sure you are compiling as a Win32 console application?

Code:

// fcvx.cpp : main project file.

#include "stdafx.h"
#include <windows.h>
#include <iostream>

using namespace std;

LRESULT InjectMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
   WNDPROC WndProc;
   LRESULT lRET = 0;

   WndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
   if (WndProc != NULL)
      lRET = CallWindowProc(WndProc, hWnd, uMsg, wParam, lParam);
   return lRET;
}

int main() {
   while (true) {
      if ((GetAsyncKeyState(0x73)<0)) {
         HWND hWndE = FindWindow(_T("MapleStoryClass"), NULL)//Assuming you have already declared tchar.

         PostMessage(hWndE, WM_CHAR, 'A', 0);
      }

      Sleep(1);
   }
}


Since this incles stdafx.h make sure you use precompiled headers. (When running wizard.) But it should compiled fine as an empty project if you comment out or delete "stdafx.h"
Back to top
View user's profile Send private message
wizardolu
Newbie cheater
Reputation: 0

Joined: 01 Jun 2007
Posts: 23

PostPosted: Mon Sep 15, 2008 7:19 pm    Post subject: Reply with quote

hmmm for some reason, the errors i get are in the linking part of building. also, i get the same type of errors
Code:

1>------ Build started: Project: fcvx, Configuration: Debug Win32 ------
1>Compiling...
1>fcvx.cpp
1>Linking...
1>fcvx.obj : error LNK2028: unresolved token (0A000299) "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)
1>fcvx.obj : error LNK2028: unresolved token (0A00029A) "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)
1>fcvx.obj : error LNK2028: unresolved token (0A00029B) "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>fcvx.obj : error LNK2028: unresolved token (0A00029C) "extern "C" long __stdcall CallWindowProcW(long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),struct HWND__ *,unsigned int,unsigned int,long)" (?CallWindowProcW@@$$J220YGJP6GJPAUHWND__@@IIJ@Z0IIJ@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.obj : error LNK2028: unresolved token (0A00029D) "extern "C" long __stdcall GetWindowLongW(struct HWND__ *,int)" (?GetWindowLongW@@$$J18YGJPAUHWND__@@H@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall CallWindowProcW(long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),struct HWND__ *,unsigned int,unsigned int,long)" (?CallWindowProcW@@$$J220YGJP6GJPAUHWND__@@IIJ@Z0IIJ@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall GetWindowLongW(struct HWND__ *,int)" (?GetWindowLongW@@$$J18YGJPAUHWND__@@H@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.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)
1>fcvx.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)
1>fcvx.obj : error LNK2019: unresolved external symbol "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>C:\Documents and Settings\***\My Documents\Visual Studio 2008\Projects\fcvx\Debug\fcvx.exe : fatal error LNK1120: 10 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\fcvx\fcvx\Debug\BuildLog.htm"
1>fcvx - 11 error(s), 0 warning(s)e]
[/code]
if that means anything to you
Back to top
View user's profile Send private message
sylvanus
Advanced Cheater
Reputation: 0

Joined: 09 May 2006
Posts: 68

PostPosted: Mon Sep 15, 2008 7:34 pm    Post subject: Reply with quote

yes, go to general -> change UNICODE to Multibyte.

too try changing (LPCWSTR("maplestory"),NULL)
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Tue Sep 16, 2008 2:29 am    Post subject: Reply with quote

Did you set the project up correctly? check your linker->input settings, include default libraries should be yes, and possibly add user32.lib to additional dependencies if you still have problems.

If all else fails upload your project for us to look at.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Sep 16, 2008 9:31 am    Post subject: Reply with quote

btw why r u using PostMessage instead InjectMessage that u already copied that does the exact thing ? O:
_________________
Stylo
Back to top
View user's profile Send private message
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Wed Sep 17, 2008 12:10 am    Post subject: Reply with quote

Don't you need to shift left 16? (Something like that...)
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Wed Sep 17, 2008 11:52 am    Post subject: Reply with quote

wizardolu wrote:
hmmm for some reason, the errors i get are in the linking part of building. also, i get the same type of errors
Code:

1>------ Build started: Project: fcvx, Configuration: Debug Win32 ------
1>Compiling...
1>fcvx.cpp
1>Linking...
1>fcvx.obj : error LNK2028: unresolved token (0A000299) "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)
1>fcvx.obj : error LNK2028: unresolved token (0A00029A) "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)
1>fcvx.obj : error LNK2028: unresolved token (0A00029B) "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>fcvx.obj : error LNK2028: unresolved token (0A00029C) "extern "C" long __stdcall CallWindowProcW(long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),struct HWND__ *,unsigned int,unsigned int,long)" (?CallWindowProcW@@$$J220YGJP6GJPAUHWND__@@IIJ@Z0IIJ@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.obj : error LNK2028: unresolved token (0A00029D) "extern "C" long __stdcall GetWindowLongW(struct HWND__ *,int)" (?GetWindowLongW@@$$J18YGJPAUHWND__@@H@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall CallWindowProcW(long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),struct HWND__ *,unsigned int,unsigned int,long)" (?CallWindowProcW@@$$J220YGJP6GJPAUHWND__@@IIJ@Z0IIJ@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall GetWindowLongW(struct HWND__ *,int)" (?GetWindowLongW@@$$J18YGJPAUHWND__@@H@Z) referenced in function "long __cdecl InjectMessage(struct HWND__ *,unsigned int,unsigned int,long)" (?InjectMessage@@$$FYAJPAUHWND__@@IIJ@Z)
1>fcvx.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)
1>fcvx.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)
1>fcvx.obj : error LNK2019: unresolved external symbol "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>C:\Documents and Settings\***\My Documents\Visual Studio 2008\Projects\fcvx\Debug\fcvx.exe : fatal error LNK1120: 10 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\fcvx\fcvx\Debug\BuildLog.htm"
1>fcvx - 11 error(s), 0 warning(s)e]
[/code]
if that means anything to you


could mean ur missing a lib file in your project.. when I get tons of errors like that.. its most likely something very important like

go to linking part in your Project Settings make sure you got something similar to this

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib followed by a bunch of other shit..

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
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
Page 2 of 2

 
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