Solved

VC++ Error C2642

Posted on 1997-05-02
5
228 Views
Last Modified: 2010-04-10
I'm using MSVC++ V1.52
Trying to set up a simple 1 sec timer.

On the line "ON_WM_TIMER()", which the tool inserted,
I get the following compile error:

"error C2642: cast to pointer to member must be from related pointer to member"

This works OK in another class, but not this one.

Thanks,

MrKerry@aol.com
0
Comment
Question by:mrkerry
5 Comments
 
LVL 4

Expert Comment

by:AVaulin
ID: 1163221
Are you sure that your class delivered from CWnd class?
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1163222
Please post the source code that was generated (header and cpp).

Post as a comment to here and/or direct to me at Roger_Onslow@compsys.com.au
0
 
LVL 1

Accepted Solution

by:
TKII earned 100 total points
ID: 1163223
I believe you are trying to use a timer in a class not derived from CWnd. Such a class is for instance CDocument. You should use the associated view-class for your timer or the MainFrame CMainFrame. You should use the classwizzard to add the generic handler and message-map-entries for the WM_TIMER-message.
0
 

Author Comment

by:mrkerry
ID: 1163224
Thanks...your answer was right on. I don't know how to grade but you get an A.
0
 
LVL 1

Expert Comment

by:TKII
ID: 1163225
Thanks, your welcome.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question