Calling Conv3ds from within Program

jviper

Member
Joined
Nov 24, 2005
Messages
12
Programming Experience
1-3
OK, I am using Microsoft Visual Basic 2005 Edition, and I am trying to call conv3ds from within a program. Here's the code:

VB.NET:
CommandStr = " -o " & RetFile & " " & File3ds 
RunApp = Application.StartupPath + "\Conv3ds.exe" 
Shell(RunApp & CommandStr, AppWinStyle.NormalFocus, True)

But, when this runs, it runs conv3ds, but it seems to be ignoring the arguments. See anything I'm doing wrong here, or is this a possible bug in VB.NET (as this exact code worked in the beta edition), or is it not possible to do this anymore?

EDIT: What I mean by "It seems to be ignoring the arguments", is it seems to run as if I did Shell(RunApp), and not put any commands after it. The command I'm trying to use is the o option, to specify where I want to save the new file.
Oh, and actually, I just tested it, and it seems that it ignores all commands. Without being about to pass a command to it, it's completely useless
icon_sad.gif
 
I prefer the System.Diagnostics.Process class for starting external apps.
I don't currently have 2005 so I can't help with the Shell function there, sorry.
 
The Process Class???? Huh, I thought this would come up!!!

Hmmm. Intersting. I got this same suggestion when I posted this problem over in the TV3D off-topic fourm. Well, here is the code I used to do this:
VB.NET:
Public Function Conv3dsToX(ByVal File3ds As String) As String
     Dim n As Integer
     Dim RetFile As String
     Dim RunApp As String
     Dim CommandStr As String
     Dim FileNoExt As String
     Dim AppProcess As New ProcessStartInfo()
 
     n = InStrRev(File3ds, ".") : FileNoExt = Left$(File3ds, n - 1)
     RetFile = FileNoExt + "_3dsToX.x"
     If Not FileExists(RetFile) Then
          CommandStr = "-o " & RetFile & " " & File3ds
          RunApp = Application.StartupPath & "\Conv3ds.exe"
          AppProcess = New ProcessStartInfo(RunApp, CommandStr)
          AppProcess.WindowStyle = ProcessWindowStyle.Maximized
          System.Diagnostics.Process.Start(AppProcess)
     End If
     Return RetFile
End Function
I thought this would fix the problem, but it results in the same as the aboce code. The Conv3ds App comes up as if I didn't put any argumants/commands at all (as if I just ran conv3ds, and not put anything after that, and the instructions on how to use it showed up).
Now, I suspect the problem to be with my CommandStr. File3ds is the path of the 3ds file that I wish to convert to an x. RetFile is the path of where I want the new .x file. The "o" is the option I have to use to save the output from the converted 3ds file, to where I want to place the new .x file. I've also tried omitting the relocation, and just doing CommandStr=" " + File3ds, and the same behavior results. Do you see any problems in the way CommandStr was contructed?

EDIT: Also, setting AppProcess.UseShellExecute = True, resulted in the same thing
 
Last edited:
I don't see any problems right away.
The first thing I would do is test the program by sending the command via a command prompt. If that works, place breakPoints in the code and verify that the command is constructed correctly.
It may be that there are spaces in RetFile or File3ds or both. Sometimes it is necessary to enclose paths with spaces in quotes. If that's the case, in order to include quotes in a string you would put two quotes. Something like:
VB.NET:
CommandStr = "-o """ & RetFile & """ " & File3ds & """"
 
Humm, interesting. The original code, and the code after that, as a matter of fact, all of the code works if the path does not have any spaces in it. But if there is a space in the path, none of the code seems to work at all :confused: . Humm, oh well... I guess I'll have to put up a warning, if someone has a path with spaces in it, I have to disable that function.
 
Nope. Resulted in the same thing. Wierd huh. Actually, sence it didn't seem to fix the problem, I was exepcting it not to work at all. But it worked as long as there was no spaces in the path.

Keep in mind also, this worked when I was using Beta edition (I think). Yet it seems to work when I type it directly in the command promp. Maybe, the spaces the command promp uses are different then the spaces in Vb.NET strings? Pherhaps a different character?
 
Last edited:
Back
Top