Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>dll commands</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DLL Commands
--------------------------------------------------------------------------------

 Defining a external DLL     DLL [STATIC] FUNCTION <FunName>( ;
 function to be called          [ <Param1> AS <Type> ] ;
 at RunTime                     [ <ParamN> AS <Type> ] ) ;
                             AS <return> [PASCAL] LIB <DllName>

 FiveWin lets you declare an external DLL function to be called at RunTime
 by its own name! See DllCall.prg example.

 <FuncName>      The name of the DLL function. Remember Clipper only uses
                 10 characters maximum length.

 <Param1>        Name of a parameter.

                                                      Length in bytes
 <Type>,         BYTE, CHAR                                  1
 <return>        WORD, BOOL, HANDLE, HWND, HDC               2
                 LONG, STRING, LPSTR, PTR                    4
                 DOUBLE                                      8

 <DllName>       Name of the DLL.

 We recommend to develop a C language based connection functions when you
 are going to develop an intensively work with some DLLs. See "using
 Windows API". Examples:

 Calling SndPlaySound() at RunTime:

 #include "FiveWin.ch"

 function Main()

    SndPlaySound( "tada.wav", 0 )

 return

 DLL FUNCTION SndPlaySound( cFile AS LPSTR, nType AS WORD ) AS BOOL ;
                            PASCAL LIB "MMSYSTEM.DLL"


 Designing the same DLL connection using C language:

#include <WinTen.h>
#include <Windows.h>
#include <MMSystem.h>
#include <ClipApi.h>

//----------------------------------------------------------------------------//

CLIPPER SNDPLAYSOU()   // ND()
{
   _retl( sndPlaySound( _parc( 1 ), _parni( 2 ) ) );
}

//----------------------------------------------------------------------------//

In this situation it is necessary to use a specific LIB so the linker will
know how the DLL connection must be done at RunTime. Example:

      TEST.DLL                // Is a commercial DLL we are going to use

      IMPDEF.EXE TEST.DEF TEST.DLL    // IMPDEF.EXE is a tool Microsoft and
                                      // Borland provides

      Now, edit TEST.DEF -which it is an ascii file- and rename the symbols
      with 10 characters or less with an underscore:

      LESS10   --->   _LESS10

      Then do:

      IMPLIB.EXE TEST.LIB TEST.DEF

      When linking use that .LIB !

 Review our \WinApi directory C -only registered users- source code to see a
 lot of examples of doing this.

 Warning: SndPlaySound() is already built inside FiveWin.lib. It has been
 used just in this example for learning purposes.


See Also: DLL.ch Creating your own

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson