473,811 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.NET Event Handling (timers, Mouse movement)

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_CLO CK_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_PT R nIDEvent);
to my main dialog class (it is derived from CDialog)
as well as a definition
void CTimeyDlg::OnTi mer(UINT_PTR nIDEvent) {
MessageBox("Yo" );
}
Nothing happens however.

Can anyone help me out here?
Thanks a lot
Toga

Jul 23 '05 #1
2 2017

"TogaKangar oo" <gm****@gmail.c om> 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
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_CLO CK_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_PT R nIDEvent);
to my main dialog class (it is derived from CDialog)
as well as a definition
void CTimeyDlg::OnTi mer(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 "Accelerate d
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4224
by: Srinath Avadhanula | last post by:
Hello, I am wondering if QT has something like QWaitForNextEvent() function. This function would block execution of the application till another key was pressed and then return the event which occured. Would like to utlize this in a small application I am building: I am trying to create vi key-bindings for a simple QMultiLineEdit
4
1908
by: Oscar Monteiro | last post by:
the Code below captures the Mouse move event, while event isn´t defined anywhere it still works in IE only, how can I define the event handler so it can work with other browsers, Firefox mostly. -------snipped code------------- Ymouse = -50; Xmouse = -50; function Mouse(evnt) { Ymouse=event.y-20; Xmouse=event.x;
9
5737
by: VK | last post by:
My original idea of two trains, however pictural it was, appeared to be wrong. The truth seems to be even more chaotic. IE implements its standard down-up model: any mouse event goes from the deepest visible element to the top. By carefully studying fromElement and toElement properties, one can handle events on any point of their way up. NN/FF implements a "Russian hills" style: mouse events go first up->down (window->deepest...
4
1758
by: Eduard Witteveen | last post by:
Hello, I want to make a hooverbox, which is shown when the mousepointer is not moved for a amount of time. When the hooverbox is shown, i will do a server request to retrieve the information for the hooverbox. I was thinking of using document.onmousemove and a infinit running while loop comparing the mouse positions. Is this the way to solve it?
5
5517
by: Ravi | last post by:
In IE (tested IE6 on W2k&WXP) onmousemove event appears to fire continually when mouse is over the document and not moving or touched at all, even when mouse is physically detached from the computer. Same page on Firefox works well (event fires only when mouse moves, not when it is static on the document). Seems a bug, doesn't it? Anyone knows something about this or a solution?
3
9989
by: Logan Mckinley | last post by:
I need to be able to detect mouse movement even when it is not over my application. I can get the mouse cords using MousePosition but I am not sure if there is an event that hits my program when the mouse is not over my program. One idea i had was make a child form that was transparent and use the MouseMove event to keep that transparent window under the mouse but the transparent window did not catch the MouseMove event. I also tried...
1
19253
by: Benny Raymond | last post by:
In my attempt to make a macro recording program where i can then playback mouse movements i'm running into a big problem: I'm trying to simulate the movement of the mouse to a point on the screen. With my current code the mouse is only moving in the X direction and not in the Y direction (however my debug line is telling me that it's trying to move in the Y as well). I've read everything I could find online, tried some hacky ways of...
2
2137
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the background color of a label on the form the user is looking at. I use red for when the database is...
4
6979
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I just gotta fix it. I need to make some calculations on the measurements and VB6 is my language. Yes, the system mouse will corrupt the measurement, but it's an auditing function and that's acceptable.
0
9728
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
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
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
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
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();...
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
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.