I am writing a application where i need to know which games are installed on a system.

I have 3 ways by which i think i can detect the games

1: Scan specific parts of registry and look for key names that match with a List of Publishers. The list is manually maintained.

2: Scan the hard disk for and do same as in step 1

3: run the program in background and check for programs in memory that use a large portion of memory(which games always do) and if they use Direct X ( Which all games do except for some) then its a game.

Now i have been thinking about it and first and second method seems to be in need of a updated database ie list of publishers to make out if a particular program is game.

Is there any other more efficient way to do it. If there is please let me know.

Thankyou.

Recommended Answers

All 6 Replies

actually solution 1 is the best solution for two reasons:
1. you are in control what games should be in list
2. the most easy way if u provide a xml file online where your game can check for new games

solution 2 is bad as some geeks have 2TB of space. takes a long tme to scan. and not every player is installing games on the windows partition

solution 3 is horrible at all. except you want handle in example Visual Studio, ed max and so on as a game too :p

well what about using all these 3 methods ?

Reasons:

1. Method 1 looks in registry, but you know there is a fair chance that registry might not exist , (reason : window reinstalled)

2. Second method looks only in folder named Program files, simply because each game is installed in a folder named program files no matter which drive you choose ( even i dont store games in c , but then i only change drive letter in default path not the whole of it)

3. In a rare case deficiency of method 2 to not search in folder other than prog files can be compensated. Provided third method is eficient enough.

Actually know how to perform all these three methods, but before i go on to write code for em i want to make sure i am going for the most efficient method. this is the reason why i started this thread.

disagreed :p

ok lets take a look on my PC

HDD space = 2,5 TB
Games location:
C:\-=GAMES=-\-=SOF II=-
C:\-=GAMES=-\Call of Duty 4
C:\-=GAMES=-\Steam
and so on

Windows Partition:
H:\

2/5 games present in my registry

biggest memory:
Photoshop
Visual Studio
Cinema 4D

disagreed :p

ok lets take a look on my PC

HDD space = 2,5 TB
Games location:
C:\-=GAMES=-\-=SOF II=-
C:\-=GAMES=-\Call of Duty 4
C:\-=GAMES=-\Steam
and so on

Windows Partition:
H:\

2/5 games present in my registry

biggest memory:
Photoshop
Visual Studio
Cinema 4D

I agree with you but when you develop something for the masses you dont take into account the race exceptions.

I am talking about what people generally do, advanced users might want to change the installation path or even the os installation path etc etc but then majority of people dont.

And i know these things thats why i am here in the first place, to ask if there is any better method for doing this, you are not suggesting any solution but questioning my own methods instead.

I hope you got it what i mean. Sorry if you think i am being rude.

I am writing a application where i need to know which games are installed on a system.

1. Method 1 looks in registry, but you know there is a fair chance that registry might not exist , (reason : window reinstalled)

Method 1 of checking the registry is the way you should go about doing this. You asked how to detect games that were installed on a system. If they reinstall Windows then the game is not installed, so it doesn't matter. If someone formats a computer and sells it to a new owner -- what does it matter? The registry entries will turn up eventually if they intend to game. Have your application check for it periodically.

Method 1 of checking the registry is the way you should go about doing this. You asked how to detect games that were installed on a system. If they reinstall Windows then the game is not installed, so it doesn't matter. If someone formats a computer and sells it to a new owner -- what does it matter? The registry entries will turn up eventually if they intend to game. Have your application check for it periodically.

hey thanks guys for replying. I got it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.