🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2681

SetTimer in TForm descedant

#2681
From: Alex Liu
Date: Thu, 01 Feb 2007 03:09
38 lines
1992 bytes
Hi,

I would like to implement SetTimer() in TForm which will update some 
controls in the form.
I try to write like this but fail:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
SetTimer(Handle, 1, 500, (TIMERPROC)(TimerFcn));
}
//---------------------------------------------------------------------------

TIMERPROC TForm1::TimerFcn(    HWND hwnd, // handle of window for timer 
messages
    UINT uMsg, // WM_TIMER message
    UINT idEvent, // timer identifier
    DWORD dwTime  // current system time
   )
{
    // update control such as captions
}

in header file:
private: // User declarations
TIMERPROC TimerFcn(    HWND hwnd,     UINT uMsg,     UINT idEvent,     DWORD 
dwTime);


when i compile it shows "E2235 member function must be called or its address 
taken"
if i remove the TimerFcn declaration in TForm1 (i.e. TIMERPROC 
TimerFcn(...), i can pass compilation but  cannot access the controls.

what should i do?

Thanks in advance.

Alex 
Technical Details
Message-ID: <45c159aa@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!syros.belnet.be!news.belnet.be!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,68809160c683a9df,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Alex Liu" <alexliu@hket.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: SetTimer in TForm descedant
Date: Thu, 1 Feb 2007 11:09:23 +0800
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 218.189.206.62
Message-ID: <45c159aa@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170299306 218.189.206.62 (31 Jan 2007 19:08:26 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!syros.belnet.be!news.belnet.be!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail