Click here to Skip to main content
16,013,548 members
Home / Discussions / C#
   

C#

 
AnswerRe: how do i pass a parameter to Pin
Heath Stewart20-May-04 5:35
protectorHeath Stewart20-May-04 5:35 
GeneralRe: how do i pass a parameter to Pin
robmays20-May-04 7:38
robmays20-May-04 7:38 
GeneralSwitching Between Applications Pin
Harihara Subramanian20-May-04 5:10
Harihara Subramanian20-May-04 5:10 
GeneralRe: Switching Between Applications Pin
Heath Stewart20-May-04 5:28
protectorHeath Stewart20-May-04 5:28 
GeneralRe: Switching Between Applications Pin
Harihara Subramanian20-May-04 5:46
Harihara Subramanian20-May-04 5:46 
GeneralRe: Switching Between Applications Pin
Heath Stewart20-May-04 5:52
protectorHeath Stewart20-May-04 5:52 
GeneralRe: Switching Between Applications Pin
Harihara Subramanian21-May-04 2:21
Harihara Subramanian21-May-04 2:21 
GeneralRe: Switching Between Applications Pin
Heath Stewart21-May-04 3:48
protectorHeath Stewart21-May-04 3:48 
First of all, both parameters of ShowWindow should be IntPtrs. These are native ints, which are processor-dependent - just like the IntPtr (32 bits on a 32-bit CPU/OS and 64 bits on a 64-bit CPU/OS).

Also,don't blindly access p[0]. If, for some reason, the process wasn't found an IndexOutOfRangeException or NullReferenceException (depending on what GetProcessesByName returns when a process isn't found) would be thrown.

Getting the Process is no problem. The reason is the MainWindowHandle is returning IntPtr.Zero is because it doesn't currently have one - the main window is invisible. Either don't remove it from the task bar (via ShowInTaskbar) or try something else.

You could use a mutex and signal it. Any application can use them. C/C++ and .NET have support already (C/C++ through APIs, obviously, and .NET in the System.Threading namespace - which actually uses the same C/C++ APIs internally). With VB (by which I assume you mean VB6, since VB.NET uses the same .NET FCL as C# with only a slightly different syntax) you'd have to declare these native functions.

When the switchboard starts, you create two mutexes (one for each app, or you could use one with a counter) but don't request initial access. When an applicatio starts, you wait on the mutex (to be signaled). When the other applciations exit, you signal the mutex and the switchboard could make itself visible. You could do this in a loop if you wanted, if a user can switch back and forth.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Switching Between Applications Pin
Harihara Subramanian21-May-04 5:38
Harihara Subramanian21-May-04 5:38 
GeneralRe: Switching Between Applications Pin
Heath Stewart21-May-04 6:08
protectorHeath Stewart21-May-04 6:08 
General.NET App Performance and Scalability Guide Pin
Dave Kreskowiak20-May-04 4:31
mveDave Kreskowiak20-May-04 4:31 
GeneralDir Search On Server Pin
IrishSonic20-May-04 4:14
IrishSonic20-May-04 4:14 
GeneralRe: Dir Search On Server Pin
Heath Stewart20-May-04 4:16
protectorHeath Stewart20-May-04 4:16 
GeneralRe: Dir Search On Server Pin
IrishSonic20-May-04 4:29
IrishSonic20-May-04 4:29 
GeneralRe: Dir Search On Server Pin
IrishSonic20-May-04 4:37
IrishSonic20-May-04 4:37 
GeneralRe: Dir Search On Server Pin
Heath Stewart20-May-04 4:43
protectorHeath Stewart20-May-04 4:43 
GeneralProblems with Screen.PrimaryScreen.Bounds Pin
kaloyan20-May-04 3:21
kaloyan20-May-04 3:21 
GeneralRe: Problems with Screen.PrimaryScreen.Bounds Pin
Heath Stewart20-May-04 4:14
protectorHeath Stewart20-May-04 4:14 
GeneralRe: Problems with Screen.PrimaryScreen.Bounds Pin
kaloyan20-May-04 21:52
kaloyan20-May-04 21:52 
GeneralRe: Problems with Screen.PrimaryScreen.Bounds Pin
Heath Stewart21-May-04 3:30
protectorHeath Stewart21-May-04 3:30 
GeneralSingle Instance of a class as long as it is in use Pin
SmithaC20-May-04 3:03
SmithaC20-May-04 3:03 
GeneralRe: Single Instance of a class as long as it is in use Pin
Grimolfr20-May-04 3:08
Grimolfr20-May-04 3:08 
GeneralRe: Single Instance of a class as long as it is in use Pin
Heath Stewart20-May-04 3:24
protectorHeath Stewart20-May-04 3:24 
GeneralRe: Single Instance of a class as long as it is in use Pin
scadaguy20-May-04 5:57
scadaguy20-May-04 5:57 
GeneralA general question about objects Pin
Christer Claesson20-May-04 2:47
Christer Claesson20-May-04 2:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.