App In Memory

  • Thread starter Thread starter MDB
  • Start date Start date
M

MDB

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

}

}
 
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 said:
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 said:
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
 
Thanks, I will look into that instead.


Chris Tacke said:
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 said:
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 said:
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
to
 
Back
Top