[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2006-07-14
8
Medium Priority
?
223 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

650 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