For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > September 2004 > Help with first DLL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help with first DLL
Webbee

2004-09-30, 3:55 pm

Ok I started this post in another thread but the topic I think should be
placed here based on my current status.

I have built a DLL that returns this error when accessed from an ASP page:
DDE Error:369 :Operation not valid in an ActiveX DLL

Here is the code:
Public Function DDEInitiate() As String

On Error GoTo Err_DDE

With lblGMDDE
.LinkMode = vbLinkNone
.LinkTopic = "GoldMine|Data"
.LinkMode = vbLinkManual

.LinkItem = "&UserName"
.LinkRequest
DDEInitiate = .Caption
End With

Exit Function

Err_DDE:
If Err = 282 Then
DDEInitiate = 282
Else
'Err.Description = "DDE Error:" & Err & " :" & Err.Description
DDEInitiate = "DDE Error:" & Err & " :" & Err.Description
End If

End Function

Nothing really fancy and I run it from a Class called GM with this Functions:
Public Function GetUserID() As String
GetUserID = frmDDE.DDEInitiate
End Function

Again, nothing really fancy but yet I still get stumped.

Webbee

2004-09-30, 3:55 pm

Ok I changed the DLL to an EXE and that helps. If I reference this from
another VB program it works great! But if I reference this from an ASP page I
get a 282 error. Here is the ASP page code that I'm using.

<% Option Explicit

Dim oGMUser 'Create an object for the component
Dim Username 'Create a string to hold the result

'Create an instance of the Component we just wrote
Set oGMUser = CreateObject("GMCurrentUser.GM_Class")

'Call the IsLeapYear function in our component, and
'store the result
UserName = oGMUser.GetUserID

'Close the instance, good programming practice
Set oGMUser = Nothing

%>
<HTML>
<HEAD>
<TITLE>Gm User</TITLE>
</HEAD>
<BODY>
<%
'Let the user know
Response.Write UserName
%>
</BODY>
</HTML>


"Webbee" wrote:

> Ok I started this post in another thread but the topic I think should be
> placed here based on my current status.
>
> I have built a DLL that returns this error when accessed from an ASP page:
> DDE Error:369 :Operation not valid in an ActiveX DLL
>
> Here is the code:
> Public Function DDEInitiate() As String
>
> On Error GoTo Err_DDE
>
> With lblGMDDE
> .LinkMode = vbLinkNone
> .LinkTopic = "GoldMine|Data"
> .LinkMode = vbLinkManual
>
> .LinkItem = "&UserName"
> .LinkRequest
> DDEInitiate = .Caption
> End With
>
> Exit Function
>
> Err_DDE:
> If Err = 282 Then
> DDEInitiate = 282
> Else
> 'Err.Description = "DDE Error:" & Err & " :" & Err.Description
> DDEInitiate = "DDE Error:" & Err & " :" & Err.Description
> End If
>
> End Function
>
> Nothing really fancy and I run it from a Class called GM with this Functions:
> Public Function GetUserID() As String
> GetUserID = frmDDE.DDEInitiate
> End Function
>
> Again, nothing really fancy but yet I still get stumped.
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com