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
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
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
RE: Launching Application via VB6 program
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
RE: Launching Application via VB6 program
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
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
Good Luck
johnwm
RE: Launching Application via VB6 program
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
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
RE: Launching Application via VB6 program
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
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
RE: Launching Application via VB6 program
Still in need
RE: Launching Application via VB6 program
-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
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
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,,