Problem with C++ function

  • From: "Ian D. Nichols" <inich@xxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 29 Aug 2009 12:13:07 -0400

Hi Listers,

    I am trying to superimpose a RichEdit control onto the main program window 
and cannot get a call to the SetWindowLong function to compile properly.  I am 
following an assembler example that assembles and works flawlessly, but keep 
getting an error with the C++ version of it.

This assembles without error:

invoke SetWindowLong, hRichEd, GWL_WNDPROC, hEditProc

This is the C++ version:

SetWindowLong (hRichEd, GWL_WNDPROC, hEditProc);

According to a reference of Windows APIs, the 3rd parameter is of type long and 
is the procedure that handles keystrokes sent to the rich edit control.  If I 
don't cast it the compiler complains that it cannot convert void to int.  If I 
cast it to (long), the compiler complains that it cannot convert long to long 
(__stdcall *)(HWND__ *,unsigned int, unsigned int,long)

I don't understand the meaning of the parameter list in this error message.  
Could this be a bug in the Borland compiler version 5.4, or am I just not 
spotting something that's wrong.

Thanks in advance.

Ian

Ian D. Nichols,
Toronto, Canada

Other related posts: