Quantcast DLL - a Delphi Ex with Vmath.dll (Small Steps) - digitalFAQ.com Forums [Archives]
02-08-2003, 11:09 PM
vhelp vhelp is offline
Free Member
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
I thought of opening up the Delphi area w/ a discussion on DLL
coding, since I (and others) have a dream of writing their own
DLL functions for AVIsynth and other apps that accepts DLL's.
As you all know, currently, there exist NO method of feeding
a Delphi create DLL into AVIsynth to date, though there are
some that are forging ahead (myself included) in an attempt to
end that void.

Below, is a demonstration (a small step) in an effort to try
and share what little knowledge I have in DLL development.
This is basically an excercise of porting a DLL into other
Programming enviornments. An attempt to see weather or not other
languages can access the DLL's function. I hope you Delphi,
Visual Basic and C/C++ peoples can use the two Functions
in your testing stages. This DLL works w/out any trouble under
Delphi 6.

Min(1,5) = 1
Max(7,2) = 7

be sure to install the vmath.dll file somewhere in an easy to
get to place, like your D:\ drive. In my code (see below) I
used my D:\ directory for easy (less typing) managing, since
I'm always working on them, it was worth the trouble of porting
into the Library area of Delphi. And, if the real world (myself
anyways) I'm always defaulting my files ie, *.DLL to my closest
director for quick access.

.. code sample for Delphi, ..VB and C/C++ can follow w/ their own
syntax ..


{$R *.dfm}

function Min(x,y: integer): integer; external 'd:\vmath.dll';
function Max(x,y: integer): integer; external 'd:\vmath.dll';
procedure TForm1.Button1Click(Sender: TObject);
 . // use your Min(x,y) and Max(x,y) functions can go here..
 . // substitue the x,y w/ values or use an edit control as in
 . // my demo app above.
Download: vmath.dll

Using these math functions shouldn't be too difficult to set up in
your platform ( Delphi/VB/C/C++ ) The outcome is to have the two
Functions Min() and Max() choose their required ranged values ie,
Min() will search for the Lowest value in it's x,y and record it.
Max() will search for the Highest value in it's x,y and record it.
That's about it for their purposes, but the real purpose of this
excercise is to see if your able to import the DLL into your language.
Remember, small steps.

Well, check it out. Fool around a little w/ how parameter passing
is done. For those C/C++ coders, (w/out testing) I think that this
DLL should work if you are observant about the param passing law w/
Pascal - some domb sh_t like that.

If you have any problems geting them to work, I will try and make
whatever effort I can to get you up and working w/ this DLL. So,
if you'd like to participate, feel free to do so.

I have some other ideas and excercises, but this is enough for now.
Thanks for your participation.. oh, and feel free to join in on any
ideas you may have of your own too. ok, and have a good evening all.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
02-09-2003, 12:28 AM
vhelp vhelp is offline
Free Member
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry peoples, forum seems to be having problems w/ images all the sudden. Also, forgot to upload the DLL sample for you's to try, so again:

Download: vmath.dll

Download: 37.(dll).sample.05.exe

As I was saying, try you hand at the vmath.dll under your
compiler. Have fun.
Reply With Quote
02-10-2003, 12:54 AM
vhelp vhelp is offline
Free Member
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Hello everyone.

Below, is an included VBA version (Visual Basic should work too)
I didn't realize that my previous vmath.dll would not work w/ VBA
or VB for that matter. Sorry for the grief. To make up for this,
I have included the source code for VBA (MS Access version)
I do not have Visual Basic, though I do have VB version 3, it's
actually 16bit version. I didn't think it worth it, being that we
are all 32bit ready. And, based on my understanding, Office 97's
VBA is 32bit ready. So, I went with this approach, and it's not
such a bad idea after all. I can now test VB against my Delphi

Ok, so here is the code snipplet as well as the VBA app for MS Access.
Play around with it to get an understanding of how it works.
Remember, these functions are not included w/ VBA, hence my "v" behind
the funcitons ie, vMin etc.

Enter this in your Form1's Class:

Option Compare Database
Option Explicit

Dim x As TextBox

Private Sub Min_Click()
  Min.Caption = "Min ( " & vMin(Text1, Text2) & " )"
  Text3 = Min.Caption
End Sub

Private Sub Max_Click()
  Max.Caption = "Max ( " & vMax(Text1, Text2) & " )"
  Text3 = Max.Caption
End Sub

Remember to substitute the drive/directory locatoins ie, "d:\vmath.dll"
with where ever you put the vmath.dll at.

Then, enter this in your Module:
Option Compare Database
Option Explicit

Public Declare Function vMin Lib "d:\vmath.dll" (ByVal x As _
 Integer, ByVal y As Integer) As Integer
Public Declare Function vMax Lib "d:\vmath.dll" (ByVal x As _
 Integer, ByVal y As Integer) As Integer

An Office 97 (MS Access) version w/ modified vmath.dll:
Download: vmin-vmax.rar

* don't mix the vmath.dll w/ the previous one I posted. The
previous one will work w/ Delphi as is. It's only the newer one I
just posted on this thread, which is the one modified to work with
* The MS Access version (since I chose not to install VB 3.0) just
demonstrates the usage in this enviornment. I'm gonna assume that
VB users will be able to use code above w/ modified DLL (above) w/ out
any issues. So, even if you don't have Delphi, but most probably
Office 97 or higher, you should be able to try out this Excercise
anyways (if not, for curiousity purposes)
* I could have changed the newer DLL version name, but that would of
ment for me to change all the source codes, and the VBA as well. So,
at best, I thought to *.RAR the file, and then you could just copy
THAT DLL file to ANOTHER location on your hard drive (so not to
confuse yourself or the app)

Remember, all this, in reference to trying to find/devise a way to
develop DLL's for use w/ AVIsynth (even vdub, if possible) and other
apps too, but more important, AVIsynth. I've learned, that nothing
is impossible, as long as you believe so, else, in some experiences,
..the opposite. But, I'm hoping to spir up sparks in some of yous,
that have programming (hacking) experience. It doesn't have to be
perfect either. ..can be a wrapper DLL or something. Ok, enough said.

VB: Visual Basic
VBA: Office 97's MS Access

That should be it, for you VB/VBA users
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delphi: Pascal conversion of avisynth_c.h GFR Avisynth Scripting 6 09-16-2005 12:46 PM
Making a Delphi GUI need some help Zyphon Avisynth Scripting 8 07-06-2004 02:05 AM
Delphi command to control another application? GFR Avisynth Scripting 6 01-26-2004 07:14 AM
Delphi: PicSwitch v1.0.4 (beta) vhelp Avisynth Scripting 11 03-11-2003 10:41 PM
Automated file prediction written in Delphi black prince Avisynth Scripting 0 02-24-2003 11:52 PM

Thread Tools

All times are GMT -5. The time now is 02:18 AM  —  vBulletin Jelsoft Enterprises Ltd