Archive: DLL response on MessageBox


DLL response on MessageBox
Hi!
I work on 3D ActiveDesktop application during 4 weeks and i comme back with an other farfelous question.
How to put a dll response from RegDll or CallInstDll on a message box ?

Thinks for your help

cooladn


Depends on what you want to do.
For CallInstDll, do after this call: Pop $0
This captures the output of the Dll for example when using InstOpts. Other methods could be used, suc as setting user variables, see ExDll.

Is this helping, is this what you want to do?

Good luck,
-Hendri.


hi Hendri

i write this code but i only obtain the temp address.
Is there an error on my code ?

Section ""
StrCpy $1 $TEMP\Project1.dll
File /oname=$1 Project1.dll
CallInstDLL $1 RegPathWinCurrentVersion()
Pop $1
MessageBox MB_OK|MB_ICONEXCLAMATION $1
Delete $1
SectionEnd


Again, depends on what "project1.dll" does. If if does not put something on the stack, of course Pop $1 does not give the desired result! Check ExDll in the local NSIS dir how to create a communication with NSIS.

Good luck,
-Hendri.


the source
i rewrite my nsis code

Section ""
StrCpy $1 $TEMP\Project1.dll
File /oname=$1 Project1.dll
CallInstDLL $1 RegKeyExists()
Pop $1
MessageBox MB_OK|MB_ICONEXCLAMATION $1
Delete $1
SectionEnd


this is my Project1.dll
Maybe i forget to write the ligne that return the data
but i don't know where i'm supposed to put it

Do you have an idea ?
For the moment, i've the message "Could not find symbol RegKeyExists"

Function RegKeyExists()
Set oShell = CreateObject("WScript.Shell")
For i = 0 To 10
RegKeyExists = True
sRegKey = Trim("HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\" & i & "\")

On Error Resume Next
'test if exist
'if not, there an error and the invalid repertory is detected
RegReadReturn = oShell.RegRead(sRegKey & "FriendlyName")
If Err Then
RegKeyExists = i 'data to return
Err.Clear
Exit For
End If
Next
End Function


When calling CallInstDLL, don't use () after the function name...

-Justin


You can use GetTempFileName instead of StrCpy $1 $TEMP\Project1.dll. GetTempFileName will make sure you don't overwrite any file.


Hi everybody!

i come back with my stupid problem

my dll work very well, when i call it on a vb program, but when i make it on, and then calling on my nsis install program, it say me: "Could not load"
Why ?

this is the nsis code:
Section ""
SetOutPath $INSTDIR
File /oname=$1 RegKeyExists.dll
SectionEnd

Function .onInstSuccess
CallInstDLL $1 RegKeyExists
Pop $1
MessageBox MB_OK|MB_ICONEXCLAMATION $1
Delete $1
FunctionEnd




this is the dll code:
Function RegKeyExists() As String
Set oShell = CreateObject("WScript.Shell")
For i = 0 To 10
RegKeyExists = True
sRegKey = Trim("HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\" & i & "\")

On Error Resume Next
RegReadReturn = oShell.RegRead(sRegKey & "FriendlyName")
If Err Then
RegKeyExists = i
Err.Clear
Exit For
End If
Next
End Function


I don't know why it doesn't load but there two problems in it. What is $1? You have forgot to put GetTempFileName $1...
You pop the answer into $1, the variable that is supposed to hold the DLL temp name. Then you try to delete it! You should delete the DLL, not the DLL's response.


well, i'm lost
i've write this code, but it doesn't work

Section ""
GetTempFileName $1
File /oname=$1 RegKeyExists.dll
SectionEnd

Function .onInstSuccess
CallInstDLL $1 RegKeyExists
Pop $1
MessageBox MB_OK|MB_ICONEXCLAMATION $1
FunctionEnd



could you write the correct section, please


I tested it, there's nothing wrong with the NSIS code.

So the problem should be in your dll.

Try to find out the problem there. I guess you are far more experienced with vb than me, so I cannot help there.

BTW, you pop $1. Are you sure the dll puts the right string on stack? (Hey, I don't know vb...)

-Hendri.


It's my fault, sorry
Hi!
you're rigth, the code wasn't incorrect.
As i'm a stupid boy, i don't read a part of VB book appendice, that say Active DLL made with VB are not DLL as we know.
It's only the possibilit to stock functions in external files, not a true DLL written in C.

Thinks to all people that have search and try to help me.


Ok, good luck translating the thing into C or Pascal (Delphi).

-Hendri.