//.........这里部分代码省略.........
g_Config.bSoftwareRendering = false;
}
else if (restOfOption == L"gles") {
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
g_Config.bSoftwareRendering = false;
}
else if (restOfOption == L"software") {
g_Config.iGPUBackend = GPU_BACKEND_OPENGL;
g_Config.bSoftwareRendering = true;
}
}
}
}
#ifdef _DEBUG
g_Config.bEnableLogging = true;
#endif
LogManager::Init();
// Consider at least the following cases before changing this code:
// - By default in Release, the console should be hidden by default even if logging is enabled.
// - By default in Debug, the console should be shown by default.
// - The -l switch is expected to show the log console, REGARDLESS of config settings.
// - It should be possible to log to a file without showing the console.
LogManager::GetInstance()->GetConsoleListener()->Init(showLog, 150, 120, "PPSSPP Debug Console");
if (debugLogLevel)
LogManager::GetInstance()->SetAllLogLevels(LogTypes::LDEBUG);
//Windows, API init stuff
INITCOMMONCONTROLSEX comm;
comm.dwSize = sizeof(comm);
comm.dwICC = ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES | ICC_TAB_CLASSES;
InitCommonControlsEx(&comm);
timeBeginPeriod(1);
MainWindow::Init(_hInstance);
g_hPopupMenus = LoadMenu(_hInstance, (LPCWSTR)IDR_POPUPMENUS);
MainWindow::Show(_hInstance);
HWND hwndMain = MainWindow::GetHWND();
HWND hwndDisplay = MainWindow::GetDisplayHWND();
//initialize custom controls
CtrlDisAsmView::init();
CtrlMemView::init();
CtrlRegisterList::init();
CGEDebugger::Init();
DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS));
host = new WindowsHost(hwndMain, hwndDisplay);
host->SetWindowTitle(0);
MainWindow::CreateDebugWindows();
// Emu thread is always running!
EmuThread_Start();
InputDevice::BeginPolling();
HACCEL hAccelTable = LoadAccelerators(_hInstance, (LPCTSTR)IDR_ACCELS);
HACCEL hDebugAccelTable = LoadAccelerators(_hInstance, (LPCTSTR)IDR_DEBUGACCELS);
//so.. we're at the message pump of the GUI thread
for (MSG msg; GetMessage(&msg, NULL, 0, 0); ) // for no quit
开发者ID:codethulu,项目名称:ppsspp,代码行数:67,代码来源:main.cpp
示例8: DbgLog
bool CApp::InitInstance(int nCmdShow)
{
DbgLog((LOG_TRACE, 5, TEXT("CApp::InitInstance()"))) ;
// Win32 will always set hPrevInstance to NULL, so check
// things a little closer. This is because we only want a single
// version of this app to run at a time.
m_hWnd = FindWindow(m_szAppName, m_szAppTitle) ;
if(m_hWnd) {
// We found another instance of ourself. Lets use that one:
if(IsIconic(m_hWnd)) {
ShowWindow(m_hWnd, SW_RESTORE);
}
SetForegroundWindow(m_hWnd);
// If this app actually had any methodality, we would
// also want to communicate any action that our 'twin'
// should now perform based on how the user tried to
// execute us.
return false;
}
// Register the app main window class
WNDCLASSEX wc ;
wc.cbSize = sizeof(wc) ;
wc.style = CS_HREDRAW | CS_VREDRAW ;
wc.lpfnWndProc = (WNDPROC) WndProc ;
wc.cbClsExtra = 0 ;
wc.cbWndExtra = 0 ;
wc.hInstance = m_hInstance ;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW) ;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
wc.lpszMenuName = TEXT("DvdSample_Menu");
wc.lpszClassName = m_szAppName ;
wc.hIconSm = NULL ;
if(0 == RegisterClassEx(&wc)) {
DbgLog((LOG_ERROR, 0,
TEXT("ERROR: RegisterClassEx() for app class failed (Error %ld)"),
GetLastError())) ;
return false ;
}
// Determine where to put the Application Window
RECT rDesktop;
SystemParametersInfo(SPI_GETWORKAREA, NULL, &rDesktop, NULL);
// Create an instance of the window we just registered
// locate it at the bottom of the screen (bottom of screen - height of player)
m_hWnd = CreateWindowEx(0, m_szAppName, m_szAppTitle, WS_OVERLAPPEDWINDOW, //& ~WS_THICKFRAME,
160, rDesktop.bottom - 150, 300, 150,
NULL, NULL, m_hInstance, NULL);
if(!m_hWnd) {
DbgLog((LOG_ERROR, 0,
TEXT("ERROR: CreateWindowEx() failed (Error %ld)"),
GetLastError())) ;
return false ;
}
// We now create the toolbar
INITCOMMONCONTROLSEX cc;
cc.dwSize = sizeof(INITCOMMONCONTROLSEX);
cc.dwICC = ICC_BAR_CLASSES; // register only the toolbar control
InitCommonControlsEx(&cc);
#ifdef _WIN64
// BYTE bReserved[6] // padding for alignment
#define PAD 0,0,0,0,0,0, 0,0,
#elif defined(_WIN32)
// BYTE bReserved[2] // padding for alignment
#define PAD 0,0, 0,0,
#endif
// Configure toolbar buttons
TBBUTTON tbb[] =
{
0, ID_PLAYBACK_PREVIOUSCHAPTER, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
1, ID_PLAYBACK_REWIND, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
2, ID_PLAYBACK_PAUSE, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
3, ID_PLAYBACK_PLAY, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
4, ID_PLAYBACK_STOP, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
5, ID_PLAYBACK_FASTFORWARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
6, ID_PLAYBACK_NEXTCHAPTER, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
9, 0, TBSTATE_ENABLED, TBSTYLE_SEP, PAD
7, ID_PLAYBACK_MENUROOT, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
8, ID_OPTIONS_FULLSCREEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
9, ID_PLAYBACK_STEPFORWARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, PAD
};
m_hwndToolBar = CreateToolbarEx(m_hWnd, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | CCS_TOP
| TBSTYLE_TOOLTIPS, 1, 10, m_hInstance, IDR_TOOLBAR1, tbb, 11, 0, 0, 0, 0,
sizeof(TBBUTTON));
if(!m_hwndToolBar) {
DbgLog((LOG_ERROR, 0,
TEXT("ERROR: CreateToolbarEx() failed (Error %ld)"),
GetLastError())) ;
return false ;
}
//.........这里部分代码省略.........
void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditional, bool isMultiLine)
{
Window::init(hInst, parent);
int vertical = isVertical?(TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY):0;
_isTraditional = isTraditional;
_isVertical = isVertical;
_isMultiLine = isMultiLine;
INITCOMMONCONTROLSEX icce;
icce.dwSize = sizeof(icce);
icce.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&icce);
int multiLine = isMultiLine?(_isTraditional?TCS_MULTILINE:0):0;
int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE |\
TCS_TOOLTIPS | TCS_FOCUSNEVER | TCS_TABS | vertical | multiLine;
style |= TCS_OWNERDRAWFIXED;
_hSelf = ::CreateWindowEx(
0,
WC_TABCONTROL,
TEXT("Tab"),
style,
0, 0, 0, 0,
_hParent,
NULL,
_hInst,
0);
if (!_hSelf)
{
throw std::runtime_error("TabBarPlus::init : CreateWindowEx() function return null");
}
if (!_isTraditional)
{
if (!_hwndArray[_nbCtrl])
{
_hwndArray[_nbCtrl] = _hSelf;
_ctrlID = _nbCtrl;
}
else
{
int i = 0;
bool found = false;
for ( ; i < nbCtrlMax && !found ; i++)
if (!_hwndArray[i])
found = true;
if (!found)
{
_ctrlID = -1;
destroy();
throw std::runtime_error("TabBarPlus::init : Tab Control error - Tab Control # is over its limit");
}
_hwndArray[i] = _hSelf;
_ctrlID = i;
}
_nbCtrl++;
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)TabBarPlus_Proc));
}
LOGFONT LogFont;
_hFont = (HFONT)::SendMessage(_hSelf, WM_GETFONT, 0, 0);
if (_hFont == NULL)
_hFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if (_hLargeFont == NULL)
_hLargeFont = (HFONT)::GetStockObject(SYSTEM_FONT);
if (::GetObject(_hFont, sizeof(LOGFONT), &LogFont) != 0)
{
LogFont.lfEscapement = 900;
LogFont.lfOrientation = 900;
_hVerticalFont = CreateFontIndirect(&LogFont);
LogFont.lfWeight = 900;
_hVerticalLargeFont = CreateFontIndirect(&LogFont);
}
}
开发者ID:Tanjas5,项目名称:npp,代码行数:83,代码来源:TabBar.cpp
示例12: sizeof
BOOL CMidtermProjectApp::InitInstance()
{
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다.
// InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록
// 이 항목을 설정하십시오.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
// OLE 라이브러리를 초기화합니다.
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화
// 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
// 적절한 내용으로 수정해야 합니다.
SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램"));
LoadStdProfileSettings(4); // MRU를 포함하여 표준 INI 파일 옵션을 로드합니다.
// 응용 프로그램의 문서 템플릿을 등록합니다. 문서 템플릿은
// 문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다.
//CMultiDocTemplate* pDocTemplate;
m_pImageDocTemplate = new CMultiDocTemplate(IDR_MidtermProjectTYPE,
RUNTIME_CLASS(CMidtermProjectDoc),
RUNTIME_CLASS(CChildFrame), // 사용자 지정 MDI 자식 프레임입니다.
RUNTIME_CLASS(CMidtermProjectView));
if (!m_pImageDocTemplate)
return FALSE;
AddDocTemplate(m_pImageDocTemplate);
// 주 MDI 프레임 창을 만듭니다.
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
{
delete pMainFrame;
return FALSE;
}
m_pMainWnd = pMainFrame;
// 접미사가 있을 경우에만 DragAcceptFiles를 호출합니다.
// MDI 응용 프로그램에서는 m_pMainWnd를 설정한 후 바로 이러한 호출이 발생해야 합니다.
// 끌어서 놓기에 대한 열기를 활성화합니다.
m_pMainWnd->DragAcceptFiles();
// DDE Execute 열기를 활성화합니다.
EnableShellOpen();
RegisterShellFileTypes(TRUE);
// 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 프로그램 시작 시 빈 창을 띄우지 않는다.
if ( cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew )
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// 명령줄에 지정된 명령을 디스패치합니다.
// 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다.
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 주 창이 초기화되었으므로 이를 표시하고 업데이트합니다.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
//
// Initialize the cool scrollbars for a window by subclassing it
// and using the coolsb window procedure instead
//
BOOL WINAPI InitializeCoolSB(HWND hwnd)
{
SCROLLWND *sw;
SCROLLINFO *si;
INITCOMMONCONTROLSEX ice;
TOOLINFO ti;
RECT rect;
DWORD dwCurStyle;
//BOOL fDisabled;
if(pEnableScrollBar == 0)
pEnableScrollBar = EnableScrollBar;
GetClientRect(hwnd, &rect);
//if we have already initialized Cool Scrollbars for this window,
//then stop the user from doing it again
if(GetScrollWndFromHwnd(hwnd) != 0)
{
return FALSE;
}
//allocate a private scrollbar structure which we
//will use to keep track of the scrollbar data
sw = (SCROLLWND *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SCROLLWND));
si = &sw->sbarHorz.scrollInfo;
si->cbSize = sizeof(SCROLLINFO);
si->fMask = SIF_ALL;
GetScrollInfo(hwnd, SB_HORZ, si);
si = &sw->sbarVert.scrollInfo;
si->cbSize = sizeof(SCROLLINFO);
si->fMask = SIF_ALL;
GetScrollInfo(hwnd, SB_VERT, si);
//check to see if the window has left-aligned scrollbars
if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_LEFTSCROLLBAR)
sw->fLeftScrollbar = TRUE;
else
sw->fLeftScrollbar = FALSE;
dwCurStyle = GetWindowLong(hwnd, GWL_STYLE);
SetProp(hwnd, szPropStr, (HANDLE)sw);
//try to enable the scrollbar arrows - if the return value is
//non-zero, then the scrollbars were previously disabled
//fDisabled = pEnableScrollBar(hwnd, SB_HORZ, ESB_ENABLE_BOTH);
//scrollbars will automatically get enabled, even if
//they aren't to start with....sorry, but there isn't an
//easy alternative.
if(dwCurStyle & WS_HSCROLL)
sw->sbarHorz.fScrollFlags = CSBS_VISIBLE;
if(dwCurStyle & WS_VSCROLL)
sw->sbarVert.fScrollFlags = CSBS_VISIBLE;
//need to be able to distinguish between horizontal and vertical
//scrollbars in some instances
sw->sbarHorz.nBarType = SB_HORZ;
sw->sbarVert.nBarType = SB_VERT;
sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL;
sw->sbarVert.fFlatScrollbar = CSBS_NORMAL;
//set the default arrow sizes for the scrollbars
sw->sbarHorz.nArrowLength = SYSTEM_METRIC;
sw->sbarHorz.nArrowWidth = SYSTEM_METRIC;
sw->sbarVert.nArrowLength = SYSTEM_METRIC;
sw->sbarVert.nArrowWidth = SYSTEM_METRIC;
sw->bPreventStyleChange = FALSE;
sw->oldproc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)CoolSBWndProc);
CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize());
#ifdef COOLSB_TOOLTIPS
ice.dwSize = sizeof(ice);
ice.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx(&ice);
sw->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TOOLTIPS_CLASS, _T(""),
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, NULL, GetModuleHandle(0),
NULL);
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND;
ti.hwnd = hwnd;
ti.uId = (UINT)hwnd;
ti.lpszText = LPSTR_TEXTCALLBACK;
//.........这里部分代码省略.........
BOOL CFoosballApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// Create the shell manager, in case the dialog contains
// any shell tree view or shell list view controls.
CShellManager *pShellManager = new CShellManager;
// Activate "Windows Native" visual manager for enabling themes in MFC controls
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
CFoosballDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
else if (nResponse == -1)
{
TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
}
// Delete the shell manager created above.
if (pShellManager != NULL)
{
delete pShellManager;
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
请发表评论