Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-07-2008, 02:48 AM
hellochar hellochar is offline
Newbie
 
Join Date: Jul 2008
Posts: 10
Rep Power: 0
hellochar is on a distinguished road
Question Visual C++ 2005 giving me a hard time

Hi, I've been a Java programmer for 2-3 years now, and over the summer I am trying to learn C++. I hear they're basically the same thing, and I've gone through some online tutorials and the like. The problem I have today is one with Windows Forms. For those of you who know Java, it's easy enough to make something graphical. My first attempt at a real program in Java was a simple program where you drew with your mouse, so I'm doing the same for C++. But I have a problem. With Java, it's easy enough to make a "Form" by creating a JFrame and retrieving a Graphics object. But in C++ I have no idea how to do that, and I'm getting lost in Visual C++ 2005 express edition. I don't usually like to use the GUI builders, so I'm attempting to avoid that, but I can't seem to get a window to show in C++ without the builder... can anyone help me?

Right now, through using the builder, I can create a method that fires off when the mouse moves.

Code:
private: System::Void mouseMoved(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
				 if( e->Button == System::Windows::Forms::MouseButtons::Left) {
					 System::Drawing::Graphics g = this->CreateGraphics;
				}
			 }
I have some questions about the code:
  • What is sender?
  • The compiler gives me errors when I try to compile the line after the if statement. I know I'm doing something wrong with pointers, can someone tell me the problem and possibly a solution?

Thanks

-Jill
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-07-2008, 12:12 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,263
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Visual C++ 2005 giving me a hard time

The sender is the object that triggers the code. Usually the EventArgs are more useful than the sender, but every event handler tends to have one.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-07-2008, 09:40 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 507
Last Blog:
Programs Under the Hoo...
Rep Power: 10
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: Visual C++ 2005 giving me a hard time

Could you post the error message it gives you with the line after the if statement? I think it might be because you don't have #using namespace System; near the beginning of your code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-07-2008, 09:53 PM
hellochar hellochar is offline
Newbie
 
Join Date: Jul 2008
Posts: 10
Rep Power: 0
hellochar is on a distinguished road
Default Re: Visual C++ 2005 giving me a hard time

Nevermind, I figured out my issue (i was doing "createGraphics" instead of "createGraphics()"). thanks guys, appreciate the help and I'll probably have more things to ask in the future
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-09-2008, 07:26 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,263
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Visual C++ 2005 giving me a hard time

No probs. In older versions of VB and things you could get away with not using () but in .NET it is mandatory.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 07-11-2008, 02:59 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 507
Last Blog:
Programs Under the Hoo...
Rep Power: 10
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: Visual C++ 2005 giving me a hard time

There's a newer version available for download on Microsoft's website (free):
Microsoft Visual Studio 2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-12-2008, 09:10 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,263
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Visual C++ 2005 giving me a hard time

I can't see much difference between versions 2005 and 2008.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-12-2008, 02:08 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 507
Last Blog:
Programs Under the Hoo...
Rep Power: 10
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: Visual C++ 2005 giving me a hard time

I've never had the 2005 version, so I wouldn't know.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-12-2008, 02:28 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,263
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Visual C++ 2005 giving me a hard time

I have. I really can't see the difference between them.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
c++, graphics, gui, java, visual



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio 2005 and Windows Vista Jordan General Programming 3 01-22-2007 03:21 PM
Visual Studio 2005 Pro Won't Install CheeseBurgerMan Software Development Tools 10 09-22-2006 05:44 PM
Visual Studio 2005 Express Edition Crane Software Development Tools 9 05-25-2006 06:17 PM
Visual Studio 2005 Free Training Crane C and C++ 6 05-23-2006 11:55 PM


All times are GMT -5. The time now is 02:01 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads