好象各个参数都试了一下,不成功,郁闷

解决方案 »

  1.   

    to gracezhu(eutom)
      我不想使用MFC而且我也没加WS_CAPTION
      

  2.   

    在 CreateWindow 或 CreateWindowEx 时将 dwStyle 置为 WS_POPUP | WS_VISIBLE 就行了,其他的不要。
      

  3.   

    to  pomelowu(羽战士) 
      能具体些吗??
      

  4.   

    try
    ::SetWindowLong(hWnd, GWL_STYLE, dwStyle& ~FWS_ADDTOTITLE);
      

  5.   

    现在没时间写个例子给你,应该可以实现的,参考一下msdn吧:SetWindowLong Function--------------------------------------------------------------------------------
    The SetWindowLong function changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.Note  This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Microsoft® Windows®, use the SetWindowLongPtr function.SyntaxLONG SetWindowLong(          HWND hWnd,
        int nIndex,
        LONG dwNewLong
    );
    ParametershWnd
    [in] 
    Handle to the window and, indirectly, the class to which the window belongs.Windows 95/98/Me: The SetWindowLong function may fail if the window specified by the hWnd parameter does not belong to the same process as the calling thread.nIndex
    [in] Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of the following values. 
    GWL_EXSTYLE
    Sets a new extended window style. For more information, see CreateWindowEx. 
    GWL_STYLE
    Sets a new window style.
    GWL_WNDPROC
    Sets a new address for the window procedure.Windows NT/2000/XP: You cannot change this attribute if the window does not belong to the same process as the calling thread.GWL_HINSTANCE
    Sets a new application instance handle.
    GWL_ID
    Sets a new identifier of the window.
    GWL_USERDATA
    Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
    The following values are also available when the hWnd parameter identifies a dialog box.
    DWL_DLGPROC
    Sets the new address of the dialog box procedure.
    DWL_MSGRESULT
    Sets the return value of a message processed in the dialog box procedure.
    DWL_USER
    Sets new extra information that is private to the application, such as handles or pointers.
    dwNewLong
    [in] Specifies the replacement value. 
    Return ValueIf the function succeeds, the return value is the previous value of the specified 32-bit integer.If the function fails, the return value is zero. To get extended error information, call GetLastError. If the previous value of the specified 32-bit integer is zero, and the function succeeds, the return value is zero, but the function does not clear the last error information. This makes it difficult to determine success or failure. To deal with this, you should clear the last error information by calling SetLastError(0) before calling SetWindowLong. Then, function failure will be indicated by a return value of zero and a GetLastError result that is nonzero.
    ResCertain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly. If you use SetWindowLong with the GWL_WNDPROC index to replace the window procedure, the window procedure must conform to the guidelines specified in the description of the WindowProc callback function. If you use SetWindowLong with the DWL_MSGRESULT index to set the return value for a message processed by a dialog procedure, you should return TRUE directly afterwards. Otherwise, if you call any function that results in your dialog procedure receiving a window message, the nested window message could overwrite the return value you set using DWL_MSGRESULT. Calling SetWindowLong with the GWL_WNDPROC index creates a subclass of the window class used to create the window. An application can subclass a system class, but should not subclass a window class created by another process. The SetWindowLong function creates the window subclass by changing the window procedure associated with a particular window class, causing the system to call the new window procedure instead of the previous one. An application must pass any messages not processed by the new window procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a chain of window procedures. Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the WNDCLASSEX structure used with the RegisterClassEx function. You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent of a child window. Instead, use the SetParent function. If the window has a class style of CS_CLASSDC or CS_OWNDC, do not set the extended window styles WS_EX_COMPOSITED or WS_EX_LAYERED.Windows 95/98/Me: SetWindowLongW is supported by the Microsoft Layer for Unicode (MSLU). SetWindowLongA is also supported to provide more consistent behavior across all Windows operating systems. To use these versions, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
      

  6.   

    其中GWL_STYLE可选的参数有:
    Window Styles --------------------------------------------------------------------------------The following styles can be specified wherever a window style is required. After the control has been created, these styles cannot be modified, except as noted. ConstantsWS_BORDER 
    Creates a window that has a thin-line border.WS_CAPTION 
    Creates a window that has a title bar (includes the WS_BORDER style).WS_CHILD 
    Creates a child window. A window with this style cannot have a menu bar. This style cannot be used with the WS_POPUP style.WS_CHILDWINDOW 
    Same as the WS_CHILD style.WS_CLIPCHILDREN 
    Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.WS_CLIPSIBLINGS 
    Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.WS_DISABLED 
    Creates a window that is initially disabled. A disabled window cannot receive input from the user. To change this after a window has been created, use EnableWindow. WS_DLGFRAME 
    Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.WS_GROUP 
    Specifies the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
    You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use SetWindowLong.
    WS_HSCROLL 
    Creates a window that has a horizontal scroll bar.WS_ICONIC 
    Creates a window that is initially minimized. Same as the WS_MINIMIZE style.WS_MAXIMIZE 
    Creates a window that is initially maximized.WS_MAXIMIZEBOX 
    Creates a window that has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified. WS_MINIMIZE 
    Creates a window that is initially minimized. Same as the WS_ICONIC style.WS_MINIMIZEBOX 
    Creates a window that has a minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified. WS_OVERLAPPED 
    Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.WS_OVERLAPPEDWINDOW 
    Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style. WS_POPUP 
    Creates a pop-up window. This style cannot be used with the WS_CHILD style.WS_POPUPWINDOW 
    Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.WS_SIZEBOX 
    Creates a window that has a sizing border. Same as the WS_THICKFRAME style.WS_SYSMENU 
    Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.WS_TABSTOP 
    Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style. 
    You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use SetWindowLong.
    WS_THICKFRAME 
    Creates a window that has a sizing border. Same as the WS_SIZEBOX style.WS_TILED 
    Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style. WS_TILEDWINDOW 
    Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style. WS_VISIBLE 
    Creates a window that is initially visible.
    This style can be turned on and off by using ShowWindow or SetWindowPos.
    WS_VSCROLL 
    Creates a window that has a vertical scroll bar.
      

  7.   

    hwnd=CreateWindow(szAppName,     //window class name
        TEXT(""),   //window caption
    WS_OVERLAPPEDWINDOW|WS_VSCROLL,      //window style
    CW_USEDEFAULT,            //initial x position
    CW_USEDEFAULT,            //initial y position
    CW_USEDEFAULT,            //initial x size
    CW_USEDEFAULT,            //initial y size
    NULL,                     //parent window handle
    NULL,                     //window menu handle
    hInstance,                //program instance handle
    NULL);         caption设置为空,不知道这样合你意吗
      

  8.   

    LONG ls = ::GetWindowLong(GetSafeHwnd(),GWL_STYLE);
    ls &= ~WS_CAPTION;
    ::SetWindowLong(GetSafeHwnd(),GWL_STYLE,ls);
      

  9.   

    我的测试结果是这样的:
    BOOL CXXDlg::OnInitDialog()
    {
               :
               :
    m_bVisible = FALSE;
    m_hwndTest = MyCreateWnd();  //m_hwndTest不能为栈变量.
              :
    }HWND CBakflDlg::MyCreateWnd()
    {
    CString strClassName;
    HWND    hWnd = 0; strClassName= AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW, 
                                               0, (HBRUSH)cOLOR_BTNFACE);
    DWORD dwStyle = WS_OVERLAPPEDWINDOW;
    hWnd = ::CreateWindowEx(WS_EX_CLIENTEDGE, (LPCSTR)strClassName,
                                      "window name", /*WS_POPUP*/dwStyle, 0, 0, 
                                   100, 200, NULL, NULL, AfxGetInstanceHandle(), 0);
    return hWnd;   //试试屏蔽这句.
    CRect rcClient;
    HRGN  hRgn; ::GetClientRect(hWnd, &rcClient);
    hRgn = ::CreateEllipticRgn(rcClient.left, rcClient.top,
                                        rcClient.right, rcClient.bottom);
    ::SetWindowRgn(hWnd, hRgn, TRUE);
    ::DeleteObject(hRgn); return hWnd;
    }void CXXlDlg::OnCreatewnd() 
    {
    m_bVisible = !m_bVisible;
    ::ShowWindow(m_hwndTest, m_bVisible ? SW_SHOW : SW_HIDE);
    }
      

  10.   

    to vontc2003(不过如此) 
      这样应该是可以的,但总是感觉比较投机
      

  11.   

    用了 vontc2003(不过如此)  的办法
    我想 CreateWindow的参数里应该有无标题栏窗体的组合         RECT rect1,rect2;
    HRGN  hRgn;
    GetWindowRect(m_hWnd, &rect1);
    GetClientRect(m_hWnd, &rect2);
    hRgn = CreateRectRgn(rect2.left+5, rect1.bottom-rect2.bottom,
                                        rect2.right, rect2.bottom);
    SetWindowRgn(m_hWnd, hRgn, TRUE);
    DeleteObject(hRgn);
      

  12.   

    to
        niky8053(奥里斯) 
     人家的意思是没有“标题栏“to
        pomelowu(羽战士)
      你那样不行,我和楼主都试过了,甚至即使在createwindow里把style设成0,再用setwindowlong把WS_CAPTION去掉,到头来把窗口弄得都不像人样了,它到死都还带着个标题栏!
      

  13.   

    那在Create的时候设置参数呢,不行吗?
      

  14.   

    除非用CreateRectRgn和SetWindowRgn了,我想知道MFC的SplashWindow是怎么办到的
      

  15.   

    搞定 
    m_hWnd = CreateWindow(g_szClassName, NULL, WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
    if (m_hWnd==NULL)
    return;
     
    long lStyle = GetWindowLong(m_hWnd, GWL_STYLE) ;
    lStyle ^= WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_CAPTION|WS_THICKFRAME;
    SetWindowLong(m_hWnd,GWL_STYLE,lStyle);不过直接将0x04000000做为CreateWindow的参数的话就不行了,真是奇怪,看来还是用linux爽啊
      

  16.   

    to chenge1980(纵横四海):
       你的方法在刚建立窗口时还是带着一根蓝条,只是在重绘后蓝条才偶尔没有,还经常出现。
      

  17.   

    不能用WS_OVERLAPPEDWINDOW,因为WS_OVERLAPPEDWINDOW本身包含有WS_CAPTION.
    最好只用WS_BORDER,一块白版.
      

  18.   

    to weally(鹍鹏元帅) 我重绘后就没蓝条了
      

  19.   

    实在抱歉,因为以前我没编译器,凭记忆说的,有点问题,现改正如下:>> 用CreateWindowEx,不用CreateWindow,
    >> dwExStyle 设为 WS_EX_APPWINDOW,
    >> dwStyle 设为 WS_POPUP | WS_BORDER (参照MSDN)
    >> 重新设置nWidth 和 nHeight,不能用0。以前我用的是汇编,因为C++将CreateWindowEx简化了,加如另一个函数CreateWindow,而CreateWindow又使用了默认的dwExStyle,导致某些dwStyle失效。
      

  20.   

    再次更正,经过刚才试验,发觉用CreateWindow也可以创建无标题栏的窗口。
    以前我没调整nWidth 和 nHeight,所以窗口没出来,只在任务栏有显示;现在调整了,实际上可以创建。