I have a Windows Service that creates a WindowClass inside it. This window will be used to make IPC (inter-process communication) between 2 programs.
This service works 100% correctly in:
- Windows XP
- Windows Vista (32 and 64 bits)
- Windows 7 (32 and 64 bits)
- Windows 8 (32 and 64 bits)
- Windows Server 2003
- Windows Server 2008 R2 (32 and 64 bits)
Only on Windows Server 2008 Standart it doesn't works, resulting the error:
System Error. Code: 8. Not enough storage is available to process this command.
This is the code:
constructor TMyIPC.Create;
function _CreateUUID: string;
var
g: TGUID;
begin
if CreateGUID(g) = S_OK then
Result := GUIDToString(g)
else
Result := FormatDateTime('yyyyMMddhhnnsszzz', now);
end;
begin
FillChar(fWndClass, sizeOf(fWndClass), 0);
with fWndClass do
begin
lpfnWndProc := @DefWindowProc;
lpszClassName := StrNew(PChar(_CreateUUID));
end;
fObjectInst := classes.MakeObjectInstance(WndProc);
if RegisterClass(fWndClass) = 0 then
RaiseLastOSError;
fHandle := CreateWindow(fWndClass.lpszClassName, fWndClass.lpszClassName,
WS_POPUP or WS_CAPTION or WS_CLIPSIBLINGS or WS_SYSMENU
or WS_MINIMIZEBOX,
GetSystemMetrics(SM_CXSCREEN) div 2,
GetSystemMetrics(SM_CYSCREEN) div 2,
0, 0, 0, 0, HInstance, nil);
if fHandle = 0 then
RaiseLastOSError;
SetWindowLong(fHandle, GWL_WNDPROC, Longint(fObjectInst));
end;
I already verified this question System Error. Code: 8. Not enough storage is available to process this command but it isn't the case (I run the same code inside a VCL application and the error doesn't occurs, it only occurs running inside a service).