Solved

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

Posted on 2006-07-14
8
215 Views
Last Modified: 2013-11-20
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
Comment
Question by:haroldxious
  • 6
  • 2
8 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17106468
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
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17106474
you can put above code on initinstance of your application
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17106523
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
 
LVL 1

Author Comment

by:haroldxious
ID: 17119004
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Expert Comment

by:mahesh1402
ID: 17119579
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
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 100 total points
ID: 17120223
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
 
LVL 1

Author Comment

by:haroldxious
ID: 17127896
i guess there is no chance of knowing if my application is the first one to be loaded
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17128036
>>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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short film showing how OnPage and Connectwise integration works.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now