Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

END function not supported in DLL format.

Posted on 2004-09-14
12
Medium Priority
?
1,142 Views
Last Modified: 2006-11-17
I have a program I mistakenly created as a standard ExE and when I recreated it in an ActiveX DLL format and imported my classes, it tells me that the END function is not supported in a DLL, how do I get the program to terminate when a certain error is encountered, IE run flag already set?
0
Comment
Question by:Wonderflub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
  • 2
  • +1
12 Comments
 
LVL 4

Expert Comment

by:P1
ID: 12058242
You shoulder never end a ActiveX/COM object internally, always report/return an error back to the client.  

Regards,  P1
0
 

Author Comment

by:Wonderflub
ID: 12058291
I need the program to terminate once the active flag is located, it cannot continue to run, so how would I accomplish this?
0
 

Author Comment

by:Wonderflub
ID: 12058430
actually, the error is being thrown when the SQL database for logging cant be opened, I figured out how to get around the active flag, the whole proggy is one big IF, then statement... but if the database wotn open, it need to terminate... how prey tell, how.....
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 10

Expert Comment

by:Clif
ID: 12058492
Return an error then end the calling program.  That will end the dll.

That's about the only way you can do it.
0
 

Author Comment

by:Wonderflub
ID: 12058538
how do I end the calling program from the DLL when I am using a VB script to call the program?

I may be being really lazy here and not wanting to look it up, but help a sister out :-).
0
 
LVL 10

Expert Comment

by:Clif
ID: 12058573
You don't end the calling program from the dll, you end the calling program from the calling program.  In the case of script, exit the procedure where you created the object.

Which brings up a point. If you created the object, destroy the object (set it to nothing).
0
 
LVL 3

Accepted Solution

by:
aParser earned 2000 total points
ID: 12058580
Sub Main()
  Dim oMyObject As MyClass

  Set oMyObject = New MyClass
  On Error GoTo Err_Sub
  If OneBigIfStatement Then
  ...
  End If
  Exit Sub
Err_Sub:
  Set oMyObject = Nothing
End Sub

[MyClass.cls]
...
Public Sub MyMethod()
  Const VBERRROR_USER_INTERRUPT As Long = 18 ' for illustration only
  If Not ConnectToDatabase() Then
    Err.Raise VBERRROR_USER_INTERRUPT
  End If
  ...
End Sub
...
0
 
LVL 3

Expert Comment

by:aParser
ID: 12058653
Scripting ... bleh ...

Sub Main()
  Dim oMyObject

  On Error Resume Next
  Set oMyObject = CreateObject("MyProject.MyClass")
  If OneBigIfStatement Then
    ...
    Call oMyObject.MyMethod
    If Err.Number <> 0 Then
      Set oMyObject = Nothing
      Exit Sub
    End If
  ...
  End If
End Sub

0
 

Author Comment

by:Wonderflub
ID: 12058672
Ok, ok, I know you are going to hate me for being a little slow and a real pain in your ass.... BUT how can I do all this from inside a VB script, I don't work with VB script, I just use it for the job sceduler to call programs and it is one line of code.....

DLLName.function name

can you use subs in vbscript like that.....
0
 

Author Comment

by:Wonderflub
ID: 12058726
OK... whew, I figured it out... having a mahor brain fart day... Thanks fo rall the help :-).
0
 

Author Comment

by:Wonderflub
ID: 12058747
Oh my aParser, your post got in there while I was posting mine and never saw it..... my appologies, go to thread to follow to make up for my totally brainless day
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question