是一个对话框程序.我从另外一个程序中启动它,但不想看到第2个任务栏图标.#include <windows.h>
#include "resource.h"char buffer[255];BOOL CALLBACK PromptDlgProc(HWND,UINT,WPARAM,LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstnce, LPSTR lpCmdLine, int nShowCmd)
{
    strcpy(buffer,lpCmdLine);
    DialogBox(hInstance,MAKEINTRESOURCE(IDD_PROMPT),NULL,PromptDlgProc);
    return 0;
}BOOL CALLBACK PromptDlgProc (HWND hDlg, UINT message, 
                             WPARAM wParam, LPARAM lParam)
{
    HDC            hdc;
    HFONT        holdfont,hnewfont;
    PAINTSTRUCT    ps;
    RECT        rect_client,rect_window;
    int            cxScreen,cyScreen;
    
    switch (message)
    {
    case WM_INITDIALOG :
        cxScreen = GetSystemMetrics (SM_CXSCREEN) ;
        cyScreen = GetSystemMetrics (SM_CYSCREEN) ;
        GetWindowRect(hDlg,&rect_window);
        MoveWindow(hDlg,(cxScreen-(rect_window.right-rect_window.left))/2,
            (cyScreen-(rect_window.bottom-rect_window.top))/2,
            rect_window.right-rect_window.left,
            rect_window.bottom-rect_window.top,
            TRUE);
        return TRUE ;
        
    case WM_COMMAND :
        switch (LOWORD (wParam))
        {
        case IDOK :
        case IDCANCEL :
            EndDialog (hDlg, 0) ;
            return TRUE ;
        }
        break ;
        case WM_PAINT :
            hdc=BeginPaint(hDlg, &ps);
            GetClientRect(hDlg,&rect_client);
            SetBkMode(hdc,TRANSPARENT);
            hnewfont=CreateFont(
                10,                        // nHeight
                0,                         // nWidth
                0,                         // nEscapement
                0,                         // nOrientation
                FW_NORMAL,                   // nWeight
                FALSE,                     // bItalic
                FALSE,                     // bUnderline
                0,                         // cStrikeOut
                ANSI_CHARSET,              // nCharSet
                OUT_DEFAULT_PRECIS,        // nOutPrecision
                CLIP_DEFAULT_PRECIS,       // nClipPrecision
                DEFAULT_QUALITY,           // nQuality
                DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
                "MS Sans serif");          // lpszFacename
            holdfont=SelectObject(hdc,hnewfont);
            DrawText(hdc,buffer,-1,&rect_client,
                DT_SINGLELINE|DT_CENTER|DT_VCENTER);
            EndPaint(hDlg,&ps);
            SelectObject(hdc,holdfont);
            DeleteObject(hnewfont);
            return 0;
    }
    
    return FALSE ;
}

解决方案 »

  1.   

    把它隐藏起来就可以了啊:
    ShowWindow(SW_HIDE);
      

  2.   

    ShowWindow(SW_HIDE);
    这样的话是不是连窗口都没有了?
      

  3.   

    ::SetWindowLong(hWnd,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
      

  4.   

    在case WM_INITDIALOG :后面
    先添上
    ::SetWindowLong(hDlg,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
      

  5.   

    谢谢大家,我试试先
    各位帮我回一下以下这贴,每人回复我想结贴都不行,影响我信誉分啊
    http://community.csdn.net/Expert/topic/4182/4182062.xml?temp=.0710718
      

  6.   

    handsomerun(毛毛),你的方法可以,但是显示出来的对话框跟以前不同了,没有立体感,而且被覆盖后重新出现不会重绘,这显然不太好
      

  7.   

    解决了,直接在对话框模板的属性中勾选Extended Style-->Tool Window,不用代码控制.