How to use a external DLL ?

Blitz3D Forums/Blitz3D Programming/How to use a external DLL ?

Gabriele(Posted 2010) [#1]
I need make a program that use external Dll for a Token access whit USB key
I think i use this USB key:
http://www.matrixlock.de/english/index.htm
and in download section you can see the Dll an Decl whit some example in C,Vb,Java

i dont want install Vb, so i want try use this Dll from Blitz3D if possible

Any hints?...or little example code?

Ty all and sorry for bad english

Gabry
many works in progress whit B3d...this is a little video
http://www.youtube.com/watch?v=j__ztOPwuM0


Danny(Posted 2010) [#2]
Sorry can't help with the dll business.

But you might want to check out B3DProtector from Kev.
As far as I know it hasn't been cracked yet, and won't require any hardware.

http://www.whitegatesoftware.com/pages/products/blitz3d-protector.php

D.


Gabriele(Posted 2010) [#3]
Ty, but i dont need protect the Blitz executable (i have already found a good protection), but i need make a program that need use hardware Usb key...so i need use the Dll made from the house.

If no more hints incoming i need use Vb6


Charrua(Posted 2010) [#4]
hi!
to get access to a dll you have to write a file with extension .decls that will reside in the \userlibs forlder of your Blitz3D instalation (normally in C:\Program Files\Blitz3D\Userlibs). See the UserLibs.txt inside this folder. Basically you Declare the lib (dll wich the function is inside), many functions and the params they receive. As simply as it sound, if the declaration is correct and the data types are suported by blitz3d.
light
Once you have the .decls correctly written then you can use the functions in blitz, they highlight on the editor also!

normally some help is needed to translate a VB, C, declaration to Blitz3D at the beggining so, post again.

best regards
I saluti!

and sorry for my enblish too!
Juan


Floyd(Posted 2010) [#5]
You can find the details of working with DLLs here.

It shows how to make a DLL and use it with Blitz. A DLL like the Matrixlock one may not be directly usable.


Gabriele(Posted 2010) [#6]
If you download Matrix software/drivers you found in Matrix/Dll/h this file .h ....can transform this file .h in Blitz .decls?

/*****************************************************************************/
/* MXAPI.H MS-WINDOWS Win32 & Win64 (95/98/NT/2K/XP/XP64) */
/* */
/* (C) TDi GmbH */
/* */
/* Include File for Visual C/C++ (32- and 64-Bit) */
/*****************************************************************************/
#ifndef _MATRIXAPI_H
#define _MATRIXAPI_H

#include "mxtypes.h" // platform independent data types

#define IW_DRIVER 1
#define IW_NODRIVER 2

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
_mxINT16 LPT_Nr;
_mxINT16 LPT_Adr;
_mxINT16 DNG_Cnt;
} DNGINFO;

_mxINT16 __stdcall Init_MatrixAPI(void);
_mxINT16 __stdcall Release_MatrixAPI(void);
_mxINT32 __stdcall GetVersionAPI(void);
_mxINT32 __stdcall GetVersionDRV(void);
_mxINT32 __stdcall GetVersionDRV_USB(void);
void __stdcall SetW95Access(_mxINT16);
_mxINT16 __stdcall GetPortAdr(_mxINT16);
_mxINT16 __stdcall Dongle_WriteData(_mxINT32, _mxINT32*, _mxINT16, _mxINT16, _mxINT16);
_mxINT16 __stdcall Dongle_WriteDataEx(_mxINT32, _mxINT32*, _mxINT16, _mxINT16, _mxINT16, _mxINT16);
_mxINT16 __stdcall Dongle_ReadData(_mxINT32, _mxINT32*, _mxINT16, _mxINT16, _mxINT16);
_mxINT16 __stdcall Dongle_ReadDataEx(_mxINT32, _mxINT32*, _mxINT16, _mxINT16, _mxINT16, _mxINT16);
_mxINT32 __stdcall Dongle_ReadSerNr(_mxINT32, _mxINT16, _mxINT16);
_mxINT16 __stdcall Dongle_Exit(void);
_mxINT16 __stdcall Dongle_Find(void);
_mxINT16 __stdcall Dongle_FindEx(DNGINFO *);
_mxINT32 __stdcall Dongle_Version(_mxINT16, _mxINT16);
_mxINT32 __stdcall Dongle_Model(_mxINT16, _mxINT16);
_mxINT16 __stdcall Dongle_MemSize(_mxINT16, _mxINT16);
_mxINT16 __stdcall Dongle_Count(_mxINT16);
_mxINT16 __stdcall PausePrinterActivity(void);
_mxINT16 __stdcall ResumePrinterActivity(void);
_mxINT16 __stdcall SetConfig_MatrixNet(_mxINT16, char*);
_mxINT16 __stdcall LogIn_MatrixNet(_mxINT32, _mxINT16, _mxINT16);
_mxINT16 __stdcall LogOut_MatrixNet(_mxINT32, _mxINT16, _mxINT16);
_mxINT32 __stdcall GetConfig_MatrixNet(_mxINT16 Category);

_mxINT16 __stdcall Dongle_WriteKey(_mxINT32 UserCode,
_mxINT32 *KeyData,
_mxINT16 DongleNr,
_mxINT16 PortNr);

_mxINT16 __stdcall Dongle_GetKeyFlag(_mxINT32 UserCode, _mxINT16 DongleNr, _mxINT16 PortNr);

_mxINT16 __stdcall Dongle_EncryptData(_mxINT32 UserCode, _mxINT32 *DataBlock, _mxINT16 DongleNr, _mxINT16 PortNr);
_mxINT16 __stdcall Dongle_DecryptData(_mxINT32 UserCode, _mxINT32 *DataBlock, _mxINT16 DongleNr, _mxINT16 PortNr);

_mxINT16 __stdcall Dongle_SetDriverFlag(_mxINT32 UserCode, _mxINT16 DriverFlag, _mxINT16 DongleNr, _mxINT16 PortNr);
_mxINT16 __stdcall Dongle_GetDriverFlag(_mxINT32 UserCode, _mxINT16 DongleNr, _mxINT16 PortNr);


#ifdef __cplusplus
}
#endif

#endif // _MATRIXAPI_H