Re: Use Running App
- From: "Brian P. Hammer" <BrianHammer@xxxxxxxxxxxxxxxx>
- Date: Sun, 13 Nov 2005 00:15:10 -0600
Never mind.... It's too late to miss the simple thing of my app name...
Brian
"Brian P. Hammer" <BrianHammer@xxxxxxxxxxxxxxxx> wrote in message
news:%23Da6iSB6FHA.2888@xxxxxxxxxxxxxxxxxxxxxxx
> Bob - This doesn't seem to work in 2005. RunningProcesses.Length always
> return 0
>
> Thanks,
> Brian
>
> Public Enum....
>
> <Runtime.InteropServices.DllImport("User32.dll")> _
> Public Shared Function ShowWindowAsync(ByVal hWnd As IntPtr, ByVal
> swCommand As Integer) As Integer
> End Function
>
>
> <STAThread()> _
> Public Shared Sub Main()
> Dim RunningProcesses As Process() = Process.GetProcessesByName("Test")
> 'Change the name above to suit your application
> If (RunningProcesses.Length = 1) Then
> Application.Run(New MainGUI.MDIMain)
> Else
> ShowWindowAsync(RunningProcesses(0).MainWindowHandle,
> ShowWindowConstants.SW_SHOWMINIMIZED)
> ShowWindowAsync(RunningProcesses(0).MainWindowHandle,
> ShowWindowConstants.SW_RESTORE)
> End If
> End Sub
>
> "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:eHX33A%235FHA.3416@xxxxxxxxxxxxxxxxxxxxxxx
>> See the article in Windows Forms Tips and Tricks.
>>
>> It doesn't use a mutex but it does bring the running application to the
>> foreground.
>>
>> --
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Ramuseco Limited .NET consulting
>> http://www.ramuseco.com
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>>
>>
>> "Brian P. Hammer" <BrianHammer@xxxxxxxxxxxxxxxx> wrote in message
>> news:uvSogH95FHA.4036@xxxxxxxxxxxxxxxxxxxxxxx
>>> All - I have used mtux to check for a running app and close it down if
>>> it a previous app instance is running. Now, when a user double clicks
>>> on one of the saved application files, I'd like for the existing
>>> instance of the application to come to the front and use the file the
>>> user double clicked. I have no issues doing this when no instance of the
>>> app is running but if it is already running, how do I go about this?
>>>
>>> Thanks,
>>> Brian
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Use Running App
- From: Bob Powell [MVP]
- Re: Use Running App
- References:
- Use Running App
- From: Brian P. Hammer
- Re: Use Running App
- From: Bob Powell [MVP]
- Re: Use Running App
- From: Brian P. Hammer
- Use Running App
- Prev by Date: Re: Use Running App
- Next by Date: Re: Use Running App
- Previous by thread: Re: Use Running App
- Next by thread: Re: Use Running App
- Index(es):
Relevant Pages
|
Loading