×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Launching Application via VB6 program

Launching Application via VB6 program

Launching Application via VB6 program

(OP)
If anyone knows how to launch an executable (.exe) by a VB6 progam and at the same time use its command .
For example : I want to write a VB program that open an Autocad application, do modifications and save the file opened. I had to use the autocad command in my VB6 program.
Thanks

RE: Launching Application via VB6 program

Have you tried the shell command?  

It will run an external program in a separate window.  If you need to wait for the external program to finish first before you do something else it becomes more complex.

RE: Launching Application via VB6 program

Shell can be used to start the programme, then you could set up a link between your VB programme and AutoCAD and use Dynamic Data Exchange to get VB to do something in AutoCAD.

RE: Launching Application via VB6 program

(OP)
Thanks to rush and PeterCharles.
I try the shell command, it works. But I don't know how to use Dynamic Data Exchange commands ! Where I can find those commands ?  
My problem is that I want to open a list of autocad dwgs to do some modifications and to save them. I think I had to use few DDE commands. I'm not familiar with DDE commands. Any help or examples showing the use of such commands.

RE: Launching Application via VB6 program

(OP)
Any examples showing the use of DDE commands !

RE: Launching Application via VB6 program

Why would you try to use DDE afterall ? In Autocad you could use VBA or access Autocad object model directly through your program by instantiating... surprise surprise Autocad :)

So there is no need to use shell or any other API method to start an Autocad, just reference the Autocad object and the Autocad engine starts.

You can control Autocad form your code directly.

Another way is to start an autocad with parameters to run predefined script, also you could make an Autocad VBA module an play with it - but best route to control Autocad is via Autocad object.




RE: Launching Application via VB6 program

(OP)
No I don't want to use Lisp or Autocad instructions, more complicated !
I have 200 dwg to convert. I work with I-DEAS artisan, and I don't do any effort to return to autocad.
I want to work with VB, think is easy !

RE: Launching Application via VB6 program

Use AutoCAD vba

Good Luck
johnwm

RE: Launching Application via VB6 program

The easiest way to start a program is to use the Internet Shortcut technique like this:
Put a Text1 and a button (Command1) on your form and add this code to Command1_Click:

Sub Command1_Click()
Dim sFile as string
Dim F as Integer

sFile = Text1.Text
F = FreeFile
Open "C:\TEMP.URL" For Output As #F
Print #F, "[InternetShortcut]"
Print #F, "URL=" & sFile
Close #F
Shell "rundll32.exe shdocvw.dll,OpenURL c:\temp.url", vbNormalFocus
end sub

This will create a file on C:\ called TEMP.URL which will be overwritten next time you click the button. Be sure to add something in the Text1 field like http://google.com

RE: Launching Application via VB6 program

(OP)
Thank you very much Gaba . I star you !
It work good but I still need instruction for saving automatically. I want to save as Autocad 14.0 (the version used is 2000).
Awaiting for help

RE: Launching Application via VB6 program

Read the FAQ for information on manipulating AUTOCAD using automation control from VB6

RE: Launching Application via VB6 program

abbver98,
I was reading your posting and all I have to said is,

Please take a breath,,
and enjoy "Mastering AutoCAD VBA" by Marion Cottingham, you can take a trip to your library. They can get the book for you, and if you like, you could learn a few commnands in VBA, AND YOU CAN STILL WORKING IN VBA, and you can finish your project in two or three days.

The command shell, is not good enough.

And you can get the Commom Dialog in Visual Basic, and with ShowSave or ShowSaveAs, you can save all your records.

AND REMEMBER ALL IN VISUAL BASIC, combined with VBA.

Alberto

RE: Launching Application via VB6 program

If you want to know something about Dynamic Data Exchange (DDE) check out
http://members.iinet.net.au/~bigbyte/vb.htm
This was my first introduction to using VB to 'programme' AutoCAD LT and I have had some good results.  

What you do is to set up a conversation (read the VB instructions on DDE) between the VB programme and AutoCAD.  The programme then sends instructions to the command line of AutoCAD.  The big advantage is being able to programme both versions of AutoCAD.

Initially I created a drawing in VB as a DXF which I then 'inserted' into an AutoCAD drawing, but this resulted in the drawing becoming a block, not quite what I wanted.

Am currently finishing a programme to 'draw' standard structural steel sections.  When finished it will be able to be used by my guys with both 'very expensive' AutoCAD and 'less expensive' AutoCAD LT.

I haven't tried to use any of the file commands but I don't see why you can't but you may have to experiment.

RE: Launching Application via VB6 program

Is this project done or are you still in need of help?

RE: Launching Application via VB6 program

(OP)
Hi ctruax,
Still in need

RE: Launching Application via VB6 program

If I understand from the previous posts:
-SHELL will launch an .EXE but then continues (non-modal)
-EXECUTE (program I wrote) launches .EXE and waits till done

Your task more explicitly defined:
From a VB6 application:
-Launch ACAD r14
-Open a specific .DWG file
-Modify the DWG
-Save the modified .DWG
-Exit & Close ACAD r14 application

If this is the case;
what's the specifics of Modify

RE: Launching Application via VB6 program

I don't know if this will help but to do everything at the command prompt you can use :-

FILEDIA               (enter)
0                     (enter)
SAVEAS                (enter)
R14                   (enter)
"filepath and name"   (enter)

So, if you can pass these instructions to AutoCAD then the drawing will be saved as Release 14

RE: Launching Application via VB6 program

I think U need to use a (Reference) to the *.exe U need..
and that is, U can use the functions of the program U need.. if this program is one of the Windows components ,U will need to have some readings about Win API.. To make a reference and use a program functions via VB,, go to the menu,, Project,, Reference and check the progam U need to use its functions.. check this program help,, some gives instructions and hints for the programmers about using its functionalities as REFERENCE.. sorry about my bad English,,

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources