PRODUCT : C++ NUMBER : 866 VERSION : All OS : WIN DATE : October 19, 1993 PAGE : 1/1 TITLE : Using The Windows API Function MakeProcInstance I keep getting a type mismatch error from the compiler when I pass my function pointer to MakeProcInstance, and a type mismatch error when I assign my function's return value to another function pointer. Why? Unless two functions take the same parameters, they are considered to be of different types. Thus, if I declare a DlgProc like so: int FAR PASCAL _export DlgProc(HWND, WORD, WORD, DWORD); I will get a type mismatch when I do: MakeProcInstance(DlgProc, hInstance); because MakeProcInstance expects a FARPROC for its first parameter, which is declared to be a typedef int (FAR PASCAL *FARPROC)(); To suppress this error, do this: MakeProcInstance((FARPROC)DlgProc, hInstance); That is typecast the function pointer you're passing to MakeProcInstance to be the type it expects. Similarly, since MakeProcInstance returns a FARPROC, you will get an error if you assign its return value into other than a FARPROC. You would need to either make the variable your assigning MakeProcInstance's return value into a FARPROC, or typecast the return value to the type of your variable. DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.