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

C / C++ / MFC

 
AnswerRe: XP problem Pin
Ștefan-Mihai MOGA29-Jun-08 5:01
professionalȘtefan-Mihai MOGA29-Jun-08 5:01 
GeneralRe: XP problem Pin
RomTibi6-Jul-08 5:49
RomTibi6-Jul-08 5:49 
QuestionHow to get Thread State Pin
SalarSoft28-Jun-08 18:21
SalarSoft28-Jun-08 18:21 
AnswerRe: How to get Thread State Pin
rp_suman29-Jun-08 5:24
rp_suman29-Jun-08 5:24 
AnswerRe: How to get Thread State Pin
Mark Salsbery29-Jun-08 8:40
Mark Salsbery29-Jun-08 8:40 
GeneralRe: How to get Thread State Pin
SalarSoft29-Jun-08 18:20
SalarSoft29-Jun-08 18:20 
AnswerRe: How to get Thread State Pin
SalarSoft30-Jun-08 19:41
SalarSoft30-Jun-08 19:41 
Questionenduring object in Visual Studion Pin
bkelly1328-Jun-08 7:15
bkelly1328-Jun-08 7:15 
I am having a conceptual problem with a program I want to create. The application will be a galactic simulator. The user will be able to edit and create some number of stars giving them arbitrary values for mass, position, and velocity. The application will calculate how the stars orbit each other and display them on the screen in a 3D format.

The number of stars can vary. I plan to use a linked list to hold all the stars. In this manner, each star object can traverse the entire list and calculate how each other star affects it. Then each star object can calculate where it will be at the end of each simulation step.

I start off by creating a basic dialog driven application using Visual Studio, C++, and static linked MFC. (I am open to suggestions) Then I need to have a place to anchor the linked list of stars. I envision a class whose entire purpose is just to provide the linked list. It will contain the methods to link items into the list and remove them. I can use STL, but the exact implementation is not important.

My problem is: Where and how should I declare and instantiate the object of that list?

Windows applications does not have a main() that sticks around for the life of the application.

For ease of discussion, let us say the list class is named:
CLinkedList 

and the object instantiated will be:
ListAnchor.


The objects contained in the list will be of class:
CStar

and will be created thusly:

CStar new_star = new( CStar );


To put the new star in the list I envision writing a line of code that looks something like:

ListAnchor.LinkNewStar( new_star );
Or maybe
ListAnchor->LinkNewStar( new_star );


When I create my new Windows dialog application the name will be StarSimulator and Windows will create StarSimulator.h, StarSimulator.cpp, StarSimulatorDlg.h, StarSimulatorDlg.cpp and a host of other support files. I don't think anyone wants me to post any of those files. Assume the standard environment for Visual Studio 2008 running on Windows XP and using C++.

Where and how should I declare and instantiate this object ListAnchor?

If my entire approach is wrong, please advise.

Thanks for your time

AnswerRe: enduring object in Visual Studion Pin
CPallini28-Jun-08 7:30
mveCPallini28-Jun-08 7:30 
GeneralRe: enduring object in Visual Studion Pin
bkelly1328-Jun-08 11:47
bkelly1328-Jun-08 11:47 
GeneralRe: enduring object in Visual Studion Pin
Mark Salsbery28-Jun-08 12:19
Mark Salsbery28-Jun-08 12:19 
GeneralRe: enduring object in Visual Studion Pin
bkelly1329-Jun-08 11:45
bkelly1329-Jun-08 11:45 
GeneralRe: enduring object in Visual Studion Pin
Mark Salsbery29-Jun-08 12:02
Mark Salsbery29-Jun-08 12:02 
QuestionIt makes me crazy.. help me plz. Pin
FR2ESOD28-Jun-08 6:32
FR2ESOD28-Jun-08 6:32 
AnswerRe: It makes me crazy.. help me plz. Pin
CPallini28-Jun-08 7:24
mveCPallini28-Jun-08 7:24 
GeneralRe: It makes me crazy.. help me plz. Pin
FR2ESOD28-Jun-08 13:21
FR2ESOD28-Jun-08 13:21 
AnswerRe: It makes me crazy.. help me plz. Pin
Ștefan-Mihai MOGA29-Jun-08 5:04
professionalȘtefan-Mihai MOGA29-Jun-08 5:04 
GeneralRe: It makes me crazy.. help me plz. Pin
FR2ESOD29-Jun-08 6:12
FR2ESOD29-Jun-08 6:12 
QuestionCaptuve encode and stream over a network Pin
Ethemind28-Jun-08 6:19
Ethemind28-Jun-08 6:19 
AnswerRe: Captuve encode and stream over a network Pin
Mark Salsbery28-Jun-08 7:44
Mark Salsbery28-Jun-08 7:44 
QuestionEvent Handling for Dynamically created ListBox Pin
chetanjoshi928-Jun-08 1:09
chetanjoshi928-Jun-08 1:09 
AnswerRe: Event Handling for Dynamically created ListBox Pin
MANISH RASTOGI28-Jun-08 2:11
MANISH RASTOGI28-Jun-08 2:11 
GeneralRe: Event Handling for Dynamically created ListBox Pin
chetanjoshi928-Jun-08 2:34
chetanjoshi928-Jun-08 2:34 
AnswerRe: Event Handling for Dynamically created ListBox Pin
Karthik Kalyanasundaram28-Jun-08 5:58
Karthik Kalyanasundaram28-Jun-08 5:58 
AnswerRe: Event Handling for Dynamically created ListBox Pin
Hamid_RT30-Jun-08 18:56
Hamid_RT30-Jun-08 18:56 

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.