Delphi65
Members-
Content Count
10 -
Joined
-
Last visited
Everything posted by Delphi65
-
Dear all, I am trying to run a schedule as following where i have: Checkbox (if the schedule is enabled for the day or not, every day has it's own checkbox such as: checkboxMonday, checkboxTuesday etc.) Time field (edit showing now) Day field (memo showing the today) Time field (showing at what time to run the schedule) Now, any ideas of how to combine all this inside one procedure? What i am chasing is something like this: Procedure Tform1.CollectData; begin if checkboxMonday is checked and memofield is showing "Monday" and TimeNow is equal to TimeMonday then begin CollectData; end else ShowMessage('Event is not scheduled'); end; Is this possible? If not, what do i need? Thanks for all the answers.
-
Thanks Lars! Yes, correct, my timer will look up for "Now" and compare. The events will happen only once a day that could be for example today Wednesday at 20:15. I could however make my timer to check once every 10 minutes. My event time slots are also specific, they will be different for each day.
-
Thank you! I am using Delphi Berlin. Yes, my memo gives me the day, and my checkbox tell me if the event is set or not. I have my time edit also which gives me the current time. I am planning to use a timer to do the checks. If the event is enabled, it will check the day and time and if the enabled day and time matches with the current day and time, it will run the event. I have all the required data, i just need to figure out how to run the event because i need to make sure the current day and time matches with the day and time behind that checkbox which is enabled. Or if you have any suggestions of how to do this schedule daily at selected time, please shoot me.
-
Hi guys, I have been using the following for earlier version of windows. Many thanks in advance!
-
Thank you to all! I have done the following and both Turn On/TurnOff works. interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; type TfrmPowerControl = class(TForm) btnOFF: TButton; btnExit: TButton; Label1: TLabel; btnON: TButton; timerTurnOffDisplay: TTimer; procedure btnOFFClick(Sender: TObject); procedure btnONClick(Sender: TObject); procedure btnExitClick(Sender: TObject); procedure timerTurnOffDisplayTimer(Sender: TObject); private { Private declarations } public { Public declarations } end; var frmPowerControl: TfrmPowerControl; implementation {$R *.dfm} const MONITOR_ON = -1; MONITOR_OFF = 2; MONITOR_STANDBY = 1; procedure TfrmPowerControl.btnOFFClick(Sender: TObject); begin PostMessage(HWND_BROADCAST , WM_SYSCOMMAND, SC_MONITORPOWER, 2); end; procedure TfrmPowerControl.btnExitClick(Sender: TObject); begin Close; Application.Terminate; end; procedure TfrmPowerControl.btnONClick(Sender: TObject); begin PostMessage(HWND_BROADCAST , WM_SYSCOMMAND, SC_MONITORPOWER, -1); end; procedure TfrmPowerControl.timerTurnOffDisplayTimer(Sender: TObject); begin //PostMessage(HWND_BROADCAST , WM_SYSCOMMAND, SC_MONITORPOWER, 2); end; end.
-
My problem is that i cannot turn the display off. Yes, you are correct, it can be turned on by using a key press.
-
I have the same, user is the administrator.
-
I have tested with two different PC where both were pretty same and both with administrator account.
-
It doesn't work for me. Not with timer nor a button. I also have Windows 10 22H2 64bit
-
Thanks Uwe! I have tried it, it has no impact, it doesn't turn the display off.