Solved

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

Posted on 2006-07-14
8
214 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
Comment Utility
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
Comment Utility
you can put above code on initinstance of your application
0
 
LVL 22

Expert Comment

by:mahesh1402
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 22

Expert Comment

by:mahesh1402
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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. …
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

8 Experts available now in Live!

Get 1:1 Help Now