Re: Problem with C++ function

  • From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 29 Aug 2009 10:28:03 -0600

this has worked for me in the past. what is your proc defined as? should just 
be able to give it the address of the proc (if the procedure is already 
defined).

  ----- Original Message ----- 
  From: Ian D. Nichols 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Saturday, August 29, 2009 10:13 AM
  Subject: Problem with C++ function


  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: