Ken,
Hope your having a good day. Maybe I can help with your questions.
#2
When you compile you are seeing the name of your project as defined in your project properties window. The only attribute you will see is Name. Enter what you want your project named. Once you do this you will see in your project window that the name Project1 has changed to your project name. If you don't see any of these "panes" do the following:
From the view menu select Project Explorer or the hotkey Ctrl+R. From the same view menu you can also select properties window or hotkey F4.
#1
Stop - read your help files for CreateObject and GetObject.
CreateObject is a function that creates and returns a reference to an ActiveX object. You really need to read up on this to understand what is meant by an ActiveX object.
Lets take starting AutoCAD from a VB exe project.
Start a new EXE project
Place a command button on the form
Double click on the command button you just placed on the form. This will place you in the command button click event.
Remember VB6 or VB Classic as we call it is an example of an event driven language. This of course can be debated but I'm being as simple as possible so I won't expand in that direction.
Within the Command_Click event place the following code:
Dim MyAcadApp As AcadApplication
On Error Resume Next
' This sets a reference to AutoCAD Application
Set MyAcadApp = GetObject(, "AutoCAD.Application")
' If the is an error then AutoCAD is not running. If not running you want to CreateObject.
If Err Then
Err.Clear ' Clear the error if it exists
Set MyAcadApp = CreateObject("Autocad.Application") ' This opens the existing running instance of AutoCAD
' In the next line your checking for some other error. If one exists take a look at the error via Err (read up)
If Err Then
MsgBox Err.Description
' You've some type of error so you might as well quit here and fix the problem
Exit Sub
End If ' Close the second (nested) If condition
End If ' Close the first if condition
' If your this far then look at AutoCAD
MyAcadApp.Visible = True
End Sub
As for your question regarding starting your VB6 exe I would probably use the FindExecute and ShellExecute API functions as one alternative.....but let's not go there right now.
Best of luck to ya, hope this helps.
Regards,
Bob Coward
CADS, Inc
800-366-0946
bcoward@mindspring.com