Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX DLL and MsgBox

Status
Not open for further replies.

bobbyr

Programmer
Nov 30, 2000
66
0
0
US
I have an ActiveX DLL that I am calling from and ASP page. The ActiveX DLL code is one that is found on the web for being able to use the MsgBox function from within ASP. The code all works fine when I run a test Standard EXE from VB6, but the dll just hangs when it calls the GetMsgBox from ASP. All the properties get set without error. Any suggestions?

ActiveX DLL Code:
==========================

Option Explicit

Private internalMsgPrompt As String
Private internalMsgIcon As Integer
Private internalTitle As String
Private internalStyle As Integer

Public Property Let msgPrompt(ByVal pMsgPrompt As String)
internalMsgPrompt = pMsgPrompt
End Property

Public Property Let msgTitle(ByVal pMsgTitle As String)
internalTitle = pMsgTitle
End Property

Public Property Let msgStyle(ByVal pMsgStyle As String)
Select Case pMsgStyle
Case " "
internalStyle = vbOKOnly
Case 0
internalStyle = vbAbortRetryIgnore
Case 1
internalStyle = vbOKCancel
Case 2
internalStyle = vbOKOnly
Case 3
internalStyle = vbRetryCancel
Case 4
internalStyle = vbYesNo
Case 5
internalStyle = vbYesNoCancel
End Select
End Property

Public Property Let msgIcon(ByVal pMsgIcon As String)
Select Case pMsgIcon
Case 0
internalMsgIcon = vbCritical
Case 1
internalMsgIcon = vbInformation
Case 2
internalMsgIcon = vbQuestion
Case 3
internalMsgIcon = vbExclamation
End Select
End Property


Public Function getMsgBox() As VbMsgBoxResult
getMsgBox = MsgBox(internalMsgPrompt, internalMsgIcon + internalStyle, internalTitle)
End Function

ASP Code:
================================
dim x
dim msgresult
set x = server.createobject("netmsgboxlib.netmsgbox1")
x.msgtitle = "Hello"
x.msgprompt = "Propmt"
x.msgicon = 2
x.msgstyle = 1
msgresult = x.getmsgbox
if msgresult = vbyes then
response.write("You clicked yes")
else
response.write("You clicked no")
end if

Thanks,
Bobby
 
I can't say if this will work, but the first thing I would try is to have getMsgBox return a variant rather than a vbMsgBoxResult. I doubt that constant is defined in the client environment. Of course, it could recast it as a variant transparently, too, but maybe it doesn't.

Bob
 
Bobby,

Am going from memory here, but I believe that you cannot do a message box in ASP. If you wanted to do something like that, you would be better off using a JavaScript alert(). Hope this helps.

Everything is absolute. Everything else is relative.
 
Do you want the message box client or server side? When you say ASP that is server side. Why would you want a msgbox on the server? To boot IIS doesn't interact with the desktop so it will not show up (thus you get the hanging because it sits waiting for a responce.) VB DLLs should have the Unattended execution selected if they are not inprocess of a client application that is run on the desktop. This switch turns all msgbox statements in to application log entries and disables forms.

So I agian ask .... what are you trying to accomplish? Like as in WHY do you want to have a messagebox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top