Page 1 of 1

How to use .dll file

Posted: Wed Jul 08, 2009 6:04 pm
by sudip
Hi All,
I want to convert some of my old VFP routines into HMG. I am facing problem regarding some functions for barcode printing. For that perticular barcode printer, I need to use .dll files. But I don't know how to convert following code (with .dll file):

Code: Select all

local i, j, mRecno, mBarcode, lFstCol, nCopyno, mColctr, mGrndtStr, mLookupStr, mFinalStr, mRowCtr, ;
	mBarcode1, mBarcode2

declare openport in C:\ajanta\tsclib.dll  string
declare closeport in C:\ajanta\tsclib.dll
declare sendcommand in C:\ajanta\tsclib.dll 
declare setup in C:\ajanta\tsclib.dll  string,string,string,string,string,string,string
declare downloadpcx in C:\ajanta\tsclib.dll  string, string
declare barcode in C:\ajanta\tsclib.dll  string,string,string,string,string,string,string,string,string
declare printerfont in C:\ajanta\tsclib.dll  string,string,string,string,string,string,string
declare clearbuffer in C:\ajanta\tsclib.dll
declare printlabel in C:\ajanta\tsclib.dll  string,string
declare formfeed in C:\ajanta\tsclib.dll 
declare nobackfeed in C:\ajanta\tsclib.dll
declare windowsfont in C:\ajanta\tsclib.dll  integer,integer,integer,integer,integer,integer,string,string 
Thanks in advance.

With best regards.

Sudip

Re: How to use .dll file

Posted: Wed Jul 08, 2009 6:22 pm
by sudip
Should I use

CallDll32 ( <cFunctionName> , <cDllName> , ... <parameters> ... ) --> xReturnValue

I am trying with it.

Regards.

Sudip

Re: How to use .dll file

Posted: Wed Jul 08, 2009 6:30 pm
by Rathinagiri
I think you can use calldll32 function. This is from c:\hmg\samples\dll\demo.prg series.

Code: Select all

CallDll32 ( "sndPlaySoundA" , "WINMM.DLL" ,  "sample.wav" , 0 )
CallDll32 ( "GetWindowText" , "USER32.DLL" , GetFormHandle ('Win_1') , @Buffer , 128 )
So, you can call like the below:

calldll32("openport","tsclib.dll",string)

Re: How to use .dll file

Posted: Thu Jul 09, 2009 3:47 am
by sudip
Hello,
I wrote:

Code: Select all

CallDll32("openport", "tsclib.dll", "TSC TTP-245")
And it works. :) Thanks a lot.
Now, is there any way to create a library from .dll file, so that we don't have to send .dll file separately. (may be I am asking for a silly question :lol: )
With best regards.
Sudip