?
Solved

VB program will not come to front in all cases

Posted on 2002-04-23
6
Medium Priority
?
160 Views
Last Modified: 2010-05-02
I have written a program that limits my kids time on the computer.  It basically has a timer that runs in the background and when the allowable time is up, a screen covers the screen.  

The problem is certain games, "Need for Speed III" and "Game of Life" do not allow the timer program to get focus and therefore the kids can go over the time in them.

Is there a way to force a program to get focus a certain number of times per minute or second?

0
Comment
Question by:sdbanks
[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 Comments
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6964605
sdbanks

You can rather close the game program first and bring the focus to your screen.

The following is the link to close any program.

http://www.freevbcode.com/ShowCode.Asp?ID=2781

http://www.freevbcode.com/ShowCode.Asp?ID=935

Option Explicit

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Const WM_CLOSE = &H10

Public Sub CloseProgram(ByVal Caption as String)

 Handle= FindWindow(vbNullString, Caption)
 If Handle = 0 Then Exit Sub
 SendMessage Handle, WM_CLOSE, 0&, 0&

End Sub

Hope this will solve your problem.

Narayanan.
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6964611
Another link for you

http://www.freevbcode.com/ShowCode.Asp?ID=1453

Narayanan
0
 
LVL 1

Expert Comment

by:delloro
ID: 6964750
What about:

AppActivate me.caption

if you have a form and a name for the form you are using.

?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:sdbanks
ID: 6966914
Thanks for your comments.

The problem I am having is that my program never gets any CPU time to do anything with the previously mentioned programs ("Need for Speed III").  They seem to be designed to use the pc exclusively.  What I need is a method to ensure my pc gets some CPU time in order to do its checks.

Unless I can get some CPU time, I cannot do anything.  That would include trying to close the offending programs.



0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7660778
Hi sdbanks,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

sdbanks, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7755405
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

743 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