Write String to ASP from ActiveX DLL Component 
Author Message
 Write String to ASP from ActiveX DLL Component

I am sending a string from an asp page to a DLL via but can't get the
results back to the asp page. Any help would be appreciated.

<%
strMemo="ABC"
Set objMsg = Server.CreateObject("FAObjects.WriteMessage")
Dim WriteIt
WriteIt = objMsg.Msg(strMemo)
set objMsg = Nothing
Response.write WriteIt
%>

The CLS file contains

Option Explicit
Public Server As Object
Public Request As Object
Public Application As Object
Public Session As Object
Public Response As Object
Public ASPsc As ObjectContext
Public Function Msg(ByVal strMemo As String) As Long
strMemo = Replace(strMemo, "A", "Z")
Msg = strMemo
End Function



Fri, 16 Jan 2004 01:24:59 GMT  
 Write String to ASP from ActiveX DLL Component
No wonder...

You declare Msg() to return a Long!
Then you assign a String as the return-value
to a method you just declared to be Long???

And BTW... don't use the input param-var as
a local working variable, it's *very bad* coding
practice... :-)

Try this:

Public Function Msg(ByVal strMemo As String) As String

    Dim sRetVal As String
    sRetVal = Replace(strMemo, "A", "Z")

    Msg = sRetVal

End Function

HTH...

Dag.


Quote:
> I am sending a string from an asp page to a DLL via but can't get the
> results back to the asp page. Any help would be appreciated.

> <%
> strMemo="ABC"
> Set objMsg = Server.CreateObject("FAObjects.WriteMessage")
> Dim WriteIt
> WriteIt = objMsg.Msg(strMemo)
> set objMsg = Nothing
> Response.write WriteIt
> %>

> The CLS file contains

> Option Explicit
> Public Server As Object
> Public Request As Object
> Public Application As Object
> Public Session As Object
> Public Response As Object
> Public ASPsc As ObjectContext
> Public Function Msg(ByVal strMemo As String) As Long
> strMemo = Replace(strMemo, "A", "Z")
> Msg = strMemo
> End Function



Fri, 16 Jan 2004 18:36:05 GMT  
 Write String to ASP from ActiveX DLL Component
Thanks Dag. The LONG was just something I was trying based on some sample
code on MS.

At any rate, I tried your suggestion and it doesn't work. I THINK the
procedure requires that the Msg variable be returned to the ASP page as an
array - and that's what I can't figure out how to do.

For example, in the code I am tring to get working, you can replace the last
line with

Msg = "ABCDEF"

and still can't do a response.write of the Msg() item in the ASP page.

Maybe I'm missing something simple.


Quote:
> No wonder...

> You declare Msg() to return a Long!
> Then you assign a String as the return-value
> to a method you just declared to be Long???

> And BTW... don't use the input param-var as
> a local working variable, it's *very bad* coding
> practice... :-)

> Try this:

> Public Function Msg(ByVal strMemo As String) As String

>     Dim sRetVal As String
>     sRetVal = Replace(strMemo, "A", "Z")

>     Msg = sRetVal

> End Function

> HTH...

> Dag.



> > I am sending a string from an asp page to a DLL via but can't get the
> > results back to the asp page. Any help would be appreciated.

> > <%
> > strMemo="ABC"
> > Set objMsg = Server.CreateObject("FAObjects.WriteMessage")
> > Dim WriteIt
> > WriteIt = objMsg.Msg(strMemo)
> > set objMsg = Nothing
> > Response.write WriteIt
> > %>

> > The CLS file contains

> > Option Explicit
> > Public Server As Object
> > Public Request As Object
> > Public Application As Object
> > Public Session As Object
> > Public Response As Object
> > Public ASPsc As ObjectContext
> > Public Function Msg(ByVal strMemo As String) As Long
> > strMemo = Replace(strMemo, "A", "Z")
> > Msg = strMemo
> > End Function



Sat, 17 Jan 2004 02:25:07 GMT  
 Write String to ASP from ActiveX DLL Component
Use this code in your VB Class

