Get problem with FindWindow(). Pls help! [modified]
-
Pls help me solve it... I got this error when I compile with VS 2005, pls help me.
------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
Compiling...
pHandle.cpp
Linking...
pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.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 "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
VLTKLib - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========My class: pHandle.h
#pragma once
#include #include #include namespace VLTKLib
{
public class pHandle
{
private:
HANDLE hProcess;public: pHandle(void); pHandle(HWND curWin); pHandle(char \*winClass, char \*winTitle); ~pHandle(void); void setHandle(HWND curWin); void setHandle(char \*winClass, char \*winTitle); void closeHandle(); long ReadInt(LPBYTE lpAddress); //Read 4 bytes short ReadWord(LPBYTE lpAddress); //Read 2 bytes char ReadChar(LPBYTE lpAddress); //Read 1 byte char \*ReadString(LPBYTE lpAddress, int szChar); };
}
-
Pls help me solve it... I got this error when I compile with VS 2005, pls help me.
------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
Compiling...
pHandle.cpp
Linking...
pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.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 "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
VLTKLib - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========My class: pHandle.h
#pragma once
#include #include #include namespace VLTKLib
{
public class pHandle
{
private:
HANDLE hProcess;public: pHandle(void); pHandle(HWND curWin); pHandle(char \*winClass, char \*winTitle); ~pHandle(void); void setHandle(HWND curWin); void setHandle(char \*winClass, char \*winTitle); void closeHandle(); long ReadInt(LPBYTE lpAddress); //Read 4 bytes short ReadWord(LPBYTE lpAddress); //Read 2 bytes char ReadChar(LPBYTE lpAddress); //Read 1 byte char \*ReadString(LPBYTE lpAddress, int szChar); };
}
Have you used
/NODEFAULTLIB
linker option , by accident ?
Prasad MS MVP - VC++
-
Pls help me solve it... I got this error when I compile with VS 2005, pls help me.
------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
Compiling...
pHandle.cpp
Linking...
pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.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 "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
VLTKLib - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========My class: pHandle.h
#pragma once
#include #include #include namespace VLTKLib
{
public class pHandle
{
private:
HANDLE hProcess;public: pHandle(void); pHandle(HWND curWin); pHandle(char \*winClass, char \*winTitle); ~pHandle(void); void setHandle(HWND curWin); void setHandle(char \*winClass, char \*winTitle); void closeHandle(); long ReadInt(LPBYTE lpAddress); //Read 4 bytes short ReadWord(LPBYTE lpAddress); //Read 2 bytes char ReadChar(LPBYTE lpAddress); //Read 1 byte char \*ReadString(LPBYTE lpAddress, int szChar); };
}
Did you import
User32.lib
?
WhiteSky
-
Did you import
User32.lib
?
WhiteSky
-
Have you used
/NODEFAULTLIB
linker option , by accident ?
Prasad MS MVP - VC++
-
Check
Project setting-->configuration properties-->Input-->Ignore All default lib.
set it to No if, if it is yes.
Prasad MS MVP - VC++
-
Pls help me solve it... I got this error when I compile with VS 2005, pls help me.
------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
Compiling...
pHandle.cpp
Linking...
pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
pHandle.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 "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
VLTKLib - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========My class: pHandle.h
#pragma once
#include #include #include namespace VLTKLib
{
public class pHandle
{
private:
HANDLE hProcess;public: pHandle(void); pHandle(HWND curWin); pHandle(char \*winClass, char \*winTitle); ~pHandle(void); void setHandle(HWND curWin); void setHandle(char \*winClass, char \*winTitle); void closeHandle(); long ReadInt(LPBYTE lpAddress); //Read 4 bytes short ReadWord(LPBYTE lpAddress); //Read 2 bytes char ReadChar(LPBYTE lpAddress); //Read 1 byte char \*ReadString(LPBYTE lpAddress, int szChar); };
}
HWND curWin = FindWindow((LPCWSTR)winClass,(LPCWSTR)winTitle) - error !!! FindWindowW(wchar_t const *,wchar_t const *) - postfiks 'W' mean that the funktion use wchar_t instead char. And you can convert char* to wchar_t* by using _TEXT("") macros. And look here -> pHandle::setHandle(NULL) - wich of your function will be use?
-
Right click on your project and select property on the solution window go to linker of tree list on the left panel open it and select input and enter this file at Additional Dependencies.
WhiteSky
-
HWND curWin = FindWindow((LPCWSTR)winClass,(LPCWSTR)winTitle) - error !!! FindWindowW(wchar_t const *,wchar_t const *) - postfiks 'W' mean that the funktion use wchar_t instead char. And you can convert char* to wchar_t* by using _TEXT("") macros. And look here -> pHandle::setHandle(NULL) - wich of your function will be use?
Tks for your reply. I converted all char * to wchar_t const as same as definetion of function, but I still got that errors.
void pHandle::setHandle(wchar_t const *winClass, wchar_t const *winTitle)
{
HWND curWin = FindWindow(winClass,winTitle);
setHandle(curWin);
}Tks for your help
-
Right click on your project and select property on the solution window go to linker of tree list on the left panel open it and select input and enter this file at Additional Dependencies.
WhiteSky
-
You're welcome.;)
WhiteSky