Problems CALL DLL

Post specialized setup scripts you have created here.
Rulan
Posts: 56
Joined: Tue Nov 20, 2012 5:02 am

Problems CALL DLL

Postby Rulan » Mon Jul 22, 2013 6:24 am

Hi,
we tried to use "Call DLL"...
The following sample shows a Test_"Call DLL" with an Error-message... What do we wrong??? using rundll32.exe it works...
Path for shell32 or with or without .dll extentsion has no positive effects...

DLL_Problem.png
DLL_Problem.png (69.68 KiB) Viewed 30553 times


Regards

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Problems CALL DLL

Postby FrancescoT » Mon Jul 22, 2013 9:00 am

Dear Rulan,

you are not passing any parameter with the called function and anyway, you should always enter the full library name + extension with the command.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Rulan
Posts: 56
Joined: Tue Nov 20, 2012 5:02 am

Re: Problems CALL DLL

Postby Rulan » Tue Jul 23, 2013 3:38 am

Dear Francesco,

as I described above, there is no difference between full path and extention:
Parameter??? There are no parameter needed!!!!
1) THis worked fine under command line or also as "run program" code. Please try it yourself :
~InstallAware Clipboard Data~
~Run Program~
~{D9364D97-3DCF-4499-A39E-9E23EE3EE4F8}~
~rundll32.exe ~
~FALSE~
~shell32,Control_RunDLL~
~FALSE~
~~

2) What do we wrong???? I read in this forum, that "call dll" worked similar like "rundll32.exe"???? Why is it impossible for us to get our example above running under "CALL DLL".
Our last try:
What can we do better? Can You give us an example, that works?
DLL_Problem_2.png
DLL_Problem_2.png (34.48 KiB) Viewed 30534 times

regards

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Problems CALL DLL

Postby FrancescoT » Tue Jul 23, 2013 9:59 am

Dear Rulan,

the “Control_RunDLL” is an undocumented WINAPI from the Shell32.dll which can be used to launch control panel applications.
This API requires at LEAST 4 parameters (... otherwise the function doesn't execute anything) as;

- HWND hwnd,
- HINSTANCE hinst,
- LPSTR lpszCmdLine,
- int nCmdShow

Could you please explain what do you want to do with the function?

PS
I didn't say that exist differences with calling the Shell32.dll using the full path to the library or just the library name.
I meant, you MUST USE AT LEAST the library name + extension with the Call Dll command (in your case Shell32.dll").

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Rulan
Posts: 56
Joined: Tue Nov 20, 2012 5:02 am

Re: Problems CALL DLL

Postby Rulan » Wed Jul 24, 2013 1:34 am

Dear Francesco,
as I can test, it works without parameters, but Francesco, that is not my problem. First, I only want to see "Call dll" running!!!!!

Please show me, what we had to do, getting a .dll function executing. Please use for example the parameters of Your choice, this would be very nice.

Background of our tests. Under WIX we are able to fire dll-functions within the setup. Our dll is able to excecute sql-statements. You now will say, that IA also can do this and that is right, but we had to save binary-data (a picture) from the client-side into an image-field of the sql-server and here is the problem. T_SQL only can do this, placing the file into the directory-structure from the server, where mssql exists... I tried using a variable to read the local image-file, in IA using "read from text file", and use this variable in sql-statements by executing IA's "MS SQL Server", but I believe the variable is not able to save/transport the binary input... :?: . Is this right?

OK.... Our chance, I see, is to get it running with "Call dll". The dll-Use is very complicated, using many parameters, so we only want to see an example, to look, how we had to manage the IA "call dll"...

It would be nice, if You could show us, how we could manage "call dll". Show us the working (!) shell32.dll example using "call dll" anyway, as You pleases using parameters of your choice.
...
Perhapps You have an other idea to get local binary code into an variable, which can be used to save the binary code into an image field of ms sqlserver per T-SQL-"INSERT"?

Regards

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Problems CALL DLL

Postby FrancescoT » Wed Jul 24, 2013 7:12 am

Dear Rulan,

please have a look at the attached sample which demonstrates how to call Control_RunDLL function.
NOTE!!
Please carefully read the code comments


By the way, you chose one of the most undocumented WINAPI to test the CALL DLL.
I may suggest you to do more practice with any other more documented WINAPI function.

With the following link is available another CALL DLL sample;
http://www.installaware.com/forum/viewtopic.php?f=2&t=8962

Of course you can't use an IA VARIABLE to hold a binary file contents.
I believe that currently the best approach is to do it with the help of an external DLL as you are doing.

Hope this helps you.

Regards
Attachments
CallDllSample.rar
(2.9 KiB) Downloaded 1303 times
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Rulan
Posts: 56
Joined: Tue Nov 20, 2012 5:02 am

Re: Problems CALL DLL

Postby Rulan » Wed Jul 24, 2013 8:59 am

Thanks Francesco,
something happend, but!!!!!!!!!

Here we are....

I put your example and the only thing I did was to define an return variable (SUCCESS) inside the call dll routine...
A Messagebox displayed the SUCCESS and now .... tatata...
DLL_Problem_3.png
DLL_Problem_3.png (21.33 KiB) Viewed 30516 times


And that I do not understand... :(
Regards

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Problems CALL DLL

Postby FrancescoT » Wed Jul 24, 2013 10:43 am

Dear Rulan,

you can't use a return value if the called WINAPI returns a VOID type.
You must follow the exact function types declaration.

By the way, how goes with my sample?

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Rulan
Posts: 56
Joined: Tue Nov 20, 2012 5:02 am

Re: Problems CALL DLL

Postby Rulan » Thu Jul 25, 2013 12:36 am

Dear Francesco,
excuse me, perhapps I have expressed myself incorrectly, but..

the error message above is Your Example!!!!!!!!!

regards

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Problems CALL DLL

Postby FrancescoT » Thu Jul 25, 2013 4:14 am

Dear Rulan,

I'm sure that works!

which IA version you used to try my sample?
Did you followed the code notes?

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Rulan
Posts: 56
Joined: Tue Nov 20, 2012 5:02 am

Re: Problems CALL DLL

Postby Rulan » Thu Jul 25, 2013 4:45 am

Dear Francesco,
Your right ... Example worked... :)

But I got it, why I had problems...
You have to explicit define the Return variable before call dll is used. IF not, You get this error above.
Sorry about that mistake...
regards

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Problems CALL DLL

Postby FrancescoT » Thu Jul 25, 2013 10:18 am

I'm happy you solved
... but anyway, it is not necessary to use a return variable with that function ... because it doesn't return a value.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Sample Scripts”

Who is online

Users browsing this forum: No registered users and 28 guests