Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Program Active even if user is using another program

Status
Not open for further replies.

davman2002

Programmer
Nov 4, 2002
75
0
0
US
I want to know if there is a way to at a certain point of the program to make it the active program that appears on the screen even if the user is currently using another program.
 
The only way i know of is Modal Dialog boxes in Visual C++. Try to look for more help in the regards, which would give lead you to your answers.

Cheers
KK
 
You could run a program in the background, minimuzed to task bar, or as a service. Using a TTimer component, you could set a timer to cause the program to become active.

BTW, you can do modal program in BCB, too.
James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
I have tried to do what you have suggested but still no luck here is my code. I would appreciate any help you can give

#include <vcl.h>
#pragma hdrstop
#include <mmsystem.h>
#include &quot;L4.h&quot;
#include <L4F2.h>
//----------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TfrmMain *frmMain;
//----------------------------------------------------------
__fastcall TfrmMain::TfrmMain(TComponent* Owner)
: TForm(Owner)
{
}
//----------------------------------------------------------
void __fastcall TfrmMain::tmrMainTimer(TObject *Sender)
{
lblClock->Caption = DateTimeToStr(Now());
frmSetAlarm->lblDateTime->Caption = DateTimeToStr(Now());
if (frmMain->lblClock->Caption == DateTimeToStr(frmSetAlarm->cboTime->DateTime))
AlarmOn = true;
if (AlarmOn == true)
Alarm();
}
//----------------------------------------------------------

void __fastcall TfrmMain::mnuSetAlarmClick(TObject *Sender)
{
//
// Show set alarm Window
//
AlarmOff();
frmSetAlarm->Show();
}
//----------------------------------------------------------

void __fastcall TfrmMain::mnuCloseAlarmClick(TObject *Sender)
{
//
// Turn Off Alarm
//
AlarmOff();
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::Alarm(void)
{
//
// display that the alarm has been set off by doing what the user has selected
//
if (frmSetAlarm->Play_Sound == true)
{
frmSetAlarm->Play_Sound = false;
sndPlaySound(&quot;clock.wav&quot;,SND_ASYNC);
} //End if

if (frmSetAlarm->Show_Message == true)
{
frmSetAlarm->Show_Message = false;
ShowMessage (frmSetAlarm->AlarmMessage);
} //End if
if (frmSetAlarm->Flash_Screen == true)
if (frmMain->Color == clYellow)
{
frmMain->Color = clBtnFace;
lblAlarm->Visible = true;
}
else
{
frmMain->Color = clYellow;
lblAlarm->Visible = false;
} //End if
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::AlarmOff(void)
{
//
// Turn Off Alarm
//
AlarmOn = false;
lblAlarm->Hide();
frmMain->Color = clBtnFace;
frmSetAlarm->Flash_Screen = false;
}
 
Application->Restore();

to restore from the taskbar.
I think we are doing something similiar.

I have an alarm clock on my web site that I have been working on for a couple of months. Since I have it as a stayontop app I havent considered this process. The sound does pop up when the alarm goes off and I have been content with this. I was comtemplating some revisions and I am waiting patiently for the process by which I can bring my app to the forground to be revealed.

tomcruz.net

ps - were is your snooze button? ;)
 
butthead, I considered a snooze button and decided that I would wait and see if anyone would really use it. I however have included a few revisions since my previous posts. I have added a tray icon, which seemed to help with the Application->Restore(); and a few other user enchancements.
 
Go to tomcruz.net and go to the downloads section.
get the &quot;PCClock&quot; and check it out. If you like I will
send you the full version. The only advantage of the full version is that it can be used as a screensaver also. Maybe you could get some ideas. I have many pc's running in my house and I have set my computer in the bedroom which is the internet server for my house to run this clock. A selling point is that if the power goes out and the pc reboots you dont have to reset the clock. Its real cool to wake up to the 'doors' or any other mischiveous wave file you choose.
 
butthead, I have seen your clock program and I like. I am interested in your code and would appreciate if you could send it to me. My email Address is Dharris57@houston.rr.com.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top