예제 #1
0
BOOL CMDIChildWnd::Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
                           const RECT &rect, CMDIFrameWnd *pParentWnd,
                           CCreateContext *pContext )
/***************************************************/
{
    if( pParentWnd == NULL ) {
        pParentWnd = (CMDIFrameWnd *)AfxGetMainWnd();
    }
    ASSERT( pParentWnd != NULL );
    ASSERT( pParentWnd->IsKindOf( RUNTIME_CLASS( CMDIFrameWnd ) ) );
    
    CREATESTRUCT cs;
    cs.dwExStyle = 0L;
    cs.lpszClass = lpszClassName;
    cs.lpszName = lpszWindowName;
    cs.style = dwStyle;
    cs.x = rect.left;
    cs.y = rect.top;
    cs.cx = rect.right - rect.left;
    cs.cy = rect.bottom - rect.top;
    cs.hwndParent = pParentWnd->m_hWnd;
    cs.hMenu = NULL;
    cs.hInstance = AfxGetInstanceHandle();
    cs.lpCreateParams = pContext;
    if( !PreCreateWindow( cs ) ) {
        PostNcDestroy();
        return( FALSE );
    }

    MDICREATESTRUCT mcs;
    mcs.szClass = cs.lpszClass;
    mcs.szTitle = cs.lpszName;
    mcs.hOwner = cs.hInstance;
    mcs.x = cs.x;
    mcs.y = cs.y;
    mcs.cx = cs.cx;
    mcs.cy = cs.cy;
    mcs.style = cs.style;
    mcs.lParam = (LPARAM)cs.lpCreateParams;
    AfxHookWindowCreate( this );
    HWND hWnd = (HWND)::SendMessage( pParentWnd->m_hWndMDIClient, WM_MDICREATE, 0,
                                     (LPARAM)&mcs );
    if( !AfxUnhookWindowCreate() ) {
        PostNcDestroy();
        return( FALSE );
    }
    if( hWnd == NULL ) {
        PostNcDestroy();
        return( FALSE );
    }
    ASSERT( m_hWnd == hWnd );

    return( TRUE );
}
예제 #2
0
파일: winmdi.cpp 프로젝트: AeonAxan/mpc-hc
BOOL CMDIChildWnd::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (!CFrameWnd::OnNcCreate(lpCreateStruct))
		return FALSE;

	// handle extended styles under Win4
	// call PreCreateWindow again just to get dwExStyle
	VERIFY(PreCreateWindow(*lpCreateStruct));
	SetWindowLong(m_hWnd, GWL_EXSTYLE, lpCreateStruct->dwExStyle);

	return TRUE;
}
예제 #3
0
BOOL CFormView::Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
                        const RECT &rect, CWnd *pParentWnd, UINT nID,
                        CCreateContext *pContext )
