Re: Use Running App



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
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: Use Running App
    ... Brian ... Public Shared Function ShowWindowAsync(ByVal hWnd As IntPtr, ... Public Shared Sub Main ... >> a previous app instance is running. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Windows.. its like coming home!
    ... gradual transition, especially in going from OS 9 to OS X. ... They needed something that could compete with Windows, ... mean by the "2 of every app" comment before - Apple took whatever apps ... I've found that because the Dock shows applications rather than windows, ...
    (comp.sys.mac.advocacy)
  • Re: Windows.. its like coming home!
    ... gradual transition, especially in going from OS 9 to OS X. ... They needed something that could compete with Windows, ... mean by the "2 of every app" comment before - Apple took whatever apps ... I've found that because the Dock shows applications rather than windows, ...
    (comp.sys.mac.advocacy)
  • RE: Beginners Questions
    ... We do use Windows form on the presentation layer which is on ... terminal server and call web services on the business logic side. ... of using "proxy" authentication on SQL Server. ... > I have written an app with a Windows Forms UI that is deployed to clients ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Frustration level with Windows -- ARG!
    ... I can have an app sieze and you can go take a ten ... That is MS-Outlook, not Windows. ... to the processes tab, not the applications tab. ... and it tries to stop them "gently" if it can, before resorting to kill -9. ...
    (comp.sys.mac.advocacy)

Loading