delphi - How can I remove the additional icon on the task bar when I use both VCL and FMX? -


this question has answer here:

if create delphi vcl application default have 1 vcl form , if run application there 1 icon on task bar. after if add fmx form it, can have both forms , use them both. in task bar when application running there 2 icon. there anyway remove 1 title project name , keep other main form?

i using delphi xe8.

i found answer. funny. 2 days searching , no success found answer after posted question. answer myself maybe useful person.

i found code on page https://github.com/vintagedave/firemonkey-container/blob/master/parnassus.fmxcontainer.pas

function enumwindowcallback(hwnd: hwnd; lparam: lparam): bool; stdcall; const   fmxclassname = 'tfmappclass'; var   processid : dword;   classname : string;   classnamelength : nativeint; begin   // xe4 (possibly others) show phantom tfmappclass window on taskbar.  hide it.   // ensure 1 hide belongs thread / process - don't damage other fmx apps   if (getwindowthreadprocessid(hwnd, processid) = getcurrentthreadid) , (processid = getcurrentprocessid) begin     // ubiquitous david heffernan... http://stackoverflow.com/questions/7096542/collect-all-active-window-class-names     setlength(classname, 256);     classnamelength := getclassname(hwnd, pchar(classname), length(classname));     if classnamelength = 0 raiselastoserror;     setlength(classname, classnamelength);     if classname = fmxclassname begin       // found.  hide it, , return false stop enumerating       showwindow(hwnd, sw_hide);       exit(false);     end;   end;   result := true; // fallthrough, keep iterating end; 

if use following code use it, other icon on task bar hidden

  enumwindows(@enumwindowcallback, 0); 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -