MakeProcInstance

2.x

  FARPROC MakeProcInstance(lpProc, hinst)    
  FARPROC lpProc; /* address of function, */  
  HINSTANCE hinst; /* instance to bind to function */

The MakeProcInstance function returns the address of the prolog code for an exported function. The prolog code binds an instance data segment to an exported function. When the function is called, it has access to variables and data in that instance data segment.

Parameters

lpProc

Specifies the address of an exported function.

hinst

Identifies the instance associated with the desired data segment.

Return Value

The return value points to the prolog code for the specified exported function, if MakeProcInstance is successful. Otherwise, it is NULL.

Comments

The MakeProcInstance function is used to retrieve a calling address for a function that must be called by Windows, such as an About procedure. This function must be used only to access functions from instances of the current module. If the address specified in the lpProc parameter identifies a procedure in a dynamic-link library, MakeProcInstance returns the same address specified in lpProc.

After MakeProcInstance has been called for a particular function, all calls to that function should be made through the retrieved address.

The FreeProcInstance function frees the function from the data segment bound to it by the MakeProcInstance function.

MakeProcInstance will create more than one procedure instance. To avoid wasting memory, an application should not call MakeProcInstance more than once using the same function and instance handle.

See Also

FreeProcInstance, GetProcAddress