Mega Code Archive

 
Categories / Delphi / Examples
 

Opening the date-time properties dialog

Do you need the API call that would bring up the Date/Time Properties Dialog? The code below brings up the dialog that you get when you double click on the time in the task bar. function GetSystemDir: string; var SysDir: PChar; begin GetMem(SysDir, MAX_PATH); GetSystemDirectory(SysDir, MAX_PATH); Result := StrPas(SysDir); FreeMem(SysDir, MAX_PATH); if (Result[Length(Result)] <> '\') then Result := Result + '\'; end; procedure TForm1.Button1Click(Sender: TObject); begin ShellExecute(0, nil, PChar(GetSystemDir + 'rundll32.exe'), PChar('shell32.dll,Control_RunDLL Timedate.cpl'), PChar(GetSystemDir), SW_SHOW); end;