Here are my files in the project:
test1.h :
#pragma once
using namespace System;
using namespace System::Windows::Forms;
ref class CTest1 : public Form
{
public:
CTest1(void);
};
test1.cpp :
#include "Test1.h"
CTest1::CTest1(void)
{
}
central.cpp :
#include <Windows.h>
#include "Test1.h"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow)
{
Application::Run(gcnew CTest1());
// Find the window of the calculator
HWND hWnd = FindWindow(0, "Calculator");
// The Window Does not Exist
if(hWnd == 0)
{
//MessageBox(0, "Error cannot find window.", "Error", MB_OK|MB_ICONERROR);
}
else
{
//MessageBox(0, "Window exists.", "Error", MB_OK|MB_ICONERROR);
}
return 0;
}
this code returns these errors:
Quote
1>------ Build started: Project: Test1, Configuration: Debug Win32 ------
1> central.cpp
1>central.obj : error LNK2028: unresolved token (0A00004A) "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
1>central.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
1>c:\users\dave\documents\visual studio 2010\Projects\Test1\Debug\Test1.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1> central.cpp
1>central.obj : error LNK2028: unresolved token (0A00004A) "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
1>central.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
1>c:\users\dave\documents\visual studio 2010\Projects\Test1\Debug\Test1.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have probably overlooked something because in normal c++ it works however in a CRL project this findwindow causes problems, maybe something i should have included to make it work, i don't really know.
Hope you guys can help me out ;)


Sign In
Create Account

Back to top










