PC Review


Reply
Thread Tools Rate Thread

App In Memory

 
 
MDB
Guest
Posts: n/a
 
      18th Aug 2004
Is there a way to find out if an app is already running in memory before
starting up a new app and if so remove it pragmatically before starting up
the app again? I am running into problems where the app appears not to be
running however, it is in the background.

TIA

MDB


 
Reply With Quote
 
 
 
 
MDB
Guest
Posts: n/a
 
      19th Aug 2004
If anyone looked at this thanks however, I think I figured it out using this
bit of code.


[DllImport("coredll.dll", EntryPoint="FindWindow")]

private static extern int FindWindow(string strClass, string strWindow);

public static bool IsInstanceRunning()

{

string appname =
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;

int temp = FindWindow(null, appname);

if(temp != 0)

{


return true;

}

else

{


return false;

}

}





"MDB" <nospam> wrote in message
news:%23FOm%(E-Mail Removed)...
> Is there a way to find out if an app is already running in memory before
> starting up a new app and if so remove it pragmatically before starting up
> the app again? I am running into problems where the app appears not to be
> running however, it is in the background.
>
> TIA
>
> MDB
>
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      19th Aug 2004
You're looking for an instance of yourself? If that's the case you have
code control, set a mutex at startup and look for that, which is the correct
way, instead of a window search hack.

-Chris

"MDB" <nospam> wrote in message
news:e6S%(E-Mail Removed)...
> If anyone looked at this thanks however, I think I figured it out using

this
> bit of code.
>
>
> [DllImport("coredll.dll", EntryPoint="FindWindow")]
>
> private static extern int FindWindow(string strClass, string strWindow);
>
> public static bool IsInstanceRunning()
>
> {
>
> string appname =
> System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
>
> int temp = FindWindow(null, appname);
>
> if(temp != 0)
>
> {
>
>
> return true;
>
> }
>
> else
>
> {
>
>
> return false;
>
> }
>
> }
>
>
>
>
>
> "MDB" <nospam> wrote in message
> news:%23FOm%(E-Mail Removed)...
> > Is there a way to find out if an app is already running in memory before
> > starting up a new app and if so remove it pragmatically before starting

up
> > the app again? I am running into problems where the app appears not to

be
> > running however, it is in the background.
> >
> > TIA
> >
> > MDB
> >
> >

>
>



 
Reply With Quote
 
MDB
Guest
Posts: n/a
 
      20th Aug 2004
Thanks, I will look into that instead.


"Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You're looking for an instance of yourself? If that's the case you have
> code control, set a mutex at startup and look for that, which is the

correct
> way, instead of a window search hack.
>
> -Chris
>
> "MDB" <nospam> wrote in message
> news:e6S%(E-Mail Removed)...
> > If anyone looked at this thanks however, I think I figured it out using

> this
> > bit of code.
> >
> >
> > [DllImport("coredll.dll", EntryPoint="FindWindow")]
> >
> > private static extern int FindWindow(string strClass, string strWindow);
> >
> > public static bool IsInstanceRunning()
> >
> > {
> >
> > string appname =
> > System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
> >
> > int temp = FindWindow(null, appname);
> >
> > if(temp != 0)
> >
> > {
> >
> >
> > return true;
> >
> > }
> >
> > else
> >
> > {
> >
> >
> > return false;
> >
> > }
> >
> > }
> >
> >
> >
> >
> >
> > "MDB" <nospam> wrote in message
> > news:%23FOm%(E-Mail Removed)...
> > > Is there a way to find out if an app is already running in memory

before
> > > starting up a new app and if so remove it pragmatically before

starting
> up
> > > the app again? I am running into problems where the app appears not

to
> be
> > > running however, it is in the background.
> > >
> > > TIA
> > >
> > > MDB
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make MODI.Document not leak memory? I have millions of images to OCR but each time i OCR one it leaks memory. How to do the OCR and then clean up so that my app doesnt leak memory? DR Microsoft Dot NET Framework 1 4th Feb 2008 11:41 PM
My available memory is down to very little, yet my PF Usage is 8 gigabytes (about how much memory is on the box), sql server keeps having memory issues yet the sqlservr.exe is using hardly any memory.. how to fix this? is there some way to limit how Daniel Microsoft Windows 2000 Security 1 30th Aug 2007 07:38 AM
My available memory is down to very little, yet my PF Usage is 8 gigabytes (about how much memory is on the box), sql server keeps having memory issues yet the sqlservr.exe is using hardly any memory.. how to fix this? is there some way to limit how Daniel Microsoft Windows 2000 1 30th Aug 2007 01:22 AM
My available memory is down to very little, yet my PF Usage is 8 gigabytes (about how much memory is on the box), sql server keeps having memory issues yet the sqlservr.exe is using hardly any memory.. how to fix this? is there some way to limit how Daniel Microsoft Windows 2000 Networking 0 28th Aug 2007 12:38 AM
My available memory is down to very little, yet my PF Usage is 8 gigabytes (about how much memory is on the box), sql server keeps having memory issues yet the sqlservr.exe is using hardly any memory.. how to fix this? is there some way to limit how Daniel Microsoft Windows 2000 Advanced Server 0 28th Aug 2007 12:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:02 PM.