/************************************************/
{
    UNUSED_ALWAYS( lpszClassName );
    UNUSED_ALWAYS( lpszWindowName );

    CREATESTRUCT cs;
    memset( &cs, 0, sizeof( CREATESTRUCT ) );
    cs.style = dwStyle;
    if( !PreCreateWindow( cs ) ) {
        PostNcDestroy();
        return( FALSE );
    }

    m_pCreateContext = pContext;
    AfxHookWindowCreate( this );
    HWND hWnd = ::CreateDialogParam( AfxGetInstanceHandle(), m_lpszTemplateName,
                                     pParentWnd->GetSafeHwnd(), AfxDlgProc, 0L );
    AfxUnhookWindowCreate();
    m_pCreateContext = NULL;
    
    if( hWnd == NULL ) {
        PostNcDestroy();
        return( FALSE );
    }
    ASSERT( m_hWnd == hWnd );

    CRect rectDialog;
    ::GetWindowRect( hWnd, &rectDialog );
    SetScrollSizes( MM_TEXT, rectDialog.Size() );

    ::SetWindowLong( hWnd, GWL_ID, nID );
    ::SetWindowPos( hWnd, NULL, rect.left, rect.top, rect.right - rect.left,
                    rect.bottom - rect.top,
                    SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
    return( TRUE );
}
예제 #4
0
파일: WndProc.cpp 프로젝트: aliaspider/np2
/**
 * 指定されたウィンドウを作成し、それを CWndProc オブジェクトにアタッチします
 * @param[in] dwExStyle 拡張ウィンドウ スタイル
 * @param[in] lpszClassName 登録されているシステム ウィンドウ クラスの名前
 * @param[in] lpszWindowName ウィンドウの表示名
 * @param[in] dwStyle ウィンドウ スタイル
 * @param[in] x 画面または親ウィンドウの左端からウィンドウの初期位置までの水平方向の距離
 * @param[in] y 画面または親ウィンドウの上端からウィンドウの初期位置までの垂直方向の距離
 * @param[in] nWidth ウィンドウの幅 (ピクセル単位)
 * @param[in] nHeight ウィンドウの高さ (ピクセル単位)
 * @param[in] hwndParent 親ウィンドウへのハンドル
 * @param[in] nIDorHMenu ウィンドウ ID
 * @param[in] lpParam ユーザー データ
 * @retval TRUE 成功
 * @retval FALSE 失敗
 */
BOOL CWndProc::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, HMENU nIDorHMenu, LPVOID lpParam)
{
	// 同じスレッドのみ許す
	if (sm_dwThreadId != ::GetCurrentThreadId())
	{
		PostNcDestroy();
		return FALSE;
	}

	CREATESTRUCT cs;
	cs.dwExStyle = dwExStyle;
	cs.lpszClass = lpszClassName;
	cs.lpszName = lpszWindowName;
	cs.style = dwStyle;
	cs.x = x;
	cs.y = y;
	cs.cx = nWidth;
	cs.cy = nHeight;
	cs.hwndParent = hwndParent;
	cs.hMenu = nIDorHMenu;
	cs.hInstance = sm_hInstance;
	cs.lpCreateParams = lpParam;

	if (!PreCreateWindow(cs))
	{
		PostNcDestroy();
		return FALSE;
	}

	sm_pWndInit = this;
	HWND hWnd = ::CreateWindowEx(cs.dwExStyle, cs.lpszClass, cs.lpszName, cs.style, cs.x, cs.y, cs.cx, cs.cy, cs.hwndParent, cs.hMenu, cs.hInstance, cs.lpCreateParams);
	if (sm_pWndInit != NULL)
	{
		sm_pWndInit = NULL;
		PostNcDestroy();
	}

	return (hWnd != NULL) ? TRUE : FALSE;
}
예제 #5
0
BOOL CDialogBar::Create( CWnd *pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle,
                         UINT nID )
