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

.NET Event Handling (timers, Mouse movement)

P: n/a
Hi, I'm trying to get intimate with my new copy of the .NET Pro
developing environment, specifically C++ Visual Studio. I have a book
(VC++ in 21 days) that I am going through following their examples.
However the book treats the MS VC++ 6.0 environment and I...as I
mentioned am learning .NET.

It hasn't been too large a problem so far, I'm have a comp sci degree
and have done plenty of c++ so where the two don't match up I've been
mostly able to figure it out. However I am having problems figuring
out how to make an event handler for timers or mouse actions.

I think It all spawns from the same problem so if I can figure out
timers I can probably handle the rest. So far I have done the
following:
-Added a resource symbol ID_CLOCK_TIMER (am I correct that this simply
adds a #define ID_CLOCK_TIMER line to resource.h?)
-did SetTimer(ID_CLOCK_TIMER, 1000,NULL); in OnInitDialog()

Now the book states I can click on my main dialog box(main window) and
do add event handler to handle the WM_TIMER message. .NET won't let me
add an event handler to the main message box however and for no place
where I CAN add an event handler do I see the WM_TIMER message as an
option in the wizard. I tried adding a handler manually (from what I
understood should be done)
and added
public:
afx_msg void OnTimer(UINT_PTR nIDEvent);
to my main dialog class (it is derived from CDialog)
as well as a definition
void CTimeyDlg::OnTimer(UINT_PTR nIDEvent) {
MessageBox("Yo");
}
Nothing happens however.

Can anyone help me out here?
Thanks a lot
Toga

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"TogaKangaroo" <gm****@gmail.com> wrote in message
Can anyone help me out here?
Probably yes, but this is off-topic here. Please read the welcome message
before posting - http://www.slack.net/~shiva/welcome.txt .
Thanks a lot


Thank you.

Sharad
Jul 23 '05 #2

P: n/a
TogaKangaroo wrote:
Hi, I'm trying to get intimate with my new copy of the .NET Pro
developing environment, specifically C++ Visual Studio. I have a book
(VC++ in 21 days) that I am going through following their examples.
However the book treats the MS VC++ 6.0 environment and I...as I
mentioned am learning .NET.

It hasn't been too large a problem so far, I'm have a comp sci degree
and have done plenty of c++ so where the two don't match up I've been
mostly able to figure it out. However I am having problems figuring
out how to make an event handler for timers or mouse actions.

I think It all spawns from the same problem so if I can figure out
timers I can probably handle the rest. So far I have done the
following:
-Added a resource symbol ID_CLOCK_TIMER (am I correct that this simply
adds a #define ID_CLOCK_TIMER line to resource.h?)
-did SetTimer(ID_CLOCK_TIMER, 1000,NULL); in OnInitDialog()

Now the book states I can click on my main dialog box(main window) and
do add event handler to handle the WM_TIMER message. .NET won't let me
add an event handler to the main message box however and for no place
where I CAN add an event handler do I see the WM_TIMER message as an
option in the wizard. I tried adding a handler manually (from what I
understood should be done)
and added
public:
afx_msg void OnTimer(UINT_PTR nIDEvent);
to my main dialog class (it is derived from CDialog)
as well as a definition
void CTimeyDlg::OnTimer(UINT_PTR nIDEvent) {
MessageBox("Yo");
}
Nothing happens however.

Can anyone help me out here?

At first you have to know that programming with C++ in a platform
involves two things. Knowledge of the C++ language itself as it is
defined by ISO C++ standard, and knowledge of the specific platform
extensions (its GUI library etc).
You can get up and running regarding ISO C++ by reading "Accelerated
C++" by Andrew Koening, Barbara Moo:

http://www.acceleratedcpp.com
About Windows, the best thing you have to do is learn .NET facilities
and not the older ones (MFC, Win32, etc). Since you have VC++ .NET, a
good book for VC++ 2003 .NET which will help you to learn how to use
..NET with C++ is
"Visual C++ .NET How To Program" by Deitel.

http://vig.prenhall.com/catalog/acad...373774,00.html
It is very good, it covers even multithreading.
However if you can wait, I suggest you wait for VC++ 2005 and the new
C++/CLI standard.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.