[comp.windows.ms.programmer] Use of MakeProcInstance with BC++, Question.

cadsi@ccad.uiowa.edu (CADSI) (04/24/91)

From article <1991Apr24.003535.26852@milton.u.washington.edu>, by water@milton.u.washington.edu (Hong Li):
> Hi, I am migrating one program from MS-C to BC++.  I encounted a problem and
> ran out of gas in searching the menu.  Could someone help me? Thanks a lot.
> 
> Problem:
> I declared a user function as
> 
> 	BOOL FAR PASCAL MyProc(..omitted)
> 	{
> 		...
> 	}
> 
> Now I want to make a call
> 
> 	lpMyProc = MakeProcInstance(MyProc, hInstance);
> 
> With MS-C 5.1, it works fine.  But BC++ complained an error: type mismatch in
> MakeProcInstance.  I have tried casting, but failed.
> 
> What can I do?  Has anyone encounted similar problem?

 	lpMyProc = MakeProcInstance((FARPROC)MyProc, hInstance);

This works, I do it all over.  The other thing to do is compile things
without C++ (which performs name-mangling which is causing your problem).

|----------------------------------------------------------------------------|
|Tom Hite					|  The views expressed by me |
|Manager, Product development			|  are mine, not necessarily |
|CADSI (Computer Aided Design Software Inc.	|  the views of CADSI.       |
|----------------------------------------------------------------------------|