[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SetWindowLong

Posted on 2002-03-21
2
Medium Priority
?
270 Views
Last Modified: 2008-02-01
Hellow experts...

In a cpp file almost the first line is this prototype.

LRESULT CALLBACK ShowPointWndProc(HWND, UINT, WPARAM, LPARAM);

Of course that function is defined at the bottom of the file.

The problem is this one.

In the InitDialog message (I am trying to subclass an item in the dialog) I am trying to:

WNDPROC OldAdd = SetWindowLong (hItemWnd, GWL_WNDPROC, (LONG)ShowPointWndProc);

This will never be compiled because the error is this.

DialogProcs.cpp(34) : error C2440: '=' : cannot convert from 'long' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'

I tried:

WNDPROC OldAdd = SetWindowLong (hItemWnd, GWL_WNDPROC, (LONG)&ShowPointWndProc);

WNDPROC OldAdd = SetWindowLong (hItemWnd, GWL_WNDPROC, (WNDPROC)&ShowPointWndProc);

But nothing works...

Please help me.

Thank you very much.





0
Comment
Question by:Marsc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 6885477
Make it read

WNDPROC OldAdd = (WNDPROC) SetWindowLong (hItemWnd, GWL_WNDPROC, (LONG)ShowPointWndProc);

'SetWindowLong()' returns a 'long', you'll have to typecast when storing it as a 'WNDPROC'...
0
 
LVL 1

Author Comment

by:Marsc
ID: 6886292
Problem solved :-)
Thank you very much...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

649 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