这篇教程C++ DragAcceptFiles函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DragAcceptFiles函数的典型用法代码示例。如果您正苦于以下问题:C++ DragAcceptFiles函数的具体用法?C++ DragAcceptFiles怎么用?C++ DragAcceptFiles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DragAcceptFiles函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: TPack_InitializeDialogstatic BOOL TPack_InitializeDialog (HWND hwnd){ TPack_WindowData * pData; HFONT Font; HWND ListWnd; // allocate window local data structure pData = GE_RAM_ALLOCATE_STRUCT (TPack_WindowData); if (pData == NULL) { DestroyWindow (hwnd); return TRUE; } // and initialize it pData->Instance = (HINSTANCE)GetWindowLong (hwnd, GWL_HINSTANCE); pData->hwnd = hwnd; pData->BitmapCount = 0; pData->Bitmaps = NULL; pData->SelectedEntry = NULL; pData->FileNameIsValid = FALSE; pData->Dirty = FALSE; // Set the window data pointer in the GWL_USERDATA field SetWindowLong(hwnd, GWL_USERDATA, (LONG)pData); SetWindowLong(GetDlgItem(hwnd, IDC_PREVIEW), GWL_USERDATA, (LONG)pData); SetWindowLong(GetDlgItem(hwnd, IDC_PREVIEW), GWL_WNDPROC, (LONG)TPack_PreviewWndProc); ListWnd = GetDlgItem(hwnd, IDC_TEXTURELIST); SetWindowLong(ListWnd, GWL_USERDATA, (LONG)GetWindowLong(ListWnd, GWL_WNDPROC)); SetWindowLong(ListWnd, GWL_WNDPROC, (LONG)TPack_ListBoxWndProc); Font = CreateFont( -24, 0,0,0, 0, 0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, "Arial Black"); SendDlgItemMessage(hwnd, IDC_TEXTURESIZE, WM_SETFONT, (WPARAM)Font, MAKELPARAM(TRUE, 0)); // set the program icon on the dialog window SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon (pData->Instance, MAKEINTRESOURCE (IDI_MAINICON))); DragAcceptFiles (hwnd, TRUE); return TRUE;}
开发者ID:RealityFactory,项目名称:Genesis3D-Tools,代码行数:43,
示例2: DcxControlDcxEdit::DcxEdit(const UINT ID, DcxDialog *p_Dialog, const HWND mParentHwnd, const RECT *rc, TString &styles): DcxControl(ID, p_Dialog){ LONG Styles = 0, ExStyles = 0; BOOL bNoTheme = FALSE; this->parseControlStyles(styles, &Styles, &ExStyles, &bNoTheme); this->m_Hwnd = CreateWindowExW( ExStyles | WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | Styles, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, mParentHwnd, (HMENU) ID, GetModuleHandle(NULL), NULL); if (!IsWindow(this->m_Hwnd)) throw "Unable To Create Window"; if (bNoTheme) Dcx::UXModule.dcxSetWindowTheme(this->m_Hwnd , L" ", L" "); Edit_LimitText(this->m_Hwnd, 0); //this->m_tsText = ""; //SendMessage(this->m_Hwnd, CCM_SETUNICODEFORMAT, TRUE, NULL); if (p_Dialog->getToolTip() != NULL) { if (styles.istok("tooltips")) { this->m_ToolTipHWND = p_Dialog->getToolTip(); AddToolTipToolInfo(this->m_ToolTipHWND, this->m_Hwnd); } } this->m_bIgnoreRepeat = TRUE; this->setControlFont((HFONT) GetStockObject(DEFAULT_GUI_FONT), FALSE); this->registreDefaultWindowProc(); SetProp(this->m_Hwnd, "dcx_cthis", (HANDLE) this); DragAcceptFiles(this->m_Hwnd, TRUE);}
开发者ID:dlsocool,项目名称:dcx,代码行数:42,
示例3: getHandlebool Chkdraft::CreateSubWindows(){ HWND hWnd = getHandle(); if ( hWnd != NULL ) { DragAcceptFiles(hWnd, TRUE); int statusWidths[] = { 130, 205, 350, 450, 600, -1 }; return mainMenu.FindThis(hWnd) && mainToolbar.CreateThis(hWnd, IDR_MAIN_TOOLBAR) && statusBar.CreateThis(sizeof(statusWidths) / sizeof(int), statusWidths, 0, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, hWnd, (HMENU)IDR_MAIN_STATUS) && mainPlot.CreateThis(hWnd, IDR_MAIN_PLOT) && BecomeMDIFrame(maps, GetSubMenu(GetMenu(hWnd), 6), ID_MDI_FIRSTCHILD, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, 0, 0, 0, 0, (HMENU)IDR_MAIN_MDI); } else return false;}
开发者ID:RElesgoe,项目名称:Chkdraft,代码行数:20,
示例4: WinD3DInitint WinD3DInit( ){ // Register the window class WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "PhysView", NULL }; RegisterClassEx( &wc ); hInst = wc.hInstance; SetRect( &window_inset, 0, 0, 0, 0 ); AdjustWindowRect( &window_inset, WS_OVERLAPPEDWINDOW, 0 ); //RECT rc; //SetRect( &rc, 0, 0, Width, Height ); //AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, 0 ); // Create the application's window Width = windowwidth; Height= windowheight; hWnd = CreateWindow( "PhysView", windowtitle, WS_OVERLAPPEDWINDOW, windowx+window_inset.left, windowy+window_inset.top, Width+window_inset.right-window_inset.left, Height+window_inset.bottom-window_inset.top, GetDesktopWindow(), NULL, wc.hInstance, NULL );/* HWND parentwindow=GetDesktopWindow(); parentwindow=(HWND)0xa0618; hWnd = CreateWindow( "PhysView", "PhysView", WS_CHILD, 0, 0, 200,200, parentwindow, NULL, wc.hInstance, NULL );*/ // Initialize Direct3D HRESULT hr; hr = InitD3D( hWnd ); // Show the window ShowWindow( hWnd, SW_SHOWDEFAULT ); UpdateWindow( hWnd ); DragAcceptFiles(hWnd,true); InitFont(g_pd3dDevice); return 1;}
开发者ID:Thyfate,项目名称:melax,代码行数:41,
示例5: DragAcceptFilesBOOL CPPageExternalFilters::OnInitDialog(){ __super::OnInitDialog(); DragAcceptFiles(TRUE); AppSettings& s = AfxGetAppSettings(); m_pFilters.RemoveAll(); POSITION pos = s.m_filters.GetHeadPosition(); while (pos) { CAutoPtr<FilterOverride> f(DNew FilterOverride(s.m_filters.GetNext(pos))); CString name(_T("<unknown>")); if (f->type == FilterOverride::REGISTERED) { name = CFGFilterRegistry(f->dispname).GetName(); if (name.IsEmpty()) { name = f->name + _T(" <not registered>"); } } else if (f->type == FilterOverride::EXTERNAL) { name = f->name; if (f->fTemporary) { name += _T(" <temporary>"); } if (!CPath(MakeFullPath(f->path)).FileExists()) { name += _T(" <not found!>"); } } int i = m_filters.AddString(name); m_filters.SetCheck(i, f->fDisabled ? 0 : 1); m_filters.SetItemDataPtr(i, m_pFilters.AddTail(f)); } UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE}
开发者ID:avdbg,项目名称:MPC-BE,代码行数:41,
示例6: DragAcceptFilesLRESULT MainDialog::OnInitDialog(HWND hwnd, LPARAM lp){ WTL::CMessageLoop *loop = _Module.GetMessageLoop(); loop->AddMessageFilter(this); DragAcceptFiles(*this, true); SetIcon(WTL::AtlLoadIconImage(IDI_MEDIAWIKI, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON))); SetIcon(WTL::AtlLoadIconImage(IDI_MEDIAWIKI, 0, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)), false); EnableDlgItem(IDC_OPT_COMPRESS_FULL, false); EnableDlgItem(IDC_START, false); DoDataExchange(); m_progress.SetRange(0, 100); m_waitcursor.LoadOEMCursor(IDC_WAIT); return false;}
开发者ID:Tietew,项目名称:mediawiki-xml2sql,代码行数:21,
示例7: InitInstance//// 函数: InitInstance(HINSTANCE, int)//// 目的: 保存实例句柄并创建主窗口//// 注释://// 在此函数中,我们在全局变量中保存实例句柄并// 创建和显示主程序窗口。//BOOL InitInstance(HINSTANCE hInstance, int nCmdShow){ HWND hWnd; hInst = hInstance; // 将实例句柄存储在全局变量中 hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } DragAcceptFiles(hWnd, TRUE); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE;}
开发者ID:yedaoq,项目名称:YedaoqToolSpace,代码行数:31,
示例8: system_window_init//drag and drop support, call after window was initializedvoid system_window_init(){ //drag and drop #if TARGET_OS == WIN SDL_SysWMinfo wmInfo; //set SDL version to WMinfo struct //-> maybe problems when not calling this macro before SDL_VERSION(&wmInfo.version); if(SDL_GetWMInfo(&wmInfo) != SDL_TRUE) { cerr << "Error on getting WMInfo" << endl; return; } SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); DragAcceptFiles(wmInfo.window, true); //afxwin.h #endif //other OS ...}
开发者ID:murkymark,项目名称:iffanimplay,代码行数:22,
示例9: __declspecvoid __declspec(dllexport) onDropFiles(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra){ HWND hwCtl; //LONG lwnd; nsFunction callback; // get info from stack hwCtl = (HWND) popint(); callback = (nsFunction) popint(); if (!IsWindow(hwCtl)) return; //lwnd = GetWindowLong(hwCtl, GWL_EXSTYLE); //SetWindowLong(hwCtl, GWL_EXSTYLE, lwnd | WS_EX_ACCEPTFILES); DragAcceptFiles(hwCtl, TRUE); pushint((nsFunction) callback);// pushint((int) hwCtl); if (hwCtl == g_window.hwWindow) SetWindowCallback(WND_CALLBACK_IDX(onDropFiles)); else { //size_t id; //id = g_window.controlCount - 1; //MessageBox(g_window.hwWindow,"control dropfiles",NULL,MB_OK); //g_window.controls[id].oldWndProc = (WNDPROC) SetWindowLong(hwCtl, GWL_WNDPROC, (long) DropFilesWndProc); ctl = GetControl(hwCtl); if (ctl == NULL) return; ctl->oldWndProc = (WNDPROC) SetWindowLong(hwCtl, GWL_WNDPROC, (long) DropFilesWndProc); pushint((int) hwCtl); SetControlCallback(CTL_CALLBACK_IDX(onDropFiles)); }}
开发者ID:fengshao5411,项目名称:nswindows_domodal,代码行数:39,
示例10: TRACE0int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;#if 0 if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar/n"); return -1; // fail to create }#endif if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar/n"); return -1; // fail to create }#if 0 // TODO: Remove this if you don't want tool tips or a resizeable toolbar m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar);#endif // We accept drag and drop files DragAcceptFiles(); return 0;}
开发者ID:svagionitis,项目名称:libwww,代码行数:39,
示例11: TForm//---------------------------------------------------------------------------__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner), theBuffer(NULL), stopped(true){ DragAcceptFiles(this->Handle, TRUE); bmp = new Graphics::TBitmap; bmp->PixelFormat = pf24bit; bmp->Canvas->Font->Assign(FontDialog1->Font); charWidth = bmp->Canvas->TextWidth("A"); charHeight = bmp->Canvas->TextHeight("A"); SetWindowLong(txtFrameSize->Handle, GWL_STYLE, GetWindowLong(txtFrameSize->Handle, GWL_STYLE) | ES_NUMBER); SetWindowLong(txtMinDelta->Handle, GWL_STYLE, GetWindowLong(txtMinDelta->Handle, GWL_STYLE) | ES_NUMBER); SetWindowLong(txtMaxDelta->Handle, GWL_STYLE, GetWindowLong(txtMaxDelta->Handle, GWL_STYLE) | ES_NUMBER); SetWindowLong(txtMaxResults->Handle, GWL_STYLE, GetWindowLong(txtMaxResults->Handle, GWL_STYLE) | ES_NUMBER); Panel2->DoubleBuffered = true; RedrawBitmap();}
开发者ID:Bindambc,项目名称:MathApps,代码行数:23,
示例12: TRACE0int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar/n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar/n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // Enable drag/drop open DragAcceptFiles(TRUE); // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); // add panes m_wndStatusBar.SetPaneInfo( PANE_LENGTH_UNIT, ID_SEPARATOR, SBPS_NORMAL, 25); m_wndStatusBar.SetPaneInfo( PANE_CURSOR_POSITION, ID_SEPARATOR, SBPS_NORMAL, 72); m_wndStatusBar.SetPaneInfo( PANE_IMAGE_SIZE, ID_SEPARATOR, SBPS_NORMAL, 72); m_wndStatusBar.SetPaneInfo( PANE_BIT_COUNT, ID_SEPARATOR, SBPS_NORMAL, 28); m_wndStatusBar.SetPaneInfo( PANE_REGION_ID, ID_SEPARATOR, SBPS_NORMAL, 60); m_wndStatusBar.SetPaneInfo( PANE_REGION_SIZE, ID_SEPARATOR, SBPS_NORMAL, 30); m_wndStatusBar.SetPaneInfo( PANE_RN_COUNT, ID_SEPARATOR, SBPS_NORMAL, 15); return 0;}
开发者ID:caomw,项目名称:ImageSegmentor,代码行数:38,
示例13: HookCreateWindowExAHWND WINAPI HookCreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam){ RECT rcWordArea; ULONG Length; LPWSTR ClassName, WindowName; HWND hWnd; Length = StrLengthA(lpClassName) + 1; ClassName = (LPWSTR)AllocStack(Length * sizeof(WCHAR)); AnsiToUnicode(ClassName, Length * sizeof(WCHAR), lpClassName, Length); Length = StrLengthA(lpWindowName) + 1; WindowName = (LPWSTR)AllocStack(Length * sizeof(WCHAR)); AnsiToUnicode(WindowName, Length * sizeof(WCHAR), lpWindowName, Length); hWnd = CreateWindowExW(dwExStyle, ClassName, WindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); if (hWnd == NULL) return hWnd; OrigWndProc = (WNDPROC)SetWindowLongPtrA(hWnd, GWLP_WNDPROC, (LONG_PTR)CMVS_MainWindowProc); DragAcceptFiles(hWnd, TRUE); return hWnd;}
开发者ID:Emiyasviel,项目名称:Arianrhod,代码行数:24,
示例14: WinMainint PASCAL WinMain (HINSTANCE hCurrentInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { // WinMain MSG msg; if (!PerfmonInitialize (hCurrentInstance, hPrevInstance, lpszCmdLine, nCmdShow)) return (FALSE) ; DragAcceptFiles (hWndMain, TRUE) ; while (GetMessage (&msg, NULL, 0, 0)) { if (!TranslateAccelerator(hWndMain, hAccelerators, &msg)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } } // while return(msg.wParam); }
开发者ID:mingpen,项目名称:OpenNT,代码行数:24,
示例15: _T// the constructor creates the windowViewer::Viewer(HWND parent, const TCHAR *current_filename){ DWORD styles; m_hwndViewer=NULL; m_dib = NULL; m_bits = NULL; m_errorflag=0; styles = WS_OVERLAPPEDWINDOW; styles &= ~WS_MINIMIZEBOX; m_hwndViewer=CreateWindow( _T("TPNGVIEWER"),_T(""),styles, CW_USEDEFAULT, // horizontal position CW_USEDEFAULT, // vertical position CW_USEDEFAULT, // width CW_USEDEFAULT, // height parent,NULL,globals.hInst,NULL); if(!m_hwndViewer) return; twpng_SetWindowPos(m_hwndViewer,&globals.window_prefs.viewer); SetCurrentFileName(current_filename); UpdateViewerWindowTitle(); ShowWindow(m_hwndViewer,globals.window_prefs.viewer.max?SW_SHOWMAXIMIZED:SW_SHOWNOACTIVATE); GetClientRect(m_hwndViewer,&m_clientrect); // Allowing files to be droppped into the viewer window is sort of a hack, // but it's convenient. We have to be careful not to react to a dropped // file if the main application has a dialog box open that could be in the // middle of editing a file. DragAcceptFiles(m_hwndViewer,TRUE); m_dragging=0; m_imgpos_x = globals.viewer_imgpos_x; m_imgpos_y = globals.viewer_imgpos_y;}
开发者ID:dbremner,项目名称:tweakpng,代码行数:37,
示例16: IH_DlgMain/********************************************************************** * Functions *********************************************************************/BOOL CALLBACK IH_DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg) { case WM_INITDIALOG: { g_HWND=hwndDlg; EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_INLINE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_COPY), FALSE); } return TRUE; case WM_HELP: { char id[10]=""; sprintf(id, "%d", IDS_HELPINLINE); SetEnvironmentVariableA("HELPID", id); SetEnvironmentVariableA("HELPTITLE", "Inline Help"); DialogBox(hInst, MAKEINTRESOURCE(DLG_HELP), hwndDlg, DlgHelp); } return TRUE; case WM_BROWSE: { strcpy(g_szFileName, (const char*)wParam); //Retrieve the directory of the file. int i=strlen(g_szFileName)-1; int j=0; while(g_szFileName[i]!='//') { i--; j++; } strncpy(g_szTargetDir, g_szFileName, strlen(g_szFileName)-j-1); //Retrieve stuff. EnableWindow(GetDlgItem(g_HWND, IDC_BTN_INLINE), FALSE); EnableWindow(GetDlgItem(g_HWND, IDC_BTN_COPY), FALSE); SendDlgItemMessageA(g_HWND, IDC_EDT_OEP, EM_SETREADONLY, 0, 0); //Enable change of OEP... DragAcceptFiles(g_HWND, FALSE); g_FileIsDll=IH_Debugger(g_szFileName, &g_TargetData, IH_DebugEnd_Callback, IH_ErrorMessageCallback); } return TRUE; case WM_DROPFILES: { //Get the dropped file name. DragQueryFileA((HDROP)wParam, 0, g_szFileName, 256); //Retrieve the directory of the file. int i=strlen(g_szFileName)-1; int j=0; while(g_szFileName[i]!='//') { i--; j++; } strncpy(g_szTargetDir, g_szFileName, strlen(g_szFileName)-j-1); //Retrieve stuff. EnableWindow(GetDlgItem(g_HWND, IDC_BTN_INLINE), FALSE); EnableWindow(GetDlgItem(g_HWND, IDC_BTN_COPY), FALSE); SendDlgItemMessageA(g_HWND, IDC_EDT_OEP, EM_SETREADONLY, 0, 0); //Enable change of OEP... DragAcceptFiles(g_HWND, FALSE); g_FileIsDll=IH_Debugger(g_szFileName, &g_TargetData, IH_DebugEnd_Callback, IH_ErrorMessageCallback); } return TRUE; case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_BTN_INLINE: { NoFocus(); if(!(g_TargetData.EmptyEntry)) { MessageBoxA(hwndDlg, "You need to specify the place to start the inline...", "N00B!", MB_ICONERROR); return TRUE; } char patch_filename[256]=""; patch_filename[0]=0; OPENFILENAME ofstruct; memset(&ofstruct, 0, sizeof(ofstruct)); ofstruct.lStructSize=sizeof(ofstruct); ofstruct.hwndOwner=hwndDlg; ofstruct.hInstance=hInst; if(!g_FileIsDll) ofstruct.lpstrFilter="Executable files (*.exe)/0*.exe/0/0"; else ofstruct.lpstrFilter="Executable files (*.dll)/0*.dll/0/0"; ofstruct.lpstrFile=patch_filename; ofstruct.nMaxFile=256; ofstruct.lpstrInitialDir=g_szTargetDir; ofstruct.lpstrTitle="Save file";//.........这里部分代码省略.........
开发者ID:pepeng,项目名称:akt,代码行数:101,
示例17: main_page_//.........这里部分代码省略......... close_button_->setSizePolicy(sizePolicy2); close_button_->setProperty("CloseButton", QVariant(true)); horizontal_layout_->addWidget(close_button_); vertical_layout_->addWidget(title_widget_); stacked_widget_ = new BackgroundWidget(main_widget_, ""); stacked_widget_->setObjectName(QStringLiteral("stacked_widget")); QPixmap p(":/resources/main_window/pat_100.png"); setBackgroundPixmap(p, true); //Utils::InterConnector::instance().setMainWindow(this); get_qt_theme_settings()->setOrLoadDefaultTheme(); vertical_layout_->addWidget(stacked_widget_); this->setCentralWidget(main_widget_); logo_->setText(QString()); hide_button_->setText(QString()); maximize_button_->setText(QString()); close_button_->setText(QString()); stacked_widget_->setCurrentIndex(-1); QMetaObject::connectSlotsByName(this); if (!get_gui_settings()->get_value(settings_keep_logged_in, true))// || !get_gui_settings()->contains_value(settings_keep_logged_in)) { showLoginPage(); } else { showMainPage(); } title_widget_->installEventFilter(event_filter_); title_->setText("ICQ"); title_->setAttribute(Qt::WA_TransparentForMouseEvents); logo_->setAttribute(Qt::WA_TransparentForMouseEvents); setWindowTitle("ICQ");#ifdef _WIN32 setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::WindowMinimizeButtonHint); fake_parent_window_ = Utils::create_fake_parent_window();#else title_widget_->hide();#endif title_->setMouseTracking(true); connect(hide_button_, SIGNAL(clicked()), this, SLOT(minimize()), Qt::QueuedConnection); connect(maximize_button_, SIGNAL(clicked()), this, SLOT(maximize()), Qt::QueuedConnection); connect(close_button_, SIGNAL(clicked()), this, SLOT(hideWindow()), Qt::QueuedConnection); hide_button_->setCursor(Qt::PointingHandCursor); maximize_button_->setCursor(Qt::PointingHandCursor); close_button_->setCursor(Qt::PointingHandCursor); connect(event_filter_, SIGNAL(doubleClick()), this, SLOT(maximize()), Qt::QueuedConnection); connect(event_filter_, SIGNAL(moveRequest(QPoint)), this, SLOT(moveRequest(QPoint)), Qt::QueuedConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipResetComplete()), this, SLOT(onVoipResetComplete()), Qt::QueuedConnection); connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(showLoginPage()), Qt::DirectConnection); connect(&Utils::InterConnector::instance(), SIGNAL(showIconInTaskbar(bool)), this, SLOT(showIconInTaskbar(bool)), Qt::QueuedConnection); connect(this, SIGNAL(needActivate()), this, SLOT(activate()), Qt::QueuedConnection); connect(get_gui_settings(), SIGNAL(changed(QString)), this, SLOT(guiSettingsChanged(QString)), Qt::QueuedConnection); QFont f = QApplication::font(); f.setStyleStrategy(QFont::PreferAntialias); QApplication::setFont(f); if (platform::is_windows()) { int shadowWidth = get_gui_settings()->get_shadow_width(); QBrush b = stacked_widget_->palette().background(); QMatrix m; m.translate(shadowWidth, title_widget_->height() + shadowWidth); b.setMatrix(m); Shadow_ = new ShadowWindow(b, shadowWidth); QPoint pos = mapToGlobal(QPoint(rect().x(), rect().y())); Shadow_->move(pos.x(), pos.y()); Shadow_->resize(rect().width(), rect().height()); Shadow_->setActive(true); Shadow_->show(); } initSettings();#ifdef _WIN32 DragAcceptFiles((HWND)winId(), TRUE);#endif //_WIN32 if (!get_gui_settings()->get_value<bool>(settings_show_in_taskbar, true)) hide_taskbar_icon();#ifdef __APPLE__ mac_support_->enableMacUpdater(); mac_support_->enableMacPreview(this->winId());#endif }
开发者ID:ICoderXI,项目名称:icqdesktop,代码行数:101,
示例18: _tWinMain//.........这里部分代码省略......... choosecolor.lpCustColors = (COLORREF*) &custColors; choosecolor.Flags = 0; choosecolor.lCustData = 0; choosecolor.lpfnHook = NULL; choosecolor.lpTemplateName = NULL; /* initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName */ CopyMemory(ofnFilename, filename, sizeof(filename)); LoadString(hThisInstance, IDS_OPENFILTER, ofnFilter, SIZEOF(ofnFilter)); for(c = ofnFilter; *c; c++) if (*c == '/1') *c = '/0'; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd; ofn.hInstance = hThisInstance; ofn.lpstrFilter = ofnFilter; ofn.lpstrFile = ofnFilename; ofn.nMaxFile = SIZEOF(ofnFilename); ofn.lpstrFileTitle = ofnFiletitle; ofn.nMaxFileTitle = SIZEOF(ofnFiletitle); ofn.Flags = OFN_HIDEREADONLY; CopyMemory(sfnFilename, filename, sizeof(filename)); LoadString(hThisInstance, IDS_SAVEFILTER, sfnFilter, SIZEOF(sfnFilter)); for(c = sfnFilter; *c; c++) if (*c == '/1') *c = '/0'; ZeroMemory(&sfn, sizeof(OPENFILENAME)); sfn.lStructSize = sizeof(OPENFILENAME); sfn.hwndOwner = hwnd; sfn.hInstance = hThisInstance; sfn.lpstrFilter = sfnFilter; sfn.lpstrFile = sfnFilename; sfn.nMaxFile = SIZEOF(sfnFilename); sfn.lpstrFileTitle = sfnFiletitle; sfn.nMaxFileTitle = SIZEOF(sfnFiletitle); sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; /* creating the size boxes */ hSizeboxLeftTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxCenterTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxRightTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxLeftCenter = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxRightCenter = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxLeftBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxCenterBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxRightBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); /* placing the size boxes around the image */ SendMessage(hImageArea, WM_SIZE, 0, 0); /* by moving the window, the things in WM_SIZE are done */ MoveWindow(hwnd, 100, 100, 600, 450, TRUE); /* creating the text editor window for the text tool */ hwndTextEdit = CreateWindowEx(0, _T("TextEdit"), _T(""), WS_OVERLAPPEDWINDOW, 300, 0, 300, 200, hwnd, NULL, hThisInstance, NULL); /* creating the edit control within the editor window */ hwndEditCtl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0, 0, 100, 100, hwndTextEdit, NULL, hThisInstance, NULL); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); /* inform the system, that the main window accepts dropped files */ DragAcceptFiles(hwnd, TRUE); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage(&messages, NULL, 0, 0)) { TranslateAccelerator(hwnd, haccel, &messages); /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam;}
开发者ID:RPG-7,项目名称:reactos,代码行数:101,
示例19: createWindow// Creates the GLFW window and rendering context//static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig){ int xpos, ypos, fullWidth, fullHeight; WCHAR* wideTitle; window->win32.dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN; window->win32.dwExStyle = WS_EX_APPWINDOW; if (window->monitor) { window->win32.dwStyle |= WS_POPUP; // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor // video mode has been set _glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos); fullWidth = wndconfig->width; fullHeight = wndconfig->height; } else { if (wndconfig->decorated) { window->win32.dwStyle |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; if (wndconfig->resizable) { window->win32.dwStyle |= WS_MAXIMIZEBOX | WS_SIZEBOX; window->win32.dwExStyle |= WS_EX_WINDOWEDGE; } } else window->win32.dwStyle |= WS_POPUP; xpos = CW_USEDEFAULT; ypos = CW_USEDEFAULT; getFullWindowSize(window, wndconfig->width, wndconfig->height, &fullWidth, &fullHeight); } wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title); if (!wideTitle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to convert window title to UTF-16"); return GL_FALSE; } window->win32.handle = CreateWindowExW(window->win32.dwExStyle, _GLFW_WNDCLASSNAME, wideTitle, window->win32.dwStyle, xpos, ypos, fullWidth, fullHeight, NULL, // No parent window NULL, // No window menu GetModuleHandleW(NULL), window); // Pass object to WM_CREATE free(wideTitle); if (!window->win32.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window"); return GL_FALSE; } if (_glfw_ChangeWindowMessageFilterEx) { _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_DROPFILES, MSGFLT_ALLOW, NULL); _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYDATA, MSGFLT_ALLOW, NULL); _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); } if (wndconfig->floating && !wndconfig->monitor) { SetWindowPos(window->win32.handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } DragAcceptFiles(window->win32.handle, TRUE); if (!_glfwCreateContext(window, ctxconfig, fbconfig)) return GL_FALSE; return GL_TRUE;}
开发者ID:RubenMagallanes,项目名称:comp308sheepSim,代码行数:99,
示例20: _tWinMain/*********************************************************************** * * WinMain */int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int show){ MSG msg; HACCEL hAccel; WNDCLASSEX wndclass; HMONITOR monitor; MONITORINFO info; INT x, y; static const TCHAR className[] = _T("NPClass"); static const TCHAR winName[] = _T("Notepad"); UNREFERENCED_PARAMETER(prev); aFINDMSGSTRING = (ATOM) RegisterWindowMessage(FINDMSGSTRING); ZeroMemory(&Globals, sizeof(Globals)); Globals.hInstance = hInstance; LoadSettings(); ZeroMemory(&wndclass, sizeof(wndclass)); wndclass.cbSize = sizeof(wndclass); wndclass.lpfnWndProc = NOTEPAD_WndProc; wndclass.hInstance = Globals.hInstance; wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_NPICON)); wndclass.hCursor = LoadCursor(0, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndclass.lpszMenuName = MAKEINTRESOURCE(MAIN_MENU); wndclass.lpszClassName = className; wndclass.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_NPICON), IMAGE_ICON, 16, 16, 0); if (!RegisterClassEx(&wndclass)) return FALSE; /* Setup windows */ monitor = MonitorFromRect( &Globals.main_rect, MONITOR_DEFAULTTOPRIMARY ); info.cbSize = sizeof(info); GetMonitorInfoW( monitor, &info ); x = Globals.main_rect.left; y = Globals.main_rect.top; if (Globals.main_rect.left >= info.rcWork.right || Globals.main_rect.top >= info.rcWork.bottom || Globals.main_rect.right < info.rcWork.left || Globals.main_rect.bottom < info.rcWork.top) x = y = CW_USEDEFAULT; Globals.hMainWnd = CreateWindow(className, winName, WS_OVERLAPPEDWINDOW, x, y, Globals.main_rect.right - Globals.main_rect.left, Globals.main_rect.bottom - Globals.main_rect.top, NULL, NULL, Globals.hInstance, NULL); if (!Globals.hMainWnd) { ShowLastError(); ExitProcess(1); } DoCreateEditWindow(); NOTEPAD_InitData(); DIALOG_FileNew(); ShowWindow(Globals.hMainWnd, show); UpdateWindow(Globals.hMainWnd); DragAcceptFiles(Globals.hMainWnd, TRUE); DIALOG_ViewStatusBar(); HandleCommandLine(cmdline); hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(ID_ACCEL) ); while (GetMessage(&msg, 0, 0, 0)) { if (!IsDialogMessage(Globals.hFindReplaceDlg, &msg) && !TranslateAccelerator(Globals.hMainWnd, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:89,
示例21: ui_window_win32_set_droppablestatic void ui_window_win32_set_droppable(void *data, bool droppable){ /* Minimum supported client: Windows XP, minimum supported server: Windows 2000 Server */ ui_window_win32_t *window = (ui_window_win32_t*)data; DragAcceptFiles(window->hwnd, droppable);}
开发者ID:CrypticGator,项目名称:RetroArch,代码行数:6,
示例22: createWindow// Creates the GLFW window and rendering context//static GLFWbool createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig){ int xpos, ypos, fullWidth, fullHeight; WCHAR* wideTitle; if (wndconfig->monitor) { GLFWvidmode mode; // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor // video mode has been set _glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos); _glfwPlatformGetVideoMode(wndconfig->monitor, &mode); fullWidth = mode.width; fullHeight = mode.height; } else { xpos = CW_USEDEFAULT; ypos = CW_USEDEFAULT; getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), wndconfig->width, wndconfig->height, &fullWidth, &fullHeight); } wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title); if (!wideTitle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to convert window title to UTF-16"); return GLFW_FALSE; } window->win32.handle = CreateWindowExW(getWindowExStyle(window), _GLFW_WNDCLASSNAME, wideTitle, getWindowStyle(window), xpos, ypos, fullWidth, fullHeight, NULL, // No parent window NULL, // No window menu GetModuleHandleW(NULL), window); // Pass object to WM_CREATE free(wideTitle); if (!window->win32.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window"); return GLFW_FALSE; } if (_glfw_ChangeWindowMessageFilterEx) { _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_DROPFILES, MSGFLT_ALLOW, NULL); _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYDATA, MSGFLT_ALLOW, NULL); _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); } if (wndconfig->floating && !wndconfig->monitor) { SetWindowPos(window->win32.handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } DragAcceptFiles(window->win32.handle, TRUE); if (!_glfwCreateContext(window, ctxconfig, fbconfig)) return GLFW_FALSE; window->win32.minwidth = GLFW_DONT_CARE; window->win32.minheight = GLFW_DONT_CARE; window->win32.maxwidth = GLFW_DONT_CARE; window->win32.maxheight = GLFW_DONT_CARE; window->win32.numer = GLFW_DONT_CARE; window->win32.denom = GLFW_DONT_CARE; return GLFW_TRUE;}
开发者ID:notetau,项目名称:glfw,代码行数:91,
示例23: Show BOOL Show(HINSTANCE hInstance, int nCmdShow) { hInst = hInstance; // Store instance handle in our global variable int zoom = g_Config.iWindowZoom; if (zoom < 1) zoom = 1; if (zoom > 4) zoom = 4; RECT rc, rcOrig; GetWindowRectAtZoom(zoom, rcOrig, rc); u32 style = WS_OVERLAPPEDWINDOW; hwndMain = CreateWindowEx(0,szWindowClass, "", style, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL); if (!hwndMain) return FALSE; hwndDisplay = CreateWindowEx(0, szDisplayClass, TEXT(""), WS_CHILD | WS_VISIBLE, rcOrig.left, rcOrig.top, rcOrig.right - rcOrig.left, rcOrig.bottom - rcOrig.top, hwndMain, 0, hInstance, 0); if (!hwndDisplay) return FALSE; menu = GetMenu(hwndMain);#ifdef FINAL RemoveMenu(menu,2,MF_BYPOSITION); RemoveMenu(menu,2,MF_BYPOSITION);#endif MENUINFO info; ZeroMemory(&info,sizeof(MENUINFO)); info.cbSize = sizeof(MENUINFO); info.cyMax = 0; info.dwStyle = MNS_CHECKORBMP; info.fMask = MIM_STYLE; for (int i = 0; i < GetMenuItemCount(menu); i++) { SetMenuInfo(GetSubMenu(menu,i),&info); } UpdateMenus(); //accept dragged files DragAcceptFiles(hwndMain, TRUE); hideCursor = true; SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0); Update(); SetPlaying(0); if(g_Config.bFullScreenOnLaunch) _ViewFullScreen(hwndMain); ShowWindow(hwndMain, nCmdShow); W32Util::MakeTopMost(hwndMain, g_Config.bTopMost);#if ENABLE_TOUCH RegisterTouchWindow(hwndDisplay, TWF_WANTPALM);#endif RAWINPUTDEVICE keyboard; memset(&keyboard, 0, sizeof(keyboard)); keyboard.usUsagePage = 1; keyboard.usUsage = 6; keyboard.dwFlags = 0; // RIDEV_NOLEGACY | ; RegisterRawInputDevices(&keyboard, 1, sizeof(RAWINPUTDEVICE)); SetFocus(hwndDisplay); return TRUE; }
开发者ID:Micket,项目名称:ppsspp,代码行数:71,
示例24: switchLRESULT CALLBACK SimulatorWin::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ if (!_instance) return 0; switch (uMsg) { case WM_COMMAND: { if (HIWORD(wParam) == 0) { // menu WORD menuId = LOWORD(wParam); PlayerMenuItemWin *menuItem = _instance->_menuService->getItemByCommandId(menuId); if (menuItem) { AppEvent event("APP.EVENT", APP_EVENT_MENU); std::stringstream buf; buf << "{/"data/":/"" << menuItem->getMenuId().c_str() << "/""; buf << ",/"name/":" << "/"menuClicked/"" << "}"; event.setDataString(buf.str()); event.setUserData(menuItem); Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); } if (menuId == ID_HELP_ABOUT) { onHelpAbout(); } } break; } case WM_KEYDOWN: { if (wParam == VK_F5) { PlayerProtocol::getInstance()->relaunch(); } break; } case WM_COPYDATA: { PCOPYDATASTRUCT pMyCDS = (PCOPYDATASTRUCT) lParam; if (pMyCDS->dwData == 1) { const char *szBuf = (const char*)(pMyCDS->lpData); SimulatorWin::getInstance()->writeDebugLog(szBuf); break; } } case WM_DESTROY: { DragAcceptFiles(hWnd, FALSE); break; } case WM_DROPFILES: { HDROP hDrop = (HDROP)wParam; const int count = DragQueryFileW(hDrop, 0xffffffff, NULL, 0); if (count > 0) { int fileIndex = 0; const UINT length = DragQueryFileW(hDrop, fileIndex, NULL, 0); WCHAR* buffer = (WCHAR*)calloc(length + 1, sizeof(WCHAR)); DragQueryFileW(hDrop, fileIndex, buffer, length + 1); char *utf8 = SimulatorWin::convertTCharToUtf8(buffer); std::string firstFile(utf8); CC_SAFE_FREE(utf8); DragFinish(hDrop); // broadcast drop event AppEvent forwardEvent("APP.EVENT.DROP", APP_EVENT_DROP); forwardEvent.setDataString(firstFile); Director::getInstance()->getEventDispatcher()->dispatchEvent(&forwardEvent); } } // WM_DROPFILES } return g_oldWindowProc(hWnd, uMsg, wParam, lParam);}
开发者ID:hugohuang1111,项目名称:Bird,代码行数:88,
示例25: sizeof//.........这里部分代码省略......... // set environments SetCurrentDirectoryA(_project.getProjectDir().c_str()); FileUtils::getInstance()->setDefaultResourceRootPath(_project.getProjectDir()); FileUtils::getInstance()->setWritablePath(_project.getWritableRealPath().c_str()); // check screen DPI HDC screen = GetDC(0); int dpi = GetDeviceCaps(screen, LOGPIXELSX); ReleaseDC(0, screen); // set scale with DPI // 96 DPI = 100 % scaling // 120 DPI = 125 % scaling // 144 DPI = 150 % scaling // 192 DPI = 200 % scaling // http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#dpi_and_the_desktop_scaling_factor // // enable DPI-Aware with DeclareDPIAware.manifest // http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#declaring_dpi_awareness float screenScale = 1.0f; if (dpi >= 120 && dpi < 144) { screenScale = 1.25f; } else if (dpi >= 144 && dpi < 192) { screenScale = 1.5f; } else if (dpi >= 192) { screenScale = 2.0f; } CCLOG("SCREEN DPI = %d, SCREEN SCALE = %0.2f", dpi, screenScale); // create opengl view Size frameSize = _project.getFrameSize(); float frameScale = 1.0f; if (_project.isRetinaDisplay()) { frameSize.width *= screenScale; frameSize.height *= screenScale; } else { frameScale = screenScale; } const Rect frameRect = Rect(0, 0, frameSize.width, frameSize.height); const bool isResize = _project.isResizeWindow(); std::stringstream title; title << "Cocos Simulator - " << ConfigParser::getInstance()->getInitViewName(); initGLContextAttrs(); auto glview = GLViewImpl::createWithRect(title.str(), frameRect, frameScale); _hwnd = glview->getWin32Window(); DragAcceptFiles(_hwnd, TRUE); //SendMessage(_hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon); //SendMessage(_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon); //FreeResource(icon); auto director = Director::getInstance(); director->setOpenGLView(glview); director->setAnimationInterval(1.0 / 60.0); // set window position if (_project.getProjectDir().length()) { setZoom(_project.getFrameScale()); } Vec2 pos = _project.getWindowOffset(); if (pos.x != 0 && pos.y != 0) { RECT rect; GetWindowRect(_hwnd, &rect); MoveWindow(_hwnd, pos.x, pos.y, rect.right - rect.left, rect.bottom - rect.top, FALSE); } // path for looking Lang file, Studio Default images FileUtils::getInstance()->addSearchPath(getApplicationPath().c_str()); // init player services initServices(); setupUI(); DrawMenuBar(_hwnd); // prepare FileUtils::getInstance()->setPopupNotify(false); _project.dump(); auto app = Application::getInstance(); g_oldWindowProc = (WNDPROC)SetWindowLong(_hwnd, GWL_WNDPROC, (LONG)SimulatorWin::windowProc); // update window size RECT rect; GetWindowRect(_hwnd, &rect); MoveWindow(_hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + GetSystemMetrics(SM_CYMENU), FALSE); // startup message loop return app->run();}
开发者ID:hugohuang1111,项目名称:Bird,代码行数:101,
示例26: DragAcceptFilesint CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; DragAcceptFiles(true); EnableDocking( CBRS_ALIGN_TOP); EnableDocking( CBRS_ALIGN_RIGHT); EnableDocking( CBRS_ALIGN_LEFT); EnableDocking( CBRS_ALIGN_BOTTOM); UINT assignedToolbarID = 3344500; DWORD style = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC; if( !m_wndToolBar.CreateEx( this, TBSTYLE_FLAT, style, INXRect(1, 1, 1, 1), assignedToolbarID) ) return -1; if( !m_wndToolBar.LoadToolBar( IDR_MAINFRAME ) ) return -1;/* if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar/n"); return -1; // fail to create }*//* old toolbar method for 4bit colour toolbarHBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_BITMAP, 0,0, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);CBitmap bm;bm.Attach(hBitmap);*/// toolbar bitmap is comprosed of a strip of 16wx15h images for each button - for example if there are 30 buttons on the toolbar, the toolbar bitmap will be 30x16=480 pixels wide//standard image size for mfc toolbar is 16wx15h//int toolButtonHeight = 15;//int toolButtonWidth = 16;int toolButtonHeight = 24;int toolButtonWidth = 24;m_wndToolBar.SetSizes(INXSize(toolButtonWidth + 7, toolButtonHeight + 6), INXSize(toolButtonWidth, toolButtonHeight)); // NOTE - will fail unless button is bigger than image, +7 pixels w and +6 pixels h#ifndef TOOLBAR_32BitRGBA// use IDR_MAINFRAME Toolbar_24bit.bmp or Toolbar_16bit.bmp in DrawProg.rc// create a toolbar using the imagelistCImageList *m_imagelist = new CImageList;HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_BITMAP, 0,0, // cx, cy LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS );CBitmap bm;bm.Attach(hbm);m_imagelist->Create(toolButtonWidth,toolButtonHeight,ILC_COLOR24|ILC_MASK,1,1); //24bit colour with colour mask//m_imagelist->Create(toolButtonWidth,toolButtonHeight,ILC_COLOR16|ILC_MASK,1,1); //16bit colour with colour maskm_imagelist->Add(&bm, RGB(215,215,215)); // back colour of Toolbar_24bit.bmp and Toolbar_16bit.bmp to use as colour maskm_wndToolBar.GetToolBarCtrl().SetImageList(m_imagelist);//m_wndToolBar.GetToolBarCtrl().SetDisabledImageList(m_imagelist); // don't need this as mfc greys out buttons by default but if you want to design the images for disabled buttons, create an image list and add it here#else // use IDR_MAINFRAME Toolbar_32bit.bmp in DrawProg.rc// - this only works for machines with 32-bit colour depth, otherwise get black background// but still have a problem where there is a dark background colour to each button in wine// this may be the way the image is created in GIMP, some problem with the alpha channelCImageList *m_imagelist = new CImageList;HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_BITMAP, 0,0, // cx, cy LR_CREATEDIBSECTION);CBitmap bm;bm.Attach(hbm);m_imagelist->Create(toolButtonWidth,toolButtonHeight,ILC_COLOR32,1,1); // no colour mask with alpha transparencym_imagelist->Add(&bm, (CBitmap*)NULL);m_wndToolBar.GetToolBarCtrl().SetImageList(m_imagelist);//@todo - create a diabled image list. When using 32bit RGBA need a disabled image list, as mfc can't create greyed out icons as no colour mask//m_wndToolBar.GetToolBarCtrl().SetDisabledImageList(m_imagelist);#endif //TOOLBAR_32BitRGBA if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar/n"); return -1; // fail to create } // set width of pane and remove border m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_LOCALHOST),ID_INDICATOR_LOCALHOST, SBPS_NOBORDERS, 14);//.........这里部分代码省略.........
开发者ID:pdrezet,项目名称:brix,代码行数:101,
注:本文中的DragAcceptFiles函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DragFinish函数代码示例 C++ Double_val函数代码示例 |