Option Explicit
Private MyScriptingContext As ScriptingContext
Private myRequest As Request
Private mySession As Session
Private myResponse As Response
Private MyApplication As Application

Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
    Set MyScriptingContext = PassedScriptingContext
    Set myRequest = MyScriptingContext.Request
    Set mySession = MyScriptingContext.Session
    Set myResponse = MyScriptingContext.Response
    Set MyApplication = MyScriptingContext.Application
End Sub

Public Sub OnEndPage()
    Set MyScriptingContext = Nothing
    Set mySession = Nothing
    Set myRequest = Nothing
    Set myResponse = Nothing
    Set MyApplication = Nothing
End Sub

Public Function Msg(ByVal strMemo As String) As String
    strMemo = Replace(strMemo, "A", "Z")
    Msg = strMemo
End Function

Trevor Benedict


Quote:
> I am sending a string from an asp page to a DLL via but can't get the
> results back to the asp page. Any help would be appreciated.

> <%
> strMemo="ABC"
> Set objMsg = Server.CreateObject("FAObjects.WriteMessage")
> Dim WriteIt
> WriteIt = objMsg.Msg(strMemo)
> set objMsg = Nothing
> Response.write WriteIt
> %>

> The CLS file contains

> Option Explicit
> Public Server As Object
> Public Request As Object
> Public Application As Object
> Public Session As Object
> Public Response As Object
> Public ASPsc As ObjectContext
> Public Function Msg(ByVal strMemo As String) As Long
> strMemo = Replace(strMemo, "A", "Z")
> Msg = strMemo
> End Function



Sat, 17 Jan 2004 17:09:37 GMT  
 Write String to ASP from ActiveX DLL Component
Works for me...

And I don't understand your comment about
an array at all...

ASP certainly doesn't require arrays...

Dag.


Quote:
> Thanks Dag. The LONG was just something I was trying based on some sample
> code on MS.

> At any rate, I tried your suggestion and it doesn't work. I THINK the
> procedure requires that the Msg variable be returned to the ASP page as an
> array - and that's what I can't figure out how to do.

> For example, in the code I am tring to get working, you can replace the
last
> line with

> Msg = "ABCDEF"

> and still can't do a response.write of the Msg() item in the ASP page.

> Maybe I'm missing something simple.



> > No wonder...

> > You declare Msg() to return a Long!
> > Then you assign a String as the return-value
> > to a method you just declared to be Long???

> > And BTW... don't use the input param-var as
> > a local working variable, it's *very bad* coding
> > practice... :-)

> > Try this:

> > Public Function Msg(ByVal strMemo As String) As String

> >     Dim sRetVal As String
> >     sRetVal = Replace(strMemo, "A", "Z")

> >     Msg = sRetVal

> > End Function

> > HTH...

> > Dag.



> > > I am sending a string from an asp page to a DLL via but can't get the
> > > results back to the asp page. Any help would be appreciated.

> > > <%
> > > strMemo="ABC"
> > > Set objMsg = Server.CreateObject("FAObjects.WriteMessage")
> > > Dim WriteIt
> > > WriteIt = objMsg.Msg(strMemo)
> > > set objMsg = Nothing
> > > Response.write WriteIt
> > > %>

> > > The CLS file contains

> > > Option Explicit
> > > Public Server As Object
> > > Public Request As Object
> > > Public Application As Object
> > > Public Session As Object
> > > Public Response As Object
> > > Public ASPsc As ObjectContext
> > > Public Function Msg(ByVal strMemo As String) As Long
> > > strMemo = Replace(strMemo, "A", "Z")
> > > Msg = strMemo
> > > End Function



Sat, 17 Jan 2004 23:11:56 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. ASP ActiveX components written in VB5.0

2. Written DLL, but get ActiveX Component can't create object

3. Passing an ASP DLL to a VB ActiveX component

4. write HTML text into a ASP page from a ACTIVEX SERVER DLL

5. Can ActiveX DLL component contain ActiveX control?

6. Ping writing ping component voor asp

7. I need help writing Active Server Components for ASP's

8. ActiveX DLL calling DLL procedures from ASP app...

9. What can the Property bag store when writing activeX components

10. ActiveX Component Can't Create Object Exception in ASP.Net

11. Security issues while installing 3rd party Activex (ASP) components on IIS

12. Passing Arrays between ASP/VBScript and ActiveX Components...

 

 
Powered by phpBB® Forum Software