Sign in to follow this  
fishleg003

Windows Forms C++ Syntax help

Recommended Posts

I'm trying to add my own idle function but this line is not valid. void App_Idle(System::Object sender, System::EventArgs e) Application::Idle += System::EventHandler(App_Idle); Error : cannot convert from 'void (__clrcall *)(System::Object,System::EventArgs)' to 'System::EventHandler' What am I missing ? heres the full code below,
#include "stdafx.h"
#include "Form1.h"

using namespace System;
using namespace BlackJackForm;

int i = 0; //is this legal code ?

void App_Idle(System::Object sender, System::EventArgs e) 
{
	i++;
}

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 
	Application::Idle += gcnew System::EventHandler(App_Idle); 
	i = 3;
	// Create the main window and run it
	Form1 ^MainForm;
	MainForm = gcnew Form1();
	Application::Run(MainForm);

	return 0;
}



[Edited by - fishleg003 on February 18, 2008 7:11:54 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this