更新时间:2023-09-11 14:46:34
您需要将字符串终止为null。只需将声明切换为使用 PChar
。
You need to null terminate the string. Just switch the declaration to use a PChar
.
您还必须停止将指针转换为32位 Integer
会将64位指针截断为32位指针,这很容易导致痛苦。
You must also stop casting pointers to 32 bit Integer
which will truncate a 64 bit pointer to a 32 bit pointer, and that can easily lead to pain.
t使用aResult,传递nil。您的未初始化指针显然是一个问题。
Since you don't use aResult, pass nil. Your uninitialized pointer is obviously a problem.
procedure BroadcastChange;
begin
SendMessageTimeout(
HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
LPARAM(PChar('Environment')),
SMTO_NORMAL,
4000,
nil
);
end;