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 


[Help: C++] Opening a New Form

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Aug 21, 2007 7:18 pm    Post subject: [Help: C++] Opening a New Form Reply with quote

i searched around and only thing i could really find that helped me was this: (modified for my form)

Code:
private: System::Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
          frmAbout ^ dlg1 = gcnew frmAbout();
          dlg1->ShowDialog();


Errors i get:

Quote:
1>c:\documents and settings\kyle h\my documents\visual studio 2005\projects\temp conversion v2\temp conversion v2\Form1.h(406) : error C2065: 'frmAbout' : undeclared identifier
1>c:\documents and settings\kyle h\my documents\visual studio 2005\projects\temp conversion v2\temp conversion v2\Form1.h(406) : error C2065: 'dlg1' : undeclared identifier
1>c:\documents and settings\kyle h\my documents\visual studio 2005\projects\temp conversion v2\temp conversion v2\Form1.h(406) : error C2061: syntax error : identifier 'frmAbout'
1>c:\documents and settings\kyle h\my documents\visual studio 2005\projects\temp conversion v2\temp conversion v2\Form1.h(407) : error C2227: left of '->ShowDialog' must point to class/struct/union/generic type


Help is GREATLY appreciated, for it will help me for the rest of my C++ programming...

Note: i have included frmAbout.h (#include "frmAbout.h") at the top of my Form1 Header/Class

_________________


Last edited by lurc on Wed Aug 22, 2007 9:06 am; edited 1 time in total
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Tue Aug 21, 2007 7:35 pm    Post subject: Reply with quote

Is frmAbout a class? Because it doesn't look like it is, and you seem to be using it as if it is.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Aug 21, 2007 7:46 pm    Post subject: Reply with quote

not a clue? Shocked its a UI i added...

uh.. teach me Smile

_________________
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Tue Aug 21, 2007 7:58 pm    Post subject: Reply with quote

C++ syntax for declaring an instance of a class:
className classInstanceName = new classConstructor(args);
classConstructor is a method with the same name as the class name.

MS VC++ has an extension of the language allowing for a built-in garbage collector. This feature is used like so:
className^ classInstanceName = gcnew classConstructor(args);

^ "indicates a handle to an object on the garbage collected heap".
gcnew "allocates types on the garbage collected heap".

~nog_lorp

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Aug 21, 2007 8:11 pm    Post subject: Reply with quote

uhhh example code plz....

i know ur talkin about the code i have, but if its calling a class, why is it saying that the identifyer isnt there. and i've already declared the header in the Form1 Header

_________________
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Tue Aug 21, 2007 8:26 pm    Post subject: Reply with quote

You do not declare a header, you include one...
Read the header file, see what classes are declared in it.

One more thing, dlg1 is not a class pointer, so you should use . (or ::, not sure) and not ->. classptr->method is the same as (classptr*).method

~nog_lorp

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Aug 21, 2007 8:41 pm    Post subject: Reply with quote

i have included it. thats what i ment by Declare.

Edit: i figured it out, thanks

_________________
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
Page 1 of 1

 
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