Solved

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

Posted on 2006-07-14
8
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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