如何更改窗口的类名(就是用SPY看见的Class Name)

解决方案 »

  1.   

    给你一段codeguru上的代码(我修改了的)BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    if( !CMDIFrameWnd::PreCreateWindow(cs) )
    return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs
    cs.style&=~FWS_ADDTOTITLE; // change mainframe's class name, so I can easily find it further.
    WNDCLASS wndCls;
    HINSTANCE hInst = AfxGetInstanceHandle();

    if(!(::GetClassInfo(hInst, APP_CLASSNAME, &wndCls)))
    {
    if(::GetClassInfo(hInst, cs.lpszClass, &wndCls))
    {
    wndCls.lpszClassName = APP_CLASSNAME;
    wndCls.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); if (!AfxRegisterClass(&wndCls))
    AfxThrowResourceException();
    }
    else
    AfxThrowResourceException();
        } cs.lpszClass = APP_CLASSNAME; return TRUE;
    }
      

  2.   


    动态无法修改就像你在CSDN注册了用户名一样,名字无法修改了,除非你另注册一个。