SV: Re: Re: Windows message in wxwidgets help?

Arne Steinarson asteinarson at yahoo.se
Tue Jul 3 06:28:09 PDT 2007


Change:

>     else ptrWindow->MSWWindowProc(message, wParam,
> lParam); // I think it's
> this line?

to:

  else MSWWindowProc(message, wParam, lParam);

But better still is to understand why this is done.

// ATS


--- rozni yusof <rozniy at gmail.com> skrev:

> I think I sort of understand... I haven't had many
> occasions to use
> Polymorphism.
> 
> What might be wrong with my code here? I'm getting
> memory error when I try
> to run the program.:
> 
> wxDialog *ptrWindow;
> 
> bool FreqDlgApp::OnInit()
> {
>     FreqDlg* dialog = new FreqDlg(NULL);
> 
>     ptrWindow = dialog;
> 
>     SetTopWindow(dialog);
>     dialog->Show(true);
>     return true;
> }
> 
> WXLRESULT FreqDlg :: MSWWindowProc(WXUINT message,
> WXWPARAM
> wParam, WXLPARAM lParam)
> {
>       float Freq=0;
> 
>    if (message == OLDA_WM_MEASURE_DONE)
>      {
>        Freq = LongToFreq (lParam);
>        wxLogMessage("Message");
>       //and some other stuff
>      }
> 
>     else ptrWindow->MSWWindowProc(message, wParam,
> lParam); // I think it's
> this line?
> 
> 
> }
> 
> 
> 
> 
> 
> 
> On 7/3/07, Arne Steinarson <asteinarson at yahoo.se>
> wrote:
> >
> > It's not trivial. This function is central for
> message
> > processing on wxW...
> >
> > Looking at wxWidgets source for wxMSW one can
> > understand how this works. If you override this
> > function, it is _very_ important to call the base
> > class version, otheriwse things will stop working.
> >
> > Regards
> > // ATS
> >
> >
> > --- rozni yusof <rozniy at gmail.com> skrev:
> >
> > > Sorry to bother you guys again, but everything
> I've
> > > done witht the
> > > MSWWindowProc causes the program to freeze while
> > > loading (except when I put
> > > exit(1) in it!). I'm just not getting something
> here
> > > which people consider
> > > trivial, 'cos Googling 4 pages for "override
> > > MSWWindowProc" didn't help!
> > >
> > > On 7/2/07, Arne Steinarson
> <asteinarson at yahoo.se>
> > > wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > You have to override virtual func:
> > > > >
> > > > > wxWindow::MSWWindowProc(WXUINT message,
> WXWPARAM
> > > > > wParam, WXLPARAM lParam);
> > > > >
> > > > > Regards
> > > > > // Arne S.
> > > > >
> > > > >
> > > > > --- rozni yusof < rozniy at gmail.com> skrev:
> > > > >
> > > > > > I went right into wxWidgets right after
> > > learning
> > > > > > C++. Now I need to process
> > > > > > a Windows Message in my wxWidgets app,
> which
> > > the
> > > > > > wxWidgets FAQ says is
> > > > > > indeed possible... but I'm a bit clueless,
> > > having
> > > > > > skipped Win32 programming
> > > > > > (or MFC for that matter) to go wx.
> > > > > >
> > > > > > I take it wxWindow::GetHWND() (suggested
> by
> > > the
> > > > > > wxWidgets FAQ)has been
> > > > > > superceeded by wxWindow::GetHandle? For
> > > GetHWND() is
> > > > > > nowhere in my wxWidgets
> > > > > > 2.6.2 Manual.
> > > > > >
> > > > > > I would need to override a virtual
> > > MSWWindowProc()
> > > > > > method in a
> > > > > > wxWindow-derived class, says the FAQ?
> Then,
> > > "You
> > > > > > should then test if
> > > > > > nMsgparameter is the message you need to
> > > process and
> > > > > > perform the
> > > > > > necessary
> > > > > > action if it is or call the base class
> method
> > > > > > otherwise."
> > > > > >
> > > > > > It's that Data Acquisition card thing
> again,
> > > which
> > > > > > I'm trying to turn into a
> > > > > > pulse-frequency measurer...
> > > > > >
> > > > > > To quote:
> > > > > > Use the olDaMeasureFrequency function to
> > > specify the
> > > > > > duration
> > > > > > of the Windows timer (which has a
> resolution
> > > of 1
> > > > > > ms) and to
> > > > > > start the frequency measurement operation.
> > > (OK...)
> > > > > >
> > > > > > When the operation is complete, the
> > > > > > OLDA_WM_MEASURE_DONE message is generated.
> Use
> > > the
> > > > > > LongtoFreq (lParam) macro, described in
> the
> > > DataAcq
> > > > > > SDK
> > > > > > online help, to get the measured frequency
> > > value.
> > > > > >
> > > > > >
> > > > > > I'm OK with all the preceding steps... now
> I
> > > need to
> > > > > > catch this Windows
> > > > > > Message!
> > > > > >
> > > > >
> > > > >
> > > > > - - -
> > > > >
> > > > >
> > > > >
> > >
> >
>
__________________________________________________________
> > > > > Hitta din nästa resa på Yahoo! Shopping.
> > > > > Jämför pris på flygbiljetter och hotellrum
> här:
> > > > >
> > > > >
> > >
> >
> >
>
http://shopping.yahoo.se/b/a/c_169901_resor_biljetter.html?partnerId=96914052
> > > > >
> > > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > wx-users-unsubscribe at lists.wxwidgets.org
> > > > > For additional commands, e-mail:
> > > wx-users-help at lists.wxwidgets.org
> > > > >
> > > > >
> > > >
> > >
> >
> >
> > - - -
> >
> >
> >       Låt vårkänslorna spira!
> 
=== message truncated ===


- - -


      __________________________________________________________
Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. 
Sök och jämför hos Yahoo! Shopping.
http://shopping.yahoo.se/b/a/c_100015813_bredband.html?partnerId=96914325





More information about the wx-users mailing list