17. dubna 2012 7:04
I am developing an application which will have collection of games ,when we click any one of the image it will run that particular game. Till this I done,
But in this application i have to check whether that particular game exe is 32bit or 64bit, then if that game is in 64bit,how to run it, or i need to run that game exe as administrator? How to do that,
Please help me with code example
17. dubna 2012 9:24
Running application as administrator does not guarantee you to be run as 64 bit.
Is all your game applications are developed in .net? If so, in .net any application can be developed targeting to
- Any CPU
If your game applications are compiled with “Any CPU” options then you do not really need to care about in what OS you are going to run. The underlying framework will take care I mean for 32 bit OS it will run as 32 bit application and for 64 bit OS, it will run as 64 bit application.
If your game applications are compiled with “X86” options, then you are some what safe. This means the project is intended to run only as a 32-bit process and it will run fine in 32 bit OS as well as can still run on 64-bit Windows, however it run under WOW64 of 64 bit OS.
If your game applications are compiled with X64 options, then you are in trouble as it intend to run only on 64 bit OS and cannot run on 32 bit OS.
So for safer side, make sure your all game applications are compiled with “Any CPU” options.
For more details refer-
Otherwise you need to maintain a repository of all your game applications metadat alike name, version (32bit/64bit) and path and on clicking of a image, verify the system’s environment using below line of code,
Then load the corresponding exe from the repository.
To find out programmatically a game is 32 bit or 64 bit, you have few solution over here,
18. dubna 2012 8:32Moderátor
Welcome to the MSDN Forum.
Does this method work for you? http://msdn.microsoft.com/en-us/library/53ezey2s.aspx
Process.Start("Your x64 file name path here");
If you don't try it, please try it and let me know the result, thank you.
And you want to run it as a administrator, so please make a new process, and set the startinfo.verb = "runas" http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.verb.aspx
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
21. dubna 2012 5:26is this code will work on both 32 and 64 bit os?
21. dubna 2012 5:59
This is the beauty of .net.You really do not need to write different code for 32 bit or 64 bit OS.
Yes, This code will work on both 32bit and 64 bit provided,project containing this code is compiled with "Any CPU" options, See my figure to set it to ANY CPU.
- Označen jako odpověď Mike FengMicrosoft Contingent Staff, Moderator 27. dubna 2012 11:44