|
-
Sep 30th, 2011, 11:24 AM
#1
Thread Starter
Hyperactive Member
[solved] run another program in the background?
is it possible to call another program in the background?
I'n doing a project that uses .net to control a camera. the camera is nikon, which has a sdk. unfortunately, the sdk is an unmanaged dll, from the research I did, people complained that it is difficult to use it in .net. actually, no1 has example. but the sdk has sample in vc++. so, I'm thinking maybe can build the control program by vc++, then use vb.net or c# to it and run it in the background. so, I do not have to mess the dll to .net.
is this a good choice? or, not really? how to do it? if I use a console program, how to avoid popping up the cmd window?
thanks
bear
Last edited by FlyingBear; Oct 2nd, 2011 at 03:52 AM.
-
Sep 30th, 2011, 11:50 AM
#2
Fanatic Member
Re: run another program in the background?
Hi,
Virtually anything that you can do in a c++ program, you could do in VB (or C#). I doubt that there would be any advantage to trying to do what you suggest as a separate application. Certainly, it would not run "in the background" because Windows apps don't work that way -- it would execute in a separate application domain, which is not the same thing as a separate thread (background execution).
I believe that creating a separate program, and then trying to communicate with it would only add complication. I would try to work out the "issue" and address in my .NET program.
I don't know anything about the complaints that have been posted about the difficulty of using the unmanaged dll from .NET. It is possible that there are some issues; without hands-on, I could only speculate. It is possible that someone here has specific knowledge, but I'm not that person.
If you post a specific question that addresses the actual issues involved in using this unmanaged dll, you may get some advice that will help.
Dick
Last edited by DickGrier; Sep 30th, 2011 at 11:51 AM.
Reason: reword
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Sep 30th, 2011, 06:13 PM
#3
Thread Starter
Hyperactive Member
Re: run another program in the background?
anything can be done in c++, can be done in vb/c#, I believe it is true. however, it could be very difficult, since the project is related with hardware.
the sdk comes with a sample, which can be changed easily in c++ for the feature we want. during our research, I saw many people asked the question of using it in c#, nobody provided a real sample. that's we assume that at least it is difficult to do that.
that's why we think maybe we can use c# for frontend (since we did lots of work already), then call c++ for the hardware. but need figure out a way to do this.
any suggestions are appreciated.
thanks
-
Sep 30th, 2011, 10:09 PM
#4
Re: run another program in the background?
You can handle the unmanaged dll with System.Runtime.InteropServices, however you must know the inputs and outputs of the dll.
If you decide to do that you better post in the API forum.
If the project is related with low hardware issues DON'T EVEN THINK of doing it in VB or C# , stick with c++ .
Anything can be done in c++, can be done in vb/c#...NOT.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Oct 2nd, 2011, 03:51 AM
#5
Thread Starter
Hyperactive Member
Re: run another program in the background?
sapator, bascially, I agree with you. hardware related feature, c++ is the best choice although vb/c# may work too.
back to the original question: solved!
I just did a test, and found out that:
Code:
Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
when hidden is set, it will NOT show the cmd window. did not know it exists.
thanks
bear
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|