using another program in your app
-
Hi there. I am wondering how does one use another application in an application that one is writing. Let´s say I am writing a program, A, and when a button is clicked it needs the functionality of another program, B. How does one go about making program A use program B when needed. Any help is greatly appreciated and short examples even more appreciated. Thanks, F
-
Hi there. I am wondering how does one use another application in an application that one is writing. Let´s say I am writing a program, A, and when a button is clicked it needs the functionality of another program, B. How does one go about making program A use program B when needed. Any help is greatly appreciated and short examples even more appreciated. Thanks, F
It really depends on what you are trying to do. Here are two possible solutions: - Break the needed features into a component library that both applications can share. If this is possible, this is preferable. - Another approach might be to spawn a new process to run the application, but communication between the two applications is some what limited. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp Beyond those general (and very different) approaches I'd need more information about what your trying todo. Hope this helps Marc L
-
It really depends on what you are trying to do. Here are two possible solutions: - Break the needed features into a component library that both applications can share. If this is possible, this is preferable. - Another approach might be to spawn a new process to run the application, but communication between the two applications is some what limited. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp Beyond those general (and very different) approaches I'd need more information about what your trying todo. Hope this helps Marc L
Thanks for your answer. When the user presses a button several things need to happen one of which is using a program (I have that one) that converts a .tiff file to a .pdf file and stores it in a folder of the users choosing (I had a TreeView in mind to let the user select a directory). Also, can you elaborate a little on the two solutions you suggested? Many thanks, F
-
Thanks for your answer. When the user presses a button several things need to happen one of which is using a program (I have that one) that converts a .tiff file to a .pdf file and stores it in a folder of the users choosing (I had a TreeView in mind to let the user select a directory). Also, can you elaborate a little on the two solutions you suggested? Many thanks, F
Sure, the different approaches are based on whether the .tiff to .pdf converter program can be used inside your application or do you need to 'run' the other application. 1)Ideally what you want is the .tiff to .pdf conversion to be done by an object in your application. So if you can create/add a reference in your project to the converter program, what do you get? If the reference is created you can browse the exposed objects. Right click on the reference (in the solution explorer) to bring up the object browser (Visual Studio 2003). Then you have the task of understanding what objects to use and what they'll do for you. (Hopefully there's documentation) 2) If the other application can't be used as a reference then you will need to 'run' it outside your application. Use the link from the previous post to review how you can write code to run the application in a new process. Hopefully the converter program takes commandline input that can be set in the StartInfo.Arguements property. Hope that helps Marc L