Re: .NET Event Handling (timers, Mouse movement)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Frank Hickman [MVP] (fhickman_NOSP_at_M_noblesoft.com)
Date: 02/13/05


Date: Sat, 12 Feb 2005 22:50:24 -0500


"TogaKangaroo" <gmauer@gmail.com> wrote in message
news:1108242304.584743.251280@c13g2000cwb.googlegroups.com...
> 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
>

When you have your dialog class up in the code editor, open/select the
properties window. Beside the button for adding events (lightening bolt)
you'll see a mini-window for messages. This is where the WM_TIMER can be
specified.

-- 
============
Frank Hickman
Microsoft MVP
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


Relevant Pages

  • Re: System.Timers.Timer
    ... TIA ... I need a sample with timers. ... and add an event handler to the timer's Tick event. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Creating dynamic TTimers with Nil owner
    ... >multiple dynamic TTimers at runtime with a *Nil* owner? ... >timers and how to make sure each instance of the timers is freed when the ... iTimer: Integer; ... // Now set the timer properties, including the event handler so we ...
    (alt.comp.lang.borland-delphi)
  • Re: System.Timers.Timer
    ... I need a sample with timers. ... I read the samples on the net with consol output but I want to change (for ... and add an event handler to the timer's Tick event. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Newbie Learning Threading
    ... >>> It's just that only the last thread would still have an event handler ... >> told that he needed it for learning. ... give here the for me more proper method in VBNet. ...
    (microsoft.public.dotnet.general)
  • Re: Toolbar Event Handler for .NET
    ... You can use the properties window to do it in VS2003.net. ... > In this context menu, one of the choices is Add Event Handler. ... > I can not find anything corresponding for the toolbar buttons. ...
    (microsoft.public.vc.mfc)