By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,258 Members | 1,284 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,258 IT Pros & Developers. It's quick & easy.

VC++ Windows forms beginner question

P: n/a
managed C++
VS 2003

I have a beginner question about windows forms....
I need to call a function when a certain limit has been reached, now with
the way VS sets up the .NET windows Form I get confused. When I was using
Directx everything was being run from a while loop, so that was no problem
for me in seeing where to place conditional statements and other functions.

With windows forms do I need to have an event and eventhandler? it just
confuses me because of the form.h and form.cpp and pretty much all there is
in the .cpp is Application::Run(....).

Also can you give me advice on any good books for C++ .Net and WIndows. I
have Mircosoft Visual C++ .NET (step by step) by Templeman and Olsen but they
really don't give that much info on Windows forms and such.
--
Neal
Jan 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Neal" <Ne**@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
managed C++
VS 2003

I have a beginner question about windows forms....
I need to call a function when a certain limit has been reached, now with
the way VS sets up the .NET windows Form I get confused. When I was using
Directx everything was being run from a while loop, so that was no problem
for me in seeing where to place conditional statements and other
functions.

With windows forms do I need to have an event and eventhandler? it just
confuses me because of the form.h and form.cpp and pretty much all there
is
in the .cpp is Application::Run(....).

Also can you give me advice on any good books for C++ .Net and WIndows. I
have Mircosoft Visual C++ .NET (step by step) by Templeman and Olsen but
they
really don't give that much info on Windows forms and such.


"Windows Forms Programming in C#" by Chris Sells is a good book. You'll
have to translate from C# to C++, but that's not too hard.

Generally, just about everything that you write in a forms application is
(directly or indirectly) invoked as part of an event handler.

When you say "when a certain limit has been reached", what kind of a limit
are you talking about? Time? Mouse clicks? Value entered into a text
box? If it's time that you're interested in, look at the
Sytem.Windows.Forms.Timer class - drop a timer on your form, set it's period
to the time delay you want, and handle the Tick event.

-cd
Jan 26 '06 #2

P: n/a
Thanks for the book suggestions.
And yes I meant to say time limit, I will check into the Timer Class. Thank
You.
--
Neal
"Carl Daniel [VC++ MVP]" wrote:
"Neal" <Ne**@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
managed C++
VS 2003

I have a beginner question about windows forms....
I need to call a function when a certain limit has been reached, now with
the way VS sets up the .NET windows Form I get confused. When I was using
Directx everything was being run from a while loop, so that was no problem
for me in seeing where to place conditional statements and other
functions.

With windows forms do I need to have an event and eventhandler? it just
confuses me because of the form.h and form.cpp and pretty much all there
is
in the .cpp is Application::Run(....).

Also can you give me advice on any good books for C++ .Net and WIndows. I
have Mircosoft Visual C++ .NET (step by step) by Templeman and Olsen but
they
really don't give that much info on Windows forms and such.


"Windows Forms Programming in C#" by Chris Sells is a good book. You'll
have to translate from C# to C++, but that's not too hard.

Generally, just about everything that you write in a forms application is
(directly or indirectly) invoked as part of an event handler.

When you say "when a certain limit has been reached", what kind of a limit
are you talking about? Time? Mouse clicks? Value entered into a text
box? If it's time that you're interested in, look at the
Sytem.Windows.Forms.Timer class - drop a timer on your form, set it's period
to the time delay you want, and handle the Tick event.

-cd

Jan 26 '06 #3

P: n/a
First to clarify, even in .Net Windows Forms everything runs in a while
loop. When you say Application::Run(...), it actually starts a while
loop, waiting for messages on the process main thread which can be
handled by adding a message filter :-
Application::AddMessageFilter(...)
which must be done before Application::Run(...) as this 'Run' method
starts an infinite while loop.
Now, this part was common between your directx application and the
windows forms application. Now you have another thing, there is another
filter working in background, all the windows message is forwarded to
the form's onWindowProc method, which can be overridden.

Even the timer's WM_TIMER event goes thru all this :)

Remember, Timer you can not rely upon ... as if you have other window
message handler running for a longer time, timer event will not come on
time.

Tell us what you need to do exactly and I hope we can help you with that...

--
Abhijeet Dev
Neal wrote:
managed C++
VS 2003

I have a beginner question about windows forms....
I need to call a function when a certain limit has been reached, now with
the way VS sets up the .NET windows Form I get confused. When I was using
Directx everything was being run from a while loop, so that was no problem
for me in seeing where to place conditional statements and other functions.

With windows forms do I need to have an event and eventhandler? it just
confuses me because of the form.h and form.cpp and pretty much all there is
in the .cpp is Application::Run(....).

Also can you give me advice on any good books for C++ .Net and WIndows. I
have Mircosoft Visual C++ .NET (step by step) by Templeman and Olsen but they
really don't give that much info on Windows forms and such.

Jan 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.