ChrisBettencourt

Hello,

I'm a super fresh newbie to VB, and I'd really appreciate any help! (I'm using Visual Studios 2005)

My current issue is that I'm trying to open an application using:

Dim ProcID As Integer
ProcID = Shell("""C:\FlowMaster 6.0\FlowCUT.exe""", AppWinStyle.NormalFocus)
AppActivate(ProcID)

I got this code from the help file. I've just put it in a button, and when I click it, I see the splash screen for the program, but then I get an error. I'm able to open a different application, and enter the username and password by using this same method, so I'm thinking that the issue is one of security settings. FlowCUT does not have a username or password upon startup, so I'm a little confused. Do I need to do something in VB about this, or is it some sort of setting that I'm looking for in FlowCUT itself


That is my problem in the short term. In the long term, my ultimate goal is to create an interface for this existing program named FlowCUT that would limit the options avaliable to the user. (So the user would only be able to view the CAD image, and begin the cutting procedure, but they could not modify any specs) My plan is to just have a small app that operates the program, but keeps it hidden somehow, and just has less buttons, etc, but is taking all info from FlowCUT. If there is a better way to do this, I'd love to hear about it.

Thanks in advance.


Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

kleinma

the shell function is left over from VB6 for backwards compatibility.

Try using the process class, and see if you get any better results.

Code Snippet

Dim MyPSI As New ProcessStartInfo("C:\FlowMaster 6.0\FlowCUT.exe")

MyPSI.WindowStyle = ProcessWindowStyle.Normal

MyPSI.WorkingDirectory = "C:\FlowMaster 6.0\"

Dim MyProcess As Process = Process.Start(MyPSI)






Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

ChrisBettencourt

Thank you Matt, I'll probably have more issues, but you've sent me on the right path!



Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

kleinma

No problem. Just post back when you run into them and I am sure you will find help here.




Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

ChrisBettencourt

I wonder if I'm approaching this problem correctly.......If I'm trying to make a gui to restrict functionality for an existing 3rd party application, would I just make an app that trys to operate the software for the user I feel funny about this for some reason. I'm having the app open FlowCUT as the previous post from Matt detailed, and then trying to just man-handle the thing into opening a file.

'Start the FlowCUT application

Dim MyPSI As New ProcessStartInfo("C:\FlowMaster 6.0\FlowCUT.exe")

MyPSI.WindowStyle = ProcessWindowStyle.Normal

MyPSI.WorkingDirectory = "C:\FlowMaster 6.0\"

Dim MyProcess As Process = Process.Start(MyPSI)

'look to see if the application is responding/open

Dim resp As Boolean

resp = MyProcess.Responding()

Do While resp = False

resp = MyProcess.Responding()

Loop

'if it is open, send the CTRL O command to choose a file

My.Computer.Keyboard.SendKeys("^o")

Its opening the program just fine, but the SendKeys thing doesn't seem to be doing anything. As I said in the first post, SendKeys was working for me with another application, but I had to do this thing where I put up a blank message box, basically to slow things down, and after I clicked ok, I had it ActivateApp, and then SendKeys. ActivateApp doesn't really apply here though. Also, ProcessWindowStyle.Hidden doesn't hide the window at all. If I do get the gui thing working, it won't be worth much if the users can still see and access the original interface.

I just can't help but think that I'm going about this in an ugly way. Is there a more graceful method of putting new guis on software





Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

kleinma

sendkeys is always sloppy and prone to not work right all the time.

Unless the makers of the software offer an API to extend their application, then no, there is no easy graceful way to extended it to provide more functionality than it already has (or automate its functions).

Some application (like Office) offer an API that is exposed to programmers so that they can make addins and changes in the GUI. Most applications don't have this, as they don't want, expect, or plan on someone else trying to make it do something they didn't design it to do.

So it is not to say using sendkeys won't work, but i would never use them in production as being 100%, because there are many factors that could make it not work right.

Does flowcut.exe take any command line params

one thing most programs DO have is the ability to pass in params (like a full file path) and the application will launch and open the file that was passed in.

Just like if you launch notepad.exe with a param of c:\testing.txt, it will open notepad and open c:\testing.txt so long as it exists on the hard drive.






Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

ChrisBettencourt

Unfortunatley, Flowcut does not take command line parameters. I've emailed the company explaining what I'm doing, and asking them for the API, but I sort of doubt that they'll be thrilled about providing it.

I actually tried opening flowcut.exe in Visual Basic, and I could see the menus and dialog boxes, etc. I disabled some items and saved, but when I opened Flowcut as an .exe, it hadn't really saved the changes. Then I copied flowcut as a different file name, and made the changes and saved as flowcut, which I had deleted. when I opened the 'new' flowcut, everything was the same. I was hoping to publish the changes as a new app, but that wasn't an option. I guess because there is no code there, just the form objects.

I'd almost be willing to use the SendKeys on this if I could get them to work. There will be so few options in my version that there isn't much to mess up, and this is the only program to be run on that particular pc. Do you have any ideas why SendKeys wasn't working for me Or why I can't seem to make any application hidden





Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

kleinma

I am a bit confused.. what do you mean by you opened flowcut in VB

do you have the source code or something






Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

ChrisBettencourt

I don't have the source code, I just opened Visual Studios and went to File: Open File, and selected FlowCUT.exe. Then I see a folder tree

FlowCUT.exe

Accelerator

Bitmap

Dialog

Icon

Menu

String Table

Toolbar

Version

If I expand Dialog, for example, and double click on 'About', I see the form that is displayed when you select About from the Help menu when running the application. I can then see the properties of all the textboxes, buttons, etc, and make changes as I wish. All for nothing though, becasue saved changes aren't reflected in the actual program.





Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

kleinma

interesting.. I wonder what language it is written in...

I have opened an exe in Visual Studio before, but never seen that much information presented... Usually I can see the icons and some other info (usually version number). The typical stuff right clicking on the exe and selection properties in windows would give you...

I have never seen where it actually showed you forms and such.. .NET exe or native exe..






Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

ChrisBettencourt

Doesn't it seem like if I can see and edit that stuff, that I should be able to somehow save it and apply it to the actual application

Anyway, if anyone knows how to get the SendKeys and hidden window things to work, I'd really appreciate it. If I can show some progress on this, my life would be a lot better!





Re: Visual Basic Language Creating a new GUI for an existing 3rd party application

kleinma

editing a compiled exe right like that doesn't seem "normal" so I would have to say no, I don't see how you could edit that and save it and have those changes persist in the compiled code. Then again I haven't seen an exe that allowed you to view its forms in the IDE like you say it does, so I am really not sure...

As far as the hidden window goes, you could try setting the .CreateNoWindow property to true for the ProcessStartInfo object that you use when creating the process.

However if you create no window, then sendkeys probably wouldn't work at all, as there would be no window to send the keys to..