• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

How to know if my application is the first one that is uploaded to the OS....

Hello,

i just want to know if my application is the first to be loaded by the OS.

and if not, how will i make my application the 1st one to be uploaded.
0
haroldxious
Asked:
haroldxious
  • 6
  • 2
1 Solution
 
mahesh1402Commented:
you can do that by the creation of mutexes ...

Something like this :


HANDLE hMutex = CreateMutex(0, FALSE, "MyUniqueString");

      if (hMutex && (GetLastError() != ERROR_ALREADY_EXISTS))
         // Cool, we are the first and only instance.
      else
        // Drat, we are some other instance!  Do appropriate processing like display error / message etc

      CloseHandle(hMutex);


-MAHESH

0
 
mahesh1402Commented:
you can put above code on initinstance of your application
0
 
mahesh1402Commented:
Sample :

How to limit 32-bit applications to one instance in Visual C++
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q243953

-MAHESH
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
haroldxiousAuthor Commented:
mahesh thanx for the comment but what i mean is i want to know if my application is the first application to be loaded by the OS for example when you start windows it will load the apps on the taskbar like, virus scanners, instant messabgers etc. i want to make my application be the first to be loaded.

im doing this because i want to check the available memory of my pc before i load all the programs.

any suggestions on how can i check the available memory before all my programs are loaded by windows?
0
 
mahesh1402Commented:
I am not sure how you can check if your program is first in loading que...or may be its possible by enumerating process and checking if there anyother process running or not..
but for checking available global memory you may use function GlobalMemoryStatus().

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp

-MAHESH
0
 
mahesh1402Commented:
you may look into various articles with src at codeproject process section to retrieve current active process list which help you to know if your application is first loaded by OS

Refer :
http://www.codeproject.com/threads/#Processes

-MAHESH
0
 
haroldxiousAuthor Commented:
i guess there is no chance of knowing if my application is the first one to be loaded
0
 
mahesh1402Commented:
>>i guess there is no chance of knowing if my application is the first one to be loaded

How you will be able to load your application as First application in Process Que ? As Your OS loads various types of processes and services at startup...and obviously they are having higher priority than your application.. you need to findout how much memory they consumes by enumerating current processes....

-MAHESH
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now