I have a datamodule with a HWND handle that receives PostMessage calls.
The handle is allocated in the DataModuleCreate like this (TTNONVISUAL is not defined):
{$IFNDEF TTNONVISUAL}
FHWND := AllocateHWND(WindProc);
{$ELSE}
FHWND := 0;
{$ENDIF}
The data module is also used in a non-visual program where TTNONVISUAL is defined.
The WindProc in the datamodule is enclosed in {$IFNDEF TTNONVISUAL}, so in the non-visual program there is no WindProc and FHWND=0
In that program, will it be safe to do PostMessage calls to this 0 handle?
Note: The PostMessage does not send any additional data:
PostMessage(FHWND,WM_SYNC_PROGRESS,0,0)
and WM_SYNC_PROGRESS is WM_USER + 111 and there are no other WM_SYNC_PROGRESS handlers.