5,388
社区成员
发帖
与我相关
我的任务
分享
time1 := TDateTimePicker(FindControl(nDateTime[1]));
if time1 <> nil then
time1.DateTime := strtodatetime('2017-11-11');
function FindControlEx(Handle: hWnd): TWinControl;
var
OwningProcess: DWORD;
ControlAtomString: string;
RM_GetObjectInstance: Cardinal;
begin
result := nil;
if (Handle <> 0) and (GetWindowThreadProcessID(Handle, OwningProcess) <> 0)
and (OwningProcess = GetCurrentProcessId)
then
begin
ControlAtomString := Format('ControlOfs%.8X%.8X',
[GetModuleHandle(nil), GetWindowThreadProcessID(Handle, OwningProcess)]);
if GlobalFindAtom(pchar(ControlAtomString)) <> 0 then
begin
result := Pointer(GetProp(Handle,
MakeIntAtom(GlobalFindAtom(pchar(ControlAtomString)))))
end
else
begin
RM_GetObjectInstance := RegisterWindowMessage(pchar(ControlAtomString));
result := Pointer(SendMessage(Handle, RM_GetObjectInstance, 0, 0));
end;
end;
end;
time1 := TDateTimePicker(FindControl(nDateTime[1]));
if time1 <> nil then
time1.DateTime := strtodatetime('2017-11-11 12:12:12');
试下是否可以 ?