Why doesn’t Firemonkey create an application handle when there is a string in the global atom table that is the same as the modulename

  

Situation :
there is a string in the global atom table that is the same as my application. My Application does not create an application handle and I get an invalid window handle.

code from the FMX.Platform.Win

procedure TPlatformWin.CreateAppHandle;
var
//…
begin
//…
AtomName := ModuleName;
AppAtom := GlobalFindAtom(PChar(AtomName));
if AppAtom > 0 then begin
FApplicationHWND := 0; // FApplicationHWND = 0 and I get “invalid window handle”
end else begin
// FApplicationHWND is created

I have an old application where the exe has the same name. After closing it appearantly leaves a string in the globalatomtable ‘COM’. After closing this old application. I cannot longer open the new application because it keeps finding this ‘COM’ in the gloabal atom table, resulting in an ampty application handle and invalid window handles.

If I put the code in comments the application start perfect with a valid application handle.

// AtomName := ModuleName;
// AppAtom := GlobalFindAtom(PChar(AtomName));
// if AppAtom > 0 then begin
// FApplicationHWND := 0;
// end else

Comments are closed.