/*******************************************************************************/
{
    m_dwStyle = nStyle & CBRS_ALL;
    
    CREATESTRUCT cs;
    memset( &cs, 0, sizeof( CREATESTRUCT ) );
    cs.lpszClass = _T("AfxControlBar");
    cs.style = nStyle | WS_CHILD;
    cs.hwndParent = pParentWnd->GetSafeHwnd();
    cs.hMenu = (HMENU)nID;
    cs.hInstance = AfxGetInstanceHandle();
    if( !PreCreateWindow( cs ) ) {
        PostNcDestroy();
        return( FALSE );
    }

    AfxHookWindowCreate( this );
    HWND hWnd = ::CreateDialogParam( AfxGetInstanceHandle(), lpszTemplateName,
                                     pParentWnd->GetSafeHwnd(), AfxDlgProc, 0L );
    AfxUnhookWindowCreate();

    if( hWnd == NULL ) {
        PostNcDestroy();
        return( FALSE );
    }
    ASSERT( m_hWnd == hWnd );

    CRect rect;
    ::GetWindowRect( hWnd, &rect );
    m_sizeDefault = rect.Size();

    ::SetWindowLong( hWnd, GWL_ID, nID );
    ::SetWindowPos( hWnd, NULL, 0, 0, 0, 0,
                    SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
    return( TRUE );
}
예제 #6
0
BOOL CWnd::CreateEx()
{
	cout<< "CWnd::CreateEx \n";
	PreCreateWindow();
	return TRUE;
}
예제 #7
0
파일: VIEWFORM.CPP 프로젝트: willpoon/wcwp
// virtual override of CWnd::Create
BOOL CFormView::Create(LPCTSTR /*lpszClassName*/, LPCTSTR /*lpszWindowName*/,
                       DWORD dwRequestedStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
                       CCreateContext* pContext)
{
    ASSERT(pParentWnd != NULL);
    ASSERT(m_lpszTemplateName != NULL);

    m_pCreateContext = pContext;    // save state for later OnCreate

#ifdef _DEBUG
    // dialog template must exist and be invisible with WS_CHILD set
    if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
    {
        ASSERT(FALSE);          // invalid dialog template name
        PostNcDestroy();        // cleanup if Create fails too soon
        return FALSE;
    }
#endif //_DEBUG

    // initialize common controls
    VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
    AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

    // call PreCreateWindow to get prefered extended style
    CREATESTRUCT cs;
    memset(&cs, 0, sizeof(CREATESTRUCT));
    if (dwRequestedStyle == 0)
        dwRequestedStyle = AFX_WS_DEFAULT_VIEW;
    cs.style = dwRequestedStyle;
    if (!PreCreateWindow(cs))
        return FALSE;

    // create a modeless dialog
    if (!CreateDlg(m_lpszTemplateName, pParentWnd))
        return FALSE;

    m_pCreateContext = NULL;

    // we use the style from the template - but make sure that
    //  the WS_BORDER bit is correct
    // the WS_BORDER bit will be whatever is in dwRequestedStyle
    ModifyStyle(WS_BORDER|WS_CAPTION, cs.style & (WS_BORDER|WS_CAPTION));
    ModifyStyleEx(WS_EX_CLIENTEDGE, cs.dwExStyle & WS_EX_CLIENTEDGE);

    SetDlgCtrlID(nID);

    CRect rectTemplate;
    GetWindowRect(rectTemplate);
    SetScrollSizes(MM_TEXT, rectTemplate.Size());

    // initialize controls etc
    if (!ExecuteDlgInit(m_lpszTemplateName))
        return FALSE;

    // force the size requested
    SetWindowPos(NULL, rect.left, rect.top,
                 rect.right - rect.left, rect.bottom - rect.top,
                 SWP_NOZORDER|SWP_NOACTIVATE);

    // make visible if requested
    if (dwRequestedStyle & WS_VISIBLE)
        ShowWindow(SW_NORMAL);

    return TRUE;
}
예제 #8
0
BOOL SourceEdit::Create(CWnd* parent, UINT id)
{
  CREATESTRUCT cs;
  ::ZeroMemory(&cs,sizeof cs);
  cs.lpszClass = "Scintilla";
  cs.style = WS_VISIBLE|WS_CHILD|WS_CLIPCHILDREN;
  cs.hwndParent = parent->GetSafeHwnd();
  cs.hMenu = (HMENU)(UINT_PTR)id;
  cs.hInstance = AfxGetInstanceHandle();

  if (!PreCreateWindow(cs))
  {
    PostNcDestroy();
    return FALSE;
  }
  HWND wnd = ::CreateWindowEx(cs.dwExStyle,cs.lpszClass,cs.lpszName,cs.style,
    cs.x,cs.y,cs.cx,cs.cy,cs.hwndParent,cs.hMenu,cs.hInstance,cs.lpCreateParams);
  if (wnd == NULL)
    return FALSE;

  // Get the Unicode state of the 'real' window procedure before subclassing
  BOOL isUnicode = ::IsWindowUnicode(wnd);
  if (!SubclassWindow(wnd))
    return FALSE;

  CSize fontSize = theApp.MeasureFont(theApp.GetFont(InformApp::FontDisplay));
  m_editPtr = (sptr_t)SendMessage(SCI_GETDIRECTPOINTER);

  CallEdit(SCI_SETKEYSUNICODE,isUnicode);
  CallEdit(SCI_SETCODEPAGE,SC_CP_UTF8);
  CallEdit(SCI_SETEOLMODE,SC_EOL_LF);
  CallEdit(SCI_SETPASTECONVERTENDINGS,1);
  CallEdit(SCI_SETWRAPMODE,1);
  CallEdit(SCI_SETMODEVENTMASK,SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT);
  for (int i = 0; i < 5; i++)
    CallEdit(SCI_SETMARGINWIDTHN,i,0);
  CallEdit(SCI_SETMARGINLEFT,0,fontSize.cx);
  CallEdit(SCI_SETMARGINRIGHT,0,fontSize.cx);
  CallEdit(SCI_SETSELFORE,TRUE,::GetSysColor(COLOR_HIGHLIGHTTEXT));
  CallEdit(SCI_SETSELBACK,TRUE,::GetSysColor(COLOR_HIGHLIGHT));
  CallEdit(SCI_MARKERDEFINE,m_marker,SC_MARK_BACKGROUND);
  CallEdit(SCI_SETLEXER,SCLEX_CONTAINER);
  CallEdit(SCI_INDICSETSTYLE,0,INDIC_SQUIGGLE);
  CallEdit(SCI_INDICSETFORE,0,theApp.GetColour(InformApp::ColourError));
  CallEdit(SCI_SETINDICATORCURRENT,0);
  SetStyles();

  // Change the bindings for the Home and End keys
  CallEdit(SCI_ASSIGNCMDKEY,SCK_HOME,SCI_HOMEDISPLAY);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_HOME+(SCMOD_SHIFT<<16),SCI_HOMEDISPLAYEXTEND);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_HOME+(SCMOD_ALT<<16),SCI_HOME);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_HOME+((SCMOD_ALT|SCMOD_SHIFT)<<16),SCI_HOMEEXTEND);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_END,SCI_LINEENDDISPLAY);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_END+(SCMOD_SHIFT<<16),SCI_LINEENDDISPLAYEXTEND);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_END+(SCMOD_ALT<<16),SCI_LINEEND);
  CallEdit(SCI_ASSIGNCMDKEY,SCK_END+((SCMOD_ALT|SCMOD_SHIFT)<<16),SCI_LINEENDEXTEND);

  // Remove unwanted key bindings
  CallEdit(SCI_CLEARCMDKEY,SCK_ADD+(SCMOD_CTRL<<16));
  CallEdit(SCI_CLEARCMDKEY,SCK_SUBTRACT+(SCMOD_CTRL<<16));
  CallEdit(SCI_CLEARCMDKEY,SCK_DIVIDE+(SCMOD_CTRL<<16));

  return TRUE;
}
예제 #9
0
파일: MFC.CPP 프로젝트: huaoweiomian/mfc
BOOL CWnd::CreateEx()
{
	PreCreateWindow();
	return TRUE;
}
예제 #10
0
//****************************************************************************************
BOOL CBCGDialogBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd, BOOL bHasGripper, 
						   LPCTSTR lpszTemplateName, UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);

	//------------------------------------------------------
    // cannot be both fixed and dynamic
    // (CBRS_SIZE_DYNAMIC is used for resizng when floating)
	//------------------------------------------------------
    ASSERT (!((nStyle & CBRS_SIZE_FIXED) &&
              (nStyle & CBRS_SIZE_DYNAMIC)));

	if (bHasGripper)
	{
		m_cyGripper = max (12, globalData.GetTextHeight ());
	}
	else
	{
		m_cyGripper = 0;
	}

	m_bAllowSizing = nStyle & CBRS_SIZE_DYNAMIC ? TRUE : FALSE;

	//------------------------------
	// allow chance to modify styles
	//------------------------------
	m_dwStyle = (nStyle & CBRS_ALL);

	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = AFX_WNDCONTROLBAR;
	cs.lpszName = lpszWindowName;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)(UINT_PTR) nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();

	if (!PreCreateWindow(cs))
	{
		return FALSE;
	}

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	//----------------------------
	// initialize common controls
	//----------------------------
	VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
	AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

	//--------------------------
	// create a modeless dialog
	//--------------------------
	if (!CreateDlg (lpszTemplateName, pParentWnd))
	{
		TRACE(_T("Can't create dialog: %s\n"), lpszTemplateName);
		return FALSE;
	}

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

