HWND DialogWindow::CreateDialogWindow(HWND hWnd,wchar_t* Class){ HWND res; RECT rc; HINSTANCE hInst=(HINSTANCE)GetWindowLongPtr(hWnd,GWLP_HINSTANCE); m_hParent=hWnd; GetWindowRect(m_hParent,&rc); RegisterWC(hInst,Class); res=CreateWnd(Class,WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_VISIBLE|WS_MINIMIZEBOX,rc.left,rc.top,0,0,NULL,NULL,hInst); m_hDlg=CreateDialogParam(hInst,Class,res,(DLGPROC)DlgCallProc,(LPARAM)this); SendMessage(res,WM_SIZE,NULL,NULL); ShowWindow(m_hParent,SW_HIDE); return res; }
HWND CAutoScrollWnd::Create( HINSTANCE hInstance, HWND hwndParent, bool bVertical, bool bHorizontal, const CMyPoint& point, CEditView* view ) { LPCTSTR pszClassName; m_cView = view; int idb, idc; if( bVertical ){ if( bHorizontal ){ idb = IDB_SCROLL_CENTER; idc = IDC_CURSOR_AUTOSCROLL_CENTER; pszClassName = _T("SakuraAutoScrollCWnd"); }else{ idb = IDB_SCROLL_VERTICAL; idc = IDC_CURSOR_AUTOSCROLL_VERTICAL; pszClassName = _T("SakuraAutoScrollVWnd"); } }else{ idb = IDB_SCROLL_HORIZONTAL; idc = IDC_CURSOR_AUTOSCROLL_HORIZONTAL; pszClassName = _T("SakuraAutoScrollHWnd"); } m_hCenterImg = (HBITMAP)::LoadImage(hInstance, MAKEINTRESOURCE(idb), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); HCURSOR hCursor = ::LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(idc)); /* ウィンドウクラス作成 */ RegisterWC( hInstance, NULL, NULL, hCursor, (HBRUSH)(COLOR_3DFACE + 1), NULL, pszClassName ); /* 基底クラスメンバ呼び出し */ return CWnd::Create( /* 初期化 */ hwndParent, 0, pszClassName, // Pointer to a null-terminated string or is an atom. pszClassName, // pointer to window name WS_CHILD | WS_VISIBLE, // window style point.x-16, // horizontal position of window point.y-16, // vertical position of window 32, // window width 32, // window height NULL // handle to menu, or child-window identifier ); }
/* ウィンドウ オープン */ HWND CFuncKeyWnd::Open( HINSTANCE hInstance, HWND hwndParent, CEditDoc* pCEditDoc, bool bSizeBox ) { LPCTSTR pszClassName = _T("CFuncKeyWnd"); m_pcEditDoc = pCEditDoc; m_bSizeBox = bSizeBox; m_hwndSizeBox = NULL; m_nCurrentKeyState = -1; // 2002.11.04 Moca 変更できるように m_nButtonGroupNum = m_pShareData->m_Common.m_sWindow.m_nFUNCKEYWND_GroupNum; if( 1 > m_nButtonGroupNum || 12 < m_nButtonGroupNum ){ m_nButtonGroupNum = 4; } /* ウィンドウクラス作成 */ RegisterWC( hInstance, NULL,// Handle to the class icon. NULL, //Handle to a small icon ::LoadCursor( NULL, IDC_ARROW ),// Handle to the class cursor. (HBRUSH)(COLOR_3DFACE + 1),// Handle to the class background brush. NULL/*MAKEINTRESOURCE( MYDOCUMENT )*/,// Pointer to a null-terminated character string that specifies the resource name of the class menu, as the name appears in the resource file. pszClassName// Pointer to a null-terminated string or is an atom. ); /* 基底クラスメンバ呼び出し */ CWnd::Create( hwndParent, 0, // extended window style pszClassName, // Pointer to a null-terminated string or is an atom. pszClassName, // pointer to window name WS_CHILD/* | WS_VISIBLE*/ | WS_CLIPCHILDREN, // window style // 2006.06.17 ryoji WS_CLIPCHILDREN 追加 // 2007.03.08 ryoji WS_VISIBLE 除去 CW_USEDEFAULT, // horizontal position of window 0, // vertical position of window 0, // window width // 2007.02.05 ryoji 100->0(半端なサイズで一瞬表示されるより見えないほうがいい) ::GetSystemMetrics( SM_CYMENU ), // window height NULL // handle to menu, or child-window identifier ); m_hwndSizeBox = NULL; if( m_bSizeBox ){ m_hwndSizeBox = ::CreateWindowEx( 0L, /* no extended styles */ _T("SCROLLBAR"), /* scroll bar control class */ NULL, /* text for window title bar */ WS_VISIBLE | WS_CHILD | SBS_SIZEBOX | SBS_SIZEGRIP, /* scroll bar styles */ 0, /* horizontal position */ 0, /* vertical position */ 200, /* width of the scroll bar */ CW_USEDEFAULT, /* default height */ GetHwnd(), /* handle of main window */ (HMENU) NULL, /* no menu for a scroll bar */ GetAppInstance(), /* instance owning this window */ (LPVOID) NULL /* pointer not needed */ ); } /* ボタンの生成 */ CreateButtons(); Timer_ONOFF( true ); // 20060126 aroka OnTimer( GetHwnd(), WM_TIMER, IDT_FUNCWND, ::GetTickCount() ); // 初回更新 // 2006.12.20 ryoji return GetHwnd(); }
HWND Window::AutoRegistCreateWnd(LPCTSTR Class,DWORD Style,int x,int y,int width,int height,HWND hParent,HMENU hMenu,HINSTANCE hInst){ RegisterWC(hInst,Class); return CreateWnd(Class,Style,x,y,width,height,hParent,hMenu,hInst); }