cant compile windows form application?

Posts 1–7 of 7 · Page 1 of 1
cant compile windows form application?
this is my first time messing around with the windows form application, it seems like it doesnt not compile code as a normal console program does. heres what im trying to do, make a start and stop, and a exit button. it compiles and runs when i just have Application::Exit(); but my code in button1 throws an error when i compile.

Code:
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
		if (GetAsyncKeyState(VK_CAPITAL)){
		Sleep( 85 );
		keybd_event( VK_LBUTTON,0x1,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYDOWN,0);
		Sleep( 85 );
        keybd_event( VK_LBUTTON,0x1,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
	}
 }

	private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
				 Application::Exit();
			 }
	private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
			 }
	};
Knowing how to understand what the compiler is saying to you and how to fix it is part of being a programmer.

Also, im not a psychic to know what error that code is giving you without you telling me.
Code:
1>------ Build started: Project: form rapid fire, Configuration: Debug Win32 ------
1>Build started 5/27/2014 12:06:05 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\form rapid fire.unsuccessfulbuild".
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>ClCompile:
1>  All outputs are up-to-date.
1>  All outputs are up-to-date.
1>  All outputs are up-to-date.
1>CoreResGen:
1>  No resources are out of date with respect to their source files. Skipping resource generation.
1>ResourceCompile:
1>  All outputs are up-to-date.
1>form rapid fire.obj : error LNK2028: unresolved token (0A000020) "extern "C" void __stdcall keybd_event(unsigned char,unsigned char,unsigned long,unsigned long)" (?keybd_event@@$$J216YGXEEKK@Z) referenced in function "private: void __clrcall formrapidfire::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@formrapidfire@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>form rapid fire.obj : error LNK2028: unresolved token (0A000022) "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "private: void __clrcall formrapidfire::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@formrapidfire@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>form rapid fire.obj : error LNK2019: unresolved external symbol "extern "C" void __stdcall keybd_event(unsigned char,unsigned char,unsigned long,unsigned long)" (?keybd_event@@$$J216YGXEEKK@Z) referenced in function "private: void __clrcall formrapidfire::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@formrapidfire@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>form rapid fire.obj : error LNK2019: unresolved external symbol "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "private: void __clrcall formrapidfire::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@formrapidfire@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>C:\Users\Cody\Documents\Visual Studio 2010\Projects\form rapid fire\Debug\form rapid fire.exe : fatal error LNK1120: 4 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.31
sry i forgot to post this
Code:
#pragma comment(lib, "user32.lib")
Quote Originally Posted by Harava View Post
Code:
#pragma comment(lib, "user32.lib")
thank you that worked. can you tell me how im suppost to declair and define things. im getting this error on a different peice of code

1>c:\users\cody\documents\visual studio 2010\projects\form rapid fire\form rapid fire\Form1.h(481): error C2065: 'hProcess' : undeclared identifier

Code:
{int God;
			 if (GetAsyncKeyState(VK_F1) & 0x0001){
				God = 1050625;
				DWORD newdatasize = sizeof(God);
				(WriteProcessMemory(hProcess, (LPVOID)0x0176C8A4, &God, newdatasize, NULL));
			}
			}
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us