PDA

View Full Version : custom dll



NewsArchive
03-09-2007, 03:50 AM
I have a sb4 install that uses a custom dll
I am trying to re-create the install in sb6, how do I call the custom dll
now?

--
Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com

NewsArchive
03-09-2007, 03:51 AM
There are a couple of example files that were included with SB5 - Call DLL
Demo1 and Call DLL Demo 2. And a folder called DLL Source Code.
Unfortunately, when I upgraded to SB6 the example files were not included so
I just copied the SB5 files across.
See if you have them.

Jane Fleming

NewsArchive
03-09-2007, 03:51 AM
Eric,

The examples pack includes some DLL examples:

http://www.lindersoft.com/sb6_Examples.exe

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
03-09-2007, 05:56 AM
I am missing something obvious
I cant get the dll to work

my code in my is very simple

i open a tps file, which has 1 record in it - its a date
I then check the date to see if they are eligible for an upgrade

If today() - bmd:regdate > = 366
message('You are not entitled to a free upgrade|')
POST(event:closewindow)
RETURN( 1 )
else
POST(event:closewindow)
end

I have the dll working great in sb 4 but cant get it to work properly in sb6


--
Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com

NewsArchive
03-09-2007, 05:57 AM
Eric,

I don't think you can simply use that DLL in SB6 because the old SB4 DLL
makes use of exported installer functions. The DLLs from SB4 do not work in
any other environment (Visual Studio, etc.).

Not so in SB6. You can now call any standard DLL. Very simple - just
create a DLL and call this from SB6 using CallDLL. You can use any of the
provided source code samples as a template. Then do whatever you have to do
with the return value (exit installer, run in trial version, etc.).

For example, use CallDLL to call into the following DLL:

MAP
VALIDATEDATE(*CSTRING),LONG,PASCAL
END

! -----------------------------------------------------------------------------
CODE
! -----------------------------------------------------------------------------

! Call Function
VALIDATEDATE FUNCTION(szSerialNumber)
CODE
! read bmd:regdate here

If today() - bmd:regdate > = 366
message('You are not entitled to a free upgrade|')
return 0
End
return 1

Then in your script, if return value is 0, abort the installer.

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
03-10-2007, 04:39 AM
Ok, I created my dll
i called the dll but it is not running
i am still missing something obvious

in my script I have the following for calldll

Library - %PROGRAMFILESDIR%\update.dll
Function - VALIDATEDATE
I did not fill in parameters or function type - wasnt sure what to put there



--
Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com

NewsArchive
03-10-2007, 04:40 AM
Eric,

Let us assume, you have the following Clarion function:

long TestFunc FUNCTION(*cstring, *cstring, *cstring, long)

Now you call the following in your program:

TestFunc()

Result: it will not run ;-)

I don't know what prototype you have in update.dll so I cannot tell you what
parameters to fill in.

What's your prototype for VALIDATEDATE?

BTW, do you really have to "install" update.dll? Or do you only need this
in your installer? If only the installer calls it, please do not install it
but add it as a support file.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
03-12-2007, 08:23 AM
I dont have to install the update.dll, i tried that because the dll wasnt
running
How does the dll know to run in the proper directory if it is listed as a
support file?
valudate date is

MAP
VALIDATEDATE(*CSTRING),LONG,PASCAL
END

--
Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com

NewsArchive
03-12-2007, 08:23 AM
Try using the Call DLL Function
On the 'library' line, put: %TMPDIR%\MyWhateverDLL.dll
On the 'function' line, put VALIDATEDATE
On the 'calling convention' line, put _stdcall
On the Parameter Types line, put *cstring
On the function parameters line, put in the name of a variable you want to
submit, or the string itself in double quotes

Check "Call DLL Function" in the documentation.

Jane Fleming

NewsArchive
03-12-2007, 08:23 AM
I do that and i get an error message on compile - too many actual paramters

Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com

NewsArchive
03-12-2007, 08:24 AM
Eric,

Exactly what Jane said.

So your Call DLL Function looks like that (see screenshot)?

Friedrich

NewsArchive
03-12-2007, 08:24 AM
Thank you guys!
I am getting closer
I can get the dll to run
couple of more questions...

How do I get it to run in the installation folder? Or do I need to set that
in the dll?
My dll returns a 0 if the user is not entitled to a free update and a 1 if
they are entitled

If the return value is a 0 I want to end the installation
I looked at the end command but the help file says to not use it
How should I exit the install if I return a 0?

OR is there a better way to do this?

My users are allowed free updates for 1 year from date of purchase
so my dll checks the date in the bmd file
if within 1 year I install the update
If not, they need to purchase a new update (which is a different install)
and I then change the date in the bmd file to the new purchase date

Thanks for all your help


--
Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com

NewsArchive
03-12-2007, 08:25 AM
Eric,

Why do you need it in your "installation folder"? In a previous post you
said: "I don't have to install the update.dll". But if you need it in your
installation folder, then you *have* to install it, right? Why not point
your DLL to the installation folder? Just pass the installation folder to
the DLL and you are done.

For example:

MAP
VALIDATEDATE(*CSTRING, *CSTRING),LONG,PASCAL
END

The second parameter is the installation folder in this case.

BTW, you can use the following to exit the installation:

If %_SB_RETURN% Equals "0" Then
Exit Installation
End

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
03-12-2007, 08:25 AM
GOT IT!
Thank you!
Having not worked with functions before, it was confusing - got it all
straightened out now and it is working the way I want it to

--
Eric Jacobowitz
www.castlecomputer.com
www.cctsoftware.com