#pragma warning (disable : 4311)
	SetClassLongPtr (m_hWnd, GCLP_HBRBACKGROUND, (long)::GetSysColorBrush(COLOR_BTNFACE));
#pragma warning (default : 4311)

	//----------------------------------------------
	// dialog template MUST specify that the dialog
	// is an invisible child window
	//----------------------------------------------
	SetDlgCtrlID(nID);

	CRect rect;
	GetWindowRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size

    m_szHorz = m_sizeDefault; // set the size members
    m_szVert = m_sizeDefault;
    m_szFloat = m_sizeDefault;

	//-----------------------
	// force WS_CLIPSIBLINGS
	//-----------------------
	ModifyStyle(0, WS_CLIPSIBLINGS);

	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;

	//--------------------------------------------------------
	// force the size to zero - resizing bar will occur later
	//--------------------------------------------------------
	SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);

	if (lpszWindowName != NULL)
	{
		SetWindowText (lpszWindowName);
	}

	return TRUE;
}
예제 #11
0
파일: JWnd.cpp 프로젝트: xahgo/tama
HWND JWnd :: CreateEx ( DWORD     dwExStyle       ,
                        LPCTSTR   szClassName     ,
                        LPCTSTR   szWindowName    ,
                        DWORD     dwStyle         ,
                        int       x               ,
                        int       y               ,
                        int       nWidth          ,
                        int       nHeight         ,
                        JWnd *    pParent         ,
                        HMENU     nIDorHMenu      ,
                        HINSTANCE hInstance       ,
                        LPVOID    lpParam          )
{
    // Note that I assume the class is already registered.
    CREATESTRUCT cs ;
    cs.dwExStyle = dwExStyle ;
    cs.lpszClass = szClassName ;
    cs.lpszName = szWindowName ;
    cs.style = dwStyle ;
    cs.x = x ;
    cs.y = y ;
    cs.cx = nWidth ;
    cs.cy = nHeight ;
    if ( NULL != pParent )
    {
        cs.hwndParent = pParent->m_hWnd ;
    }
    else
    {
        cs.hwndParent = NULL ;
    }
    cs.hMenu = nIDorHMenu;

    cs.lpCreateParams = lpParam;

    // If the hInstance is NULL and the class name is JWndClass, I
    // will use the same one I registered the class with.  I had a
    // bug here where I accidentally used the internationalization
    // resource handle! (Duh!)
    if ( 0 == hInstance )
    {
        hInstance = JfxGetApp()->GetInstanceForClassRegistration ( ) ;
    }
    cs.hInstance = hInstance ;


    if ( FALSE == PreCreateWindow ( cs ) )
    {
        return ( FALSE ) ;
    }

    // Set the TLS static.
    sm_pThis = this ;

    // Do the hook.
    sm_hhook = SetWindowsHookEx ( WH_CALLWNDPROC        ,
                                  CallWndProc           ,
                                  NULL                  ,
                                  GetCurrentThreadId ( ) ) ;
    HWND hWndRet = ::CreateWindowEx ( cs.dwExStyle      ,
                                      cs.lpszClass      ,
                                      cs.lpszName       ,
                                      cs.style          ,
                                      cs.x              ,
                                      cs.y              ,
                                      cs.cx             ,
                                      cs.cy             ,
                                      cs.hwndParent     ,
                                      cs.hMenu          ,
                                      cs.hInstance      ,
                                      cs.lpCreateParams  ) ;
    // Clear the hook if needed.
    if ( NULL != sm_hhook )
    {
        UnhookWindowsHookEx ( sm_hhook ) ;
        sm_hhook = NULL ;
    }

    return ( hWndRet ) ;
}
예제 #12
0
파일: winmdi.cpp 프로젝트: AeonAxan/mpc-hc
BOOL CMDIChildWnd::Create(LPCTSTR lpszClassName,
	LPCTSTR lpszWindowName, DWORD dwStyle,
	const RECT& rect, CMDIFrameWnd* pParentWnd,
	CCreateContext* pContext)
{
	if (pParentWnd == NULL)
	{
		CWinThread *pThread = AfxGetThread();
		ENSURE_VALID(pThread);
		CWnd* pMainWnd = pThread->m_pMainWnd;
		ENSURE_VALID(pMainWnd);
		ASSERT_KINDOF(CMDIFrameWnd, pMainWnd);
		pParentWnd = (CMDIFrameWnd*)pMainWnd;
	}
	ASSERT(::IsWindow(pParentWnd->m_hWndMDIClient));

	// insure correct window positioning
	pParentWnd->RecalcLayout();

	// first copy into a CREATESTRUCT for PreCreate
	CREATESTRUCT cs;
	cs.dwExStyle = 0L;
	cs.lpszClass = lpszClassName;
	cs.lpszName = lpszWindowName;
	cs.style = dwStyle;
	cs.x = rect.left;
	cs.y = rect.top;
	cs.cx = rect.right - rect.left;
	cs.cy = rect.bottom - rect.top;
	cs.hwndParent = pParentWnd->m_hWnd;
	cs.hMenu = NULL;
	cs.hInstance = AfxGetInstanceHandle();
	cs.lpCreateParams = (LPVOID)pContext;

	if (!PreCreateWindow(cs))
	{
		PostNcDestroy();
		return FALSE;
	}
	// extended style must be zero for MDI Children (except under Win4)
	ASSERT(cs.hwndParent == pParentWnd->m_hWnd);    // must not change

	// now copy into a MDICREATESTRUCT for real create
	MDICREATESTRUCT mcs;
	mcs.szClass = cs.lpszClass;
	mcs.szTitle = cs.lpszName;
	mcs.hOwner = cs.hInstance;
	mcs.x = cs.x;
	mcs.y = cs.y;
	mcs.cx = cs.cx;
	mcs.cy = cs.cy;
	mcs.style = cs.style & ~(WS_MAXIMIZE | WS_VISIBLE);
	mcs.lParam = (LPARAM)cs.lpCreateParams;

	// create the window through the MDICLIENT window
	AfxHookWindowCreate(this);
	HWND hWnd = (HWND)::SendMessage(pParentWnd->m_hWndMDIClient,
		WM_MDICREATE, 0, (LPARAM)&mcs);
	if (!AfxUnhookWindowCreate())
		PostNcDestroy();        // cleanup if MDICREATE fails too soon

	if (hWnd == NULL)
		return FALSE;

	// special handling of visibility (always created invisible)
	if (cs.style & WS_VISIBLE)
	{
		// place the window on top in z-order before showing it
		::BringWindowToTop(hWnd);

		// show it as specified
		if (cs.style & WS_MINIMIZE)
			ShowWindow(SW_SHOWMINIMIZED);
		else if (cs.style & WS_MAXIMIZE)
			ShowWindow(SW_SHOWMAXIMIZED);
		else
			ShowWindow(SW_SHOWNORMAL);

		// make sure it is active (visibility == activation)
		pParentWnd->MDIActivate(this);

		// refresh MDI Window menu
		::SendMessage(pParentWnd->m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0);
	}

	ASSERT(hWnd == m_hWnd);
	return TRUE;
}
예제 #13
0
BOOL CWnd::CreateEx()
{ cout << "Cwnd::CreateEx()" << endl;
                PreCreateWindow();  return TRUE; }
예제 #14
0
BOOL COXSizeDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
							  UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);
	ASSERT((nStyle & WS_THICKFRAME)==NULL);
	
// Alas, MFC doesn't export many of the debugg-only functions, but I've added
// the code for this safety net as it helps track down errors faster, and
// only has an overhead in debug code
#ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
	if (!CheckDialogTemplate(lpszTemplateName, TRUE))
	{
		ASSERT(FALSE);          // invalid dialog template name
		PostNcDestroy();        // cleanup if Create fails too soon
		return FALSE;
	}
#endif //_DEBUG

	// allow chance to modify styles
#if _MFC_VER <= 0x0421
	m_dwStyle = nStyle;
#else
    m_dwStyle = nStyle&CBRS_ALL;
#endif
	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = _afxWndControlBar;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)(UINT_PTR)nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();
	if (!PreCreateWindow(cs))
		return FALSE;
	
	// create a modeless dialog
#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	// initialize common controls
	//VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));

	BOOL bSuccess = CreateDlg(lpszTemplateName, pParentWnd);

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

	if (!bSuccess)
		return FALSE;
	
	// dialog template MUST specify that the dialog
	//  is an invisible child window
	SetDlgCtrlID(nID);
	CRect rect;
	
	
	// force WS_CLIPSIBLINGS
	// I also remove the titlebar. This means the resource can include a caption, which
	// will be used when the frame is floating.
	ModifyStyle(WS_CAPTION, WS_CLIPSIBLINGS);		
	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;
	
	// m_sizeDefault isn't actually used by the COXSizeDialogBar, but since it's public, it
	// seemed sensible to keep it available. Otherwise it might be difficult to get hold
	// of the original size of the dialog (as specified in the resource file). 
	
	//GetWindowRect(&rect);
	GetClientRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size
	
	// Move to position 0,0
	// NB: size not forced to zero, as this can affect resizing if bar is 
	// immediately docked
	SetWindowPos(NULL, 0, 0, 0, 0, 
		SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_NOSIZE|SWP_FRAMECHANGED);
	
	// set all the sizes to be the default after the positioning done above
	m_VertDockSize 	= m_sizeDefault;
	m_HorzDockSize  = m_sizeDefault;
	m_FloatSize 	= m_sizeDefault;
	
	
	// if auto-sizing, store the rectangles of all the child windows.
	if(m_Style & SZBARF_DLGAUTOSIZE)	
	{
		m_GadgetResizeHandle = CreateGadgetResizeHandle(this);
	}

	return TRUE;
}
예제 #15
0
파일: bardlg.cpp 프로젝트: anyue100/winscp
BOOL CDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
	UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);

#ifdef _DEBUG
	// dialog template must exist and be invisible with WS_CHILD set
	if (!_AfxCheckDialogTemplate(lpszTemplateName, TRUE))
	{
		ASSERT(FALSE);          // invalid dialog template name
		PostNcDestroy();        // cleanup if Create fails too soon
		return FALSE;
	}
#endif //_DEBUG

	// allow chance to modify styles
	m_dwStyle = (nStyle & CBRS_ALL);
	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = _afxWndControlBar;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();
	if (!PreCreateWindow(cs))
		return FALSE;

	// create a modeless dialog

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	// initialize common controls
	VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
	AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

	BOOL bSuccess = CreateDlg(lpszTemplateName, pParentWnd);

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

	if (!bSuccess)
		return FALSE;

	// dialog template MUST specify that the dialog
	//  is an invisible child window
	SetDlgCtrlID(nID);
	CRect rect;
	GetWindowRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size

	// force WS_CLIPSIBLINGS
	ModifyStyle(0, WS_CLIPSIBLINGS);

	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;

	// force the size to zero - resizing bar will occur later
	SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);

	return TRUE;
}