473,756 Members | 6,106 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VC++ Windows forms beginner question

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::Ru n(....).

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
3 2645
"Neal" <Ne**@discussio ns.microsoft.co m> wrote in message
news:12******** *************** ***********@mic rosoft.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::Ru n(....).

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.F orms.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
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**@discussio ns.microsoft.co m> wrote in message
news:12******** *************** ***********@mic rosoft.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::Ru n(....).

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.F orms.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
First to clarify, even in .Net Windows Forms everything runs in a while
loop. When you say Application::Ru n(...), it actually starts a while
loop, waiting for messages on the process main thread which can be
handled by adding a message filter :-
Application::Ad dMessageFilter( ...)
which must be done before Application::Ru n(...) 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::Ru n(....).

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2770
by: Steven O. | last post by:
First, sorry if by some chance I am not posting to the correct newsgroups, these seemed to be the most applicable to my question (see disclaimer at end of post for further comments....). Started with the Borland web site, and it didn't answer my questions, so I hope someone here will be kind enough to reply. I took a few courses on C++ using Microsoft Visual C++, and then taught myself MFC for GUI design -- an exercise akin to using...
3
2458
by: Shardul Kulkarni | last post by:
Hello everyone, I am Shardul Kulkarni,and I am doing M.Sc.(Computer Science) from PUNE University (INDIA). I have one subject : Windows Programing using VC++(SDK). So, can anyone refer me some good links,books or online tutorials for the same. I will be very thankfull to the person.
1
3613
by: Jiang Yue Brandon | last post by:
I am very confused about the different ways of VC++ and C# for doing windows form/dialog design in Visual Studio.NET. In C#, after you drag & drop the components to the form, the underlying codes will be automatically modified to add corresponding objects. However, in VC++, in order to design any forms/dialogs, resources must to be created first, then we need manually
9
1960
by: borhan | last post by:
Hi folks, I am using vs.net 2003 for a time, however since last week I was using MFC. Now, I am into managed C++ and windows forms. I can say that I am very much confused with it, and I have some questions I hope I can find some answers here... 1. First of all, I got the answer to this question but I have to point that out! What kind of c++ programming is that to write all the
20
8909
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it works just fine. If I put the call in the .cpp file, I get the following two errors: error C2653: 'MessageBoxA': is not a class or namespace name error C2660: 'System::Windows::Forms::Control::Show': function does not take
3
1244
by: Scott | last post by:
I've googled this a bit and suppose I know the answer, but I'd appreciate any input: I'd like to write windows forms apps in C++, but it seems almost as if that is discouraged. As an example, practically all the books, etc. are written for C# and VB. Even Petzold. This begs the further question, is C++ the language of choice, or at least on equal ground, for any form of .NET development? Or is it just passe as far as MS is...
8
1825
by: The unProfessional | last post by:
To the VC .Net'ers out there... I noticed alot of strange behavior in the way VC .Net apps behave in the IDE. It's a bit odd, so maybe people have workarounds. I'm worried to devote my project to the managed/unmanaged heuristic because these early issues make me feel VC .net just isn't mainstream (or complete) enough yet to depend on. Anyway, one of the things is the code formatting. When adding event handlers and such, the code is...
1
1969
by: foreman | last post by:
Hello Everybody: I am trying out DialogBox, and I have been trying to press the OK Button on the dialogbox hoping I can receive the OK DialogResult to Main Form. Below is my OK button click event handler code on AboutBox Dialogbox: DialogResult = DialogResult::OK; It can also dismiss the dialogbox and return OK "Ideally".
11
2208
by: Dr. Zharkov | last post by:
We want to export myArrayVB (2000, 2) of VB .NET 2003 in myArrayVó of VC++ .NET 2003 on scheme "component - client". But there is an error. For development of a component in VB .NET 2003 we make: File, New, Project, Visual Basic Projects, Class Library, name of project: ComponentVB. We write the code: Public Function myFunction1(ByVal N_i As Integer, _
0
9454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10028
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9707
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6533
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5139
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2664
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.