c++builder隐藏程序任务栏图标 .

1.

void __fastcall TfrmLogHook::FormCreate(TObject *Sender)
{

DWORD dwExStyle=GetWindowLong(Application->Handle,GWL_EXSTYLE); //这三行是运行后任务栏
  dwExStyle |=WS_EX_TOOLWINDOW;                                 //无法看到程序
  SetWindowLong(Application->Handle,GWL_EXSTYLE,dwExStyle);     //Alt+Tab也看不到,只有任务管理器中能看到进程
}

2.

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
        try
        {
                 Application->Initialize();
                 Application->CreateForm(__classid(TForm1), &Form1);
                 Application->ShowMainForm   =   false;             //增加这一行和下面一行
                 ShowWindow(Application->Handle,   SW_HIDE); 
                 Application->Run();
        }
        catch (Exception &exception)
        {
                 Application->ShowException(&exception);
        }
        catch (...)
        {
                 try
                 {
                         throw Exception("");
                 }
                 catch (Exception &exception)
                 {
                         Application->ShowException(&exception);
                 }
        }
        return 0;
}

你可能感兴趣的:(c++builder隐藏程序任务栏图标 .)