Click here to Skip to main content
15,914,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: can anyone convert this MFC code to WIN32 code please help Pin
Hans Dietrich20-Mar-11 2:43
mentorHans Dietrich20-Mar-11 2:43 
JokeMessage Removed Pin
20-Mar-11 2:52
goldenrose920-Mar-11 2:52 
GeneralRe: can anyone convert this MFC code to WIN32 code please help PinPopular
Hans Dietrich20-Mar-11 3:14
mentorHans Dietrich20-Mar-11 3:14 
GeneralMessage Removed Pin
20-Mar-11 6:02
goldenrose920-Mar-11 6:02 
GeneralRe: can anyone convert this MFC code to WIN32 code please help Pin
Richard MacCutchan20-Mar-11 7:16
mveRichard MacCutchan20-Mar-11 7:16 
GeneralRe: can anyone convert this MFC code to WIN32 code please help Pin
tagopi21-Mar-11 0:29
tagopi21-Mar-11 0:29 
QuestionInstances of an object [modified] Pin
Cyclone_S19-Mar-11 14:01
Cyclone_S19-Mar-11 14:01 
AnswerRe: Instances of an object Pin
Luc Pattyn19-Mar-11 14:49
sitebuilderLuc Pattyn19-Mar-11 14:49 
Hi,

welcome to CodeProject. I have several comments on your code:

1.
you did something wrong when posting the code as all > signs became double-HTML-encoded (see the >), making things pretty hard to read.

2.
I don't understand at all why this would be a C/C++ question, it looks like C++/CLI to me; that is .NET's version of C++, and it has its own forum on CodeProject. The current one is for native, unmanaged C or C++ code.

3.
a timer interval of 1 msec is not what you are going to get, you may want to read my article here: Timer surprises, and how to avoid them[^].

4.
You are using a PictureBox for each missile; I wouldn't do that. All the PB does for you is remember its Location and show an image somewhere on your form. You could as well paint the image yourself, by overriding the Form's OnPaint method (or, what I prefer: by adding a Panel and overriding its OnPaint). So in more detail I would:
- define a little Missile class with a Point and a Color member, and a PaintMe(Graphics g, Point at) method.
- instantiate Missiles and hold them in a generic List.
- in the Form/Panel's OnPaint enumerate those Missiles and have each of them paint itself.
Doing so would allow you to run hundreds of missiles without things getting slow.

5.
Collision detection could benefit from the same list of Missiles (that is assuming multiple missiles are moving at the same time, either controlled by your key stuff, or maybe just by a timer). You could again enumerate the Missile instances, and for each of them check for a collision and act accordingly (change color, explode, break in two, whatever).

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Instances of an object Pin
Cyclone_S19-Mar-11 15:58
Cyclone_S19-Mar-11 15:58 
AnswerRe: Instances of an object Pin
Luc Pattyn19-Mar-11 17:20
sitebuilderLuc Pattyn19-Mar-11 17:20 
GeneralRe: Instances of an object Pin
Cyclone_S21-Mar-11 15:36
Cyclone_S21-Mar-11 15:36 
Questionhow to remove the extra border of a button after enabling xp visual style Pin
goldenrose918-Mar-11 17:38
goldenrose918-Mar-11 17:38 
AnswerRe: how to remove the extra border of a button after enabling xp visual style Pin
Hans Dietrich19-Mar-11 2:32
mentorHans Dietrich19-Mar-11 2:32 
QuestionRe: how to remove the extra border of a button after enabling xp visual style Pin
goldenrose919-Mar-11 8:02
goldenrose919-Mar-11 8:02 
QuestionAccess violation reading location 0x00378004. Pin
so0_lanhlung218-Mar-11 17:06
so0_lanhlung218-Mar-11 17:06 
QuestionRe: Access violation reading location 0x00378004. Pin
CPallini18-Mar-11 23:37
mveCPallini18-Mar-11 23:37 
AnswerRe: Access violation reading location 0x00378004. Pin
so0_lanhlung219-Mar-11 3:31
so0_lanhlung219-Mar-11 3:31 
QuestionRe: Access violation reading location 0x00378004. Pin
Code-o-mat18-Mar-11 23:59
Code-o-mat18-Mar-11 23:59 
AnswerRe: Access violation reading location 0x00378004. Pin
so0_lanhlung219-Mar-11 3:23
so0_lanhlung219-Mar-11 3:23 
GeneralRe: Access violation reading location 0x00378004. Pin
Richard MacCutchan19-Mar-11 3:59
mveRichard MacCutchan19-Mar-11 3:59 
GeneralRe: Access violation reading location 0x00378004. Pin
Code-o-mat19-Mar-11 4:01
Code-o-mat19-Mar-11 4:01 
GeneralRe: Access violation reading location 0x00378004. Pin
so0_lanhlung219-Mar-11 6:22
so0_lanhlung219-Mar-11 6:22 
QuestionRe: Access violation reading location 0x00378004. Pin
CPallini19-Mar-11 4:41
mveCPallini19-Mar-11 4:41 
QuestionMy computer is possessed Pin
Kaaib18-Mar-11 11:30
Kaaib18-Mar-11 11:30 
AnswerRe: My computer is possessed Pin
వేంకటనారాయణ(venkatmakam)18-Mar-11 20:24
వేంకటనారాయణ(venkatmakam)18-Mar-11 20:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.