void OnCreate(HWND hwnd) { g_btOpen = CreateButton(hwnd, _T("V"), 0, 0, 20, 20); g_btPlay = CreateButton(hwnd, _T("|>"), 20, 0, 20, 20); g_btPause = CreateButton(hwnd, _T("||"), 40, 0, 20, 20); g_btStop = CreateButton(hwnd, _T("[]"), 60, 0, 20, 20); g_stTime = CreateStatic(hwnd, _T("00:00"), 0, 20, 60, 20); g_sbTime = CreateScrollBar(hwnd, 60, 20, 220, 20); g_hPanel = CreateStatic(hwnd, _T(""), 0, 40, 300, 200); #ifndef WINCE DragAcceptFiles(hwnd, true); #endif CWindowsDataSourceFactory::Register(); CDefaultMediaSourceFactory::Register(); CDefaultDecoderFactory::Register(); CWindowsRendererFactory::Register(); g_pGoodlayer = new CGoodPlayer(); g_pPlayer = new CMediaPlayer(g_hPanel); g_pPlayer->SetPlayerListener(g_pGoodlayer); g_pPlayer->LoadConfig(_T("GoodPlayer.cfg")); g_nDuration = 0; EnableWindow(g_btPlay, false); EnableWindow(g_btPause, false); EnableWindow(g_btStop, false); }
BOOL CSecondarySplitter::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class //CRect winRect; //GetWindowRect(winRect); CSize size(100,100); if(CreateStatic(this,2,1)) { TRACE0("Failed to create split bar "); return FALSE; // CSplitterWnd } return 1; }
LRESULT CALLBACK WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { int i; switch ( msg ) { case WM_CREATE: g_hwnd = hwnd; for ( i = 0; i < nMaxCtrls; i++ ) g_hwndCtrl[i] = NULL; CreateStatic ( "SS_NOTIFY test (click/double-click here)", SS_NOTIFY ); CreateStatic ( "SS_ENDELLIPSIS test test test test test test test test test test test", SS_ENDELLIPSIS ); CreateStatic ( "SS_CENTER test", SS_CENTER ); CreateStatic ( "SS_RIGHT test", SS_RIGHT ); CreateStatic ( "SS_BLACKFRAME test:", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_BLACKFRAME ); CreateStatic ( "SS_BLACKRECT test:", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_BLACKRECT ); CreateStatic ( "SS_ETCHEDFRAME test:", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDFRAME ); CreateStatic ( "SS_ETCHEDHORZ test:", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDHORZ ); CreateStatic ( "SS_ETCHEDVERT test", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDVERT ); CreateStatic ( "SS_GRAYFRAME test", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_GRAYFRAME ); CreateStatic ( "SS_GRAYRECT test", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_GRAYRECT ); CreateStatic ( "SS_NOPREFIX &test", SS_NOPREFIX ); CreateStatic ( "SS_OWNERDRAW test", SS_OWNERDRAW ); CreateStatic ( "SS_SUNKEN test", SS_SUNKEN ); CreateStatic ( "SS_WHITEFRAME test:", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_WHITEFRAME ); CreateStatic ( "SS_WHITERECT test:", 0 ); CreateStatic ( "this text shouldn't be visible!", SS_WHITERECT ); //if ( creation fails ) // return 0; break; case WM_COMMAND: if ( HIWORD(wParam) == STN_CLICKED ) SetWindowText ( (HWND)lParam, "SS_NOTIFY:STN_CLICKED!" ); if ( HIWORD(wParam) == STN_DBLCLK ) SetWindowText ( (HWND)lParam, "SS_NOTIFY:STN_DBLCLK!" ); break; case WM_DRAWITEM: { LPDRAWITEMSTRUCT lpDrawItem = (LPDRAWITEMSTRUCT) lParam; DrawText ( lpDrawItem->hDC, "SS_DRAWITEM test successful!", 28, &(lpDrawItem->rcItem), 0 ); } break; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc ( hwnd, msg, wParam, lParam ); }
virtual void RecreateWidget() { CreateStatic(); }