Navigation:  Tutorial >

The ot4xb DLL IMPORT commands

Previous pageReturn to chapter overviewNext page

The command @<dll>:<func>(<params...>) based on nFpCall() and the functions nFpCall(), ndFpCall() and  qwFpCall() are very fast and suitable for calling DLL functions on the fly without the need to do any previous wrapper for the called DLL functions. With this method of calling DLL functions the required prototype is determined from the type and the form of the provided parameters. The NIL value will act as a modifier to the next param, this mean that you will take care of the default  NIL values that came from call of your Xbase++ function.

 

To solve this trouble ot4xb provide a special function called FpQCall() where the parameters and the return value of the DLL function are stored inside a prototype, so values provided in different formats, and even default NIL values will be interpreted in the correct way.

 

To make easy the prototype definition of the DLL functions ot4xb.ch include a set of commands and definitions  in some flavours to adapt to the different possible scenarios.

 

See some samples of prototype definitions

 

DLL USER32 IMPORT PeekMessage AS BOOL ;

    PARAM pMsg    AS POINTER32 ,;

    PARAM hWnd    AS HWND      ,;

    PARAM nMsgMin AS UINT      ,;

    PARAM nMsgMax AS UINT      ,;

    PARAM nRemove AS UINT       ;

SYMBOL PeekMessageA

 

DLL USER32 IMPORT CreateWindowEx AS HWND ;

    PARAM dwStyleEx   AS DWORD     ,;

    PARAM cClassName  AS LPSTR     ,;

    PARAM cCaption    AS LPSTR     ,;

    PARAM dwStyle     AS DWORD     ,;

    PARAM x           AS int       ,;

    PARAM y           AS int       ,;

    PARAM cx          AS int       ,;

    PARAM cy          AS int       ,;

    PARAM hWndParent  AS HWND      ,;

    PARAM hMenu       AS HANDLE    ,;

    PARAM hInstance   AS HANDLE    ,;

    PARAM lp          AS POINTER32  ;

    DEFAULT hInstance := AppInstance() ;

SYMBOL  CreateWindowExA

 

DLL USER32 IMPORT BOOL DdeUninitialize( DWORD dwIdInst )

 

DLL USER32 IMPORT HSZ   DdeCreateStringHandle(DWORD idInst,;

      LPSTR psz,int iCodePage) SYMBOL DdeCreateStringHandleA

 

 

After declare the prototypes you can use them just like another Xbase++ function

 

if PeekMessage(oMsg,oWnd,0,0,PM_REMOVE)

   ....