WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DllCall Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

So you want Special Commands w/ WB ?

Keywords:   dllcall

I'm not a expert but I can fake it!! ;~P Ever want to do something that Martin & Co. left out of WinBatch??

Build your own DLL to do what you want. You will need Delphi(i used D3 but D2 can do it) and yer thinking cap, delphi is kinda like VB.

Here's a demo dll, and the source code with the WinBatch script that calls the functions.

have fun!!
george

;rundlldemo.wbt 
;george springer 
;some stuff to work with
a = 2 
b = 5
c = 12
d = 8 


;call the dll, do your functions, close dll 
dllhandle=DllLoad("mnmxdll.DLL")
a1=DllCall(dllhandle, long:"Min", long:a, long:b)
a2=DllCall(dllhandle, long:"Max", long:c, long:d)
a3=DllCall(dllhandle, long:"Addup", long:c, long:d)
a4=DllCall(dllhandle, long:"Minus", long:a, long:c)
a5=DllCall(dllhandle, long:"Sqr", long:b)
DllFree(dllhandle)

;Show what your functions do
Message("MIN or MAX ","MIN: %a% or %b%? %a1%")
Message("MIN or MAX ","MAX: %c% or %d%? %a2%")
Message("Addup and Minus ","Addup: %c% + %d% = %a3%")
Message("Addup and Minus ","Minus: %a% - %c% = %a4%")
Message("Squared","Number: %b% %@crlf%Squared: %a5%")
;END rundlldemo
Now heres the dll source code, nothing fancy, but you do need to have the "stdcall" and the "exports" for WinBatch to be happy
library mnmxdll;
{ you make up your function to do what you want}
{a dll is really a program with a "library" heading 
instead of "program"}
uses
SysUtils,
Classes;

function Min(X, Y: Integer): Integer; stdcall;
begin
if X < Y then Min := X else Min := Y;
end;
function Max(X, Y: Integer): Integer; stdcall;
begin
if X > Y then Max := X else Max := Y;
end;
function Addup(X, Y: Integer): Integer; stdcall;
begin
Addup := X + Y ;
end;
function Minus(X, Y: Integer): Integer; stdcall;
begin
Minus := X - Y ;
end;
function Sqr(X : Integer): Integer; stdcall;
begin
Sqr := X * X ;
end;
{this is what sends WB the rezultz}
exports
Min,
Max,
Addup,
Minus,
Sqr;
begin
end. 

Article ID:   W12864
Filename:   DllCall Example from User.txt
File Created: 1999:04:15:16:50:10
Last Updated: 1999:04:15:16:50:10