473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Determining whether an application has been entered or exited

TNT
48
My sister is notorious at leaving game CD-ROMs in the computer.
I want to create an application that detects when she enters the game, then detects when you exit it. When you exit it, I want it toshow a message box with a reminder.

How do I get my programme to detect when she enters and then exits the game?
Feb 27 '07 #1
10 1578
Killer42
8,435 Expert 8TB
Try searching (see the search box at top-right) for information about enumerating executing processes, or open windows. You should be able to set a flag when you see a particular process or window appear, then show a popup when it disappears.
Feb 28 '07 #2
willakawill
1,646 1GB
My sister is notorious at leaving game CD-ROMs in the computer.
I want to create an application that detects when she enters the game, then detects when you exit it. When you exit it, I want it toshow a message box with a reminder.

How do I get my programme to detect when she enters and then exits the game?
This would be a TSR (terminate and stay resident) program which remains running in the background in memory using up clicks and space. Usually computer games take over the entire environment and then restore it when exited. I think it might be extremely tricky to get this working especially in vb. Why don't you buy her a piece of candy every time she remembers to remove the dvd?
Feb 28 '07 #3
Killer42
8,435 Expert 8TB
This would be a TSR (terminate and stay resident) program which remains running in the background in memory using up clicks and space. Usually computer games take over the entire environment and them restore it when exited. I think it might be extremely tricky to get this working especially in vb. Why don't you buy her a piece of candy every time she remembers to remove the dvd?
Smart move. :) Good example of lateral thinking, that.

As for the rest, that would really depend on whether it's a Window-aware game, wouldn't it? My guess is that most are, these days. It has been some time since I saw one that had to reboot to DOS mode to run.
Feb 28 '07 #4
willakawill
1,646 1GB
Smart move. :) Good example of lateral thinking, that.

As for the rest, that would really depend on whether it's a Window-aware game, wouldn't it? My guess is that most are, these days. It has been some time since I saw one that had to reboot to DOS mode to run.
Yup I remember running space commander on 1mb ram. It came on one floppy disk. I had a 33mhz olivetti with 30mb disk. I had to locate all of the TSRs and stop them from running because they did not leave me enough memory for the game. Never forgot that lesson cause it took a whole week to work it out.

good old compuserve was just about all there was back then with a half hour download for one jpg but it was all adventure.
Feb 28 '07 #5
Killer42
8,435 Expert 8TB
...good old compuserve was just about all there was back then with a half hour download for one jpg but it was all adventure.
Those were the days, huh? :D

(Not really...)
Feb 28 '07 #6
TNT
48
Smart move. :) Good example of lateral thinking, that.

As for the rest, that would really depend on whether it's a Window-aware game, wouldn't it? My guess is that most are, these days. It has been some time since I saw one that had to reboot to DOS mode to run.
What is "Window-aware"? Is there any simple code to detect the closure of the game? Would the application affect the speed of the game?
Mar 1 '07 #7
Killer42
8,435 Expert 8TB
What is "Window-aware"?
That was a typo. I meant "Windows-aware, meaning that it is designed to run under Windows. A lot of old MSDOS games would force you to reboot to a clean copy of DOS with various memory management software loaded, then restart Windows again afterward, which might make things much more complicated for you. If the game somehow takes total control of Windows as someone else here implied, not allowing your program to do anything until the game finishes, it seems to me that would actually be a good thing for you.

Is there any simple code to detect the closure of the game?
I'm not aware of anything readily available - after all, as far as Windows is concerned a game is usually just a program like any other. So you'll want to monitor what processes are running, and watch for a specific name.

Would the application affect the speed of the game?
That would depend how you code it. I'm sure you could use up lots of CPU and slow things down, but presumably you will design your software to minimise any such impact.

Try searching TheScripts for keywords such as VB and sleep and you'll find plenty of info on how to make Windows effectively ignore your program for a while, so it doesn't interfere.

You may also want to liberally sprinkle your code with DoEvents statements, to minimise the impact each time your application "wakes up and takes a look around". (This applies to VB6 - don't know about later versions).
Mar 1 '07 #8
Killer42
8,435 Expert 8TB
Alternatively, start hiding the CDROM every time it's left in the drive. A bit of wasted time searching for it might help it stick in the memory.
Mar 1 '07 #9
TNT
48
...I'm not aware of anything readily available - after all, as far as Windows is concerned a game is usually just a program like any other. So you'll want to monitor what processes are running, and watch for a specific name...

...You may also want to liberally sprinkle your code with DoEvents statements, to minimise the impact each time your application "wakes up and takes a look around". (This applies to VB6 - don't know about later versions).
How would I detect processes? What is the DoEvents statement?
Mar 1 '07 #10
Killer42
8,435 Expert 8TB
How would I detect processes? What is the DoEvents statement?
As for detecting processes, I'd suggest searching TheScripts (there's a search box at the top-right) for things like "vb enumerate processes".

As for the DoEvents statement, check the manual. But basically it just allows Windows to take time out from your code to go do whatever else needs doing.
Mar 1 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Cliff Wells | last post by:
Hi, I'm writing an application that needs to know if an Internet connection is available. Basically, I want to have something similar to what a lot of email clients have, where the app can work...
8
by: Mark English | last post by:
I'd like to write a Tkinter app which, given a class, pops up a window(s) with fields for each "attribute" of that class. The user could enter values for the attributes and on closing the window...
35
by: Dr.Tube | last post by:
Hi there, I have this web site (www.DrTube.com) which has the following DTD: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> which switches...
8
by: BigMan | last post by:
Are these two lines equivalent? #ifdef MACRO #if MACRO==0
1
by: Chris Morse | last post by:
Does anyone know how to profile a VB.NET application? In the VS.NET 2003 docs, I found this: (BEGIN DOC COPY) "A code profiler is a software tool, implemented as a DLL, which is called by...
1
by: whitehorse | last post by:
When the warehousecontroller service is invoked, the following error message is sent to the application log: Event Type: Error Event Source: TFS Warehouse Event Category: None Event ID: 3000...
1
by: Pete | last post by:
Hi All, I'm new to this so please correct me if I'm wrong. I have written a small program which holds details for task information. the program holds an email address, i created a button which...
4
by: Nathan Sokalski | last post by:
When determining whether a String can be converted to a DateTime, you can use the IsDate() method. However, I would also like to know whether the string is a date, a time, or both a date and a...
1
sid0404
by: sid0404 | last post by:
Hi I have created a web application which retrieves the data from the webstie, but since the data is too much to grab so occasionally i get the response time out exception as the reason for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.