这篇教程C++ GetActiveWindow函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetActiveWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActiveWindow函数的具体用法?C++ GetActiveWindow怎么用?C++ GetActiveWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetActiveWindow函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Win32_GetActiveWindowstatic intWin32_GetActiveWindow(Jim_Interp *interp, int objc, Jim_Obj * const *objv){ Jim_SetResult(interp, Jim_NewIntObj(interp, (DWORD)GetActiveWindow())); return JIM_OK;}
开发者ID:evanhunter,项目名称:jimtcl,代码行数:6,
示例2: WndProc//-----------------------------------------------------------------------------// Name: WndProc()// Desc: Handles window messages//-----------------------------------------------------------------------------LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ){ LRESULT lr = 0; switch( msg ) { // Pass these messages to user defined functions HANDLE_MSG( hWnd, WM_CREATE, OnCreate ); HANDLE_MSG( hWnd, WM_PAINT, OnPaint ); HANDLE_MSG( hWnd, WM_INITMENUPOPUP, OnInitMenuPopup ); HANDLE_MSG( hWnd, WM_KEYDOWN, OnKeyDown ); case WM_ACTIVATE: // sent when window changes active state if( WA_INACTIVE == wParam ) g_bActive = FALSE; else g_bActive = TRUE; // Set exclusive mode access to the mouse based on active state SetAcquire(); return 0; case WM_NCLBUTTONDOWN: switch (wParam) { case HTMINBUTTON: ShowWindow( hWnd, SW_MINIMIZE); break; case HTCLOSE: PostQuitMessage(0); break; } case WM_ENTERMENULOOP: case WM_ENTERSIZEMOVE: // un-acquire device when entering menu or re-sizing // this will show the mouse cursor again g_bActive = FALSE; SetAcquire(); return 0; case WM_EXITMENULOOP: // If we aren't returning from the popup menu, let the user continue // to be in non-exclusive mode (to move the window for example) if( (BOOL)wParam == FALSE ) return 0; case WM_EXITSIZEMOVE: // re-acquire device when leaving menu or re-sizing // this will show the mouse cursor again // even though the menu is going away, the app // might have lost focus or be an icon if( GetActiveWindow() == hWnd || !IsIconic( hWnd ) ) g_bActive = TRUE; else g_bActive = FALSE; SetAcquire(); return 0; case WM_SYSCOMMAND: lr = 0; switch ( LOWORD(wParam) ) { case IDC_CLEAR: OnClear( hWnd ); break; case IDC_ABOUT: MessageBox( hWnd, _T("Scrawl DirectInput Sample v1.0"), _T("Scrawl"), MB_OK ); break; case SC_SCREENSAVE: // eat the screen-saver notification. break; case IDC_SENSITIVITY_LOW: g_iSensitivity = -1; break; case IDC_SENSITIVITY_NORMAL: g_iSensitivity = 0; break; case IDC_SENSITIVITY_HIGH: g_iSensitivity = 1; break; default: lr = DefWindowProc( hWnd, msg, wParam, lParam ); break; }//.........这里部分代码省略.........
开发者ID:grakidov,项目名称:Render3D,代码行数:101,
示例3: isWindowActive//! returns if window is active. if not, nothing need to be drawnbool CIrrDeviceWinCE::isWindowActive() const{ bool ret = (GetActiveWindow() == HWnd); _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return ret;}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:7,
示例4: Openvoid TopWindow::Open(){ GuiLock __; Open(GetActiveWindow());}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:5,
示例5: WizardDlgProcstatic LRESULT WizardDlgProc(HWND hDlg,UINT msg, WPARAM wParam,LPARAM lParam) { int i; switch (msg) { case WM_INITDIALOG: hWizardDlg = hDlg; hWizardText = GetDlgItem(hDlg,IDC_OUTPUT); SendMessage(hWizardText,WM_SETFONT,(WPARAM)hfCourier,1); display_game_status(); SetTimer(hDlg,10,20,NULL); return 0; case WM_TIMER: do_events();return 1; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hDlg,0);return 0; case IDC_CLEARMAP: { HWND listwnd = PrepareListWindow(hDlg); HWND list = GetDlgItem(listwnd,IDC_LIST); int res; ListBox_AddString(list,"Clear Monsters"); ListBox_AddString(list,"Clear Items"); res = PumpDialogMessages(listwnd); if (res == IDOK) { if (ListBox_GetSel(list,0)) { for(i = 0;i<MAX_MOBS;i++) if (mobs[i].vlajky & MOB_LIVE) { vybrana_zbran = -1; select_player = -1; mob_hit(mobs+i,mobs[i].lives); } } if (ListBox_GetSel(list,1)) { for(i = 0;i<mapsize*4;i++) { destroy_items(map_items[i]); free(map_items[i]); map_items[i] = NULL; } for(i = 0;i<vyk_max;i++) { destroy_items(map_vyk[i].items); map_vyk[i].items[0] = 0; } } } CloseListWindow(listwnd); } break; case IDC_ADVENCE: { int i,j,c; if (!wzscanf("Advence to level <postava -1= vsichni><uroven>:","%d %d",&i,&j)) return 0; c = MessageBox(GetActiveWindow(),"Automaticky?","?",MB_YESNO|MB_ICONQUESTION); if (i>0) advence_player(i-1,j,c == IDYES);else for(i = 0;i<POCET_POSTAV;i++) if (postavy[i].used) advence_player(i,j,c == IDYES); return 0; } case IDC_GOTO: { char prompt[50]; sprintf(prompt,"Goto sector <1-%d>:",mapsize-1); if (!wzscanf(prompt,"%d",&viewsector)) return 0; chod_s_postavama(1); SEND_LOG("(WIZARD) Goto %d",viewsector,0); return 0; } case IDC_LOADMAP: if (!wzscanf("Load Map <filename><sector>","%s %hd",loadlevel.name,&loadlevel.start_pos)) return 0; for(i = 0;i<POCET_POSTAV;i++)postavy[i].sektor = loadlevel.start_pos; SEND_LOG("(WIZARD) Load map '%s' %d",loadlevel.name,loadlevel.start_pos); EndDialog(hDlg,0); send_message(E_CLOSE_MAP); return 0; case IDC_OPENDOOR:if (map_sectors[viewsector].step_next[viewdir]) delay_action(3,viewsector,viewdir,0x2000000,0,0); else delay_action(3,viewsector,viewdir,0,0,0); return 0; case IDC_TAKEMONEY:if (take_money()) return 0;break; case IDC_PURGE:if (purge_map()) return 0;break; case IDC_HEAL:if (heal_meditate()) return 0;break; case IDC_RAISEDEATH:if (raise_death()) return 0;break; case IDC_RAISEMONSTER:if (raise_killed_monster(hDlg)) return 0;break; case IDC_IMMORTAL:set_immortality();break; case IDC_NETECNOST:set_nohassle();break; case IDC_UNAFFECT :unaffect();break; case IDC_WEAPONSKILL:if (advance_weapon()) return 0;break; case IDC_REFRESH:display_game_status();break; case IDC_RELOADMOBILES: i = MessageBox(hDlg,"Tato funkce precte znova parametry vsech existujicich nestvur. " "Pouzivej jen v pripade, ze se tyto parametry zmenili a nesouhlasi tak " "obsah ulozene pozice. Pokracovat? ","??",MB_YESNO|MB_ICONQUESTION);//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:Brany_Skeldalu,代码行数:101,
示例6: set_active_window/******************************************************************* * set_active_window */static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ){ HWND previous = GetActiveWindow(); BOOL ret; DWORD old_thread, new_thread; CBTACTIVATESTRUCT cbt; if (previous == hwnd) { if (prev) *prev = hwnd; return TRUE; } /* call CBT hook chain */ cbt.fMouse = mouse; cbt.hWndActive = previous; if (HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hwnd, (LPARAM)&cbt, TRUE )) return FALSE; if (IsWindow(previous)) { SendMessageW( previous, WM_NCACTIVATE, FALSE, (LPARAM)hwnd ); SendMessageW( previous, WM_ACTIVATE, MAKEWPARAM( WA_INACTIVE, IsIconic(previous) ), (LPARAM)hwnd ); } SERVER_START_REQ( set_active_window ) { req->handle = wine_server_user_handle( hwnd ); if ((ret = !wine_server_call_err( req ))) previous = wine_server_ptr_handle( reply->previous ); } SERVER_END_REQ; if (!ret) return FALSE; if (prev) *prev = previous; if (previous == hwnd) return TRUE; if (hwnd) { /* send palette messages */ if (SendMessageW( hwnd, WM_QUERYNEWPALETTE, 0, 0 )) SendMessageTimeoutW( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0, SMTO_ABORTIFHUNG, 2000, NULL ); if (!IsWindow(hwnd)) return FALSE; } old_thread = previous ? GetWindowThreadProcessId( previous, NULL ) : 0; new_thread = hwnd ? GetWindowThreadProcessId( hwnd, NULL ) : 0; if (old_thread != new_thread) { HWND *list, *phwnd; if ((list = WIN_ListChildren( GetDesktopWindow() ))) { if (old_thread) { for (phwnd = list; *phwnd; phwnd++) { if (GetWindowThreadProcessId( *phwnd, NULL ) == old_thread) SendMessageW( *phwnd, WM_ACTIVATEAPP, 0, new_thread ); } } if (new_thread) { for (phwnd = list; *phwnd; phwnd++) { if (GetWindowThreadProcessId( *phwnd, NULL ) == new_thread) SendMessageW( *phwnd, WM_ACTIVATEAPP, 1, old_thread ); } } HeapFree( GetProcessHeap(), 0, list ); } } if (IsWindow(hwnd)) { SendMessageW( hwnd, WM_NCACTIVATE, (hwnd == GetForegroundWindow()), (LPARAM)previous ); SendMessageW( hwnd, WM_ACTIVATE, MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, IsIconic(hwnd) ), (LPARAM)previous ); } /* now change focus if necessary */ if (focus) { GUITHREADINFO info; GetGUIThreadInfo( GetCurrentThreadId(), &info ); /* Do not change focus if the window is no more active */ if (hwnd == info.hwndActive) { if (!info.hwndFocus || !hwnd || GetAncestor( info.hwndFocus, GA_ROOT ) != hwnd) set_focus_window( hwnd ); } } return TRUE;//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,
示例7: SplitFilenameint SmdExportClass::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts) { ExpInterface *pexpiface = ei; // Hungarian Interface *piface = i; // Hungarian // Reset the name-map property manager g_inmMac = 0; // Present the user with the Export Options dialog if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EXPORTOPTIONS), GetActiveWindow(), ExportOptionsDlgProc, (LPARAM)this) <= 0) return 0; // error or cancel // Break up filename, re-assemble longer versions TSTR strPath, strFile, strExt; TCHAR szFile[MAX_PATH]; SplitFilename(TSTR(name), &strPath, &strFile, &strExt); sprintf(szFile, "%s//%s.%s", (char*)strPath, (char*)strFile, DEFAULT_EXT); /* if (m_fReferenceFrame) sprintf(szFile, "%s//%s_model.%s", (char*)strPath, (char*)strFile, DEFAULT_EXT); */ FILE *pFile; if ((pFile = fopen(szFile, "w")) == NULL) return FALSE/*failure*/; fprintf( pFile, "version %d/n", 1 ); // Get animation metrics m_intervalOfAnimation = piface->GetAnimRange(); m_tvStart = m_intervalOfAnimation.Start(); m_tvEnd = m_intervalOfAnimation.End(); m_tpf = ::GetTicksPerFrame(); // Count nodes, label them, collect into array if (!CollectNodes(pexpiface)) return 0; /*fail*/ // Output nodes if (!DumpBones(pFile, pexpiface)) { fclose( pFile ); return 0; /*fail*/ } // Output bone rotations, for each frame. Do only first frame if this is the reference frame MAX file DumpRotations(pFile, pexpiface); // Output triangle meshes (first frame/all frames), if this is the reference frame MAX file if (m_fReferenceFrame) { DumpModel(pFile, pexpiface); } // Tell user that exporting is finished (it can take a while with no feedback) char szExportComplete[300]; sprintf(szExportComplete, "Exported %s.", szFile); MessageBox(GetActiveWindow(), szExportComplete, "Status", MB_OK); fclose( pFile ); return 1/*success*/;}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:65,
示例8: _gcry_rndw32_gather_random_fastvoid_gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t, enum random_origins), enum random_origins origin){ static int addedFixedItems = 0; if ( debug_me ) log_debug ("rndw32#gather_random_fast: ori=%d/n", origin ); /* Get various basic pieces of system information: Handle of active window, handle of window with mouse capture, handle of clipboard owner handle of start of clpboard viewer list, pseudohandle of current process, current process ID, pseudohandle of current thread, current thread ID, handle of desktop window, handle of window with keyboard focus, whether system queue has any events, cursor position for last message, 1 ms time for last message, handle of window with clipboard open, handle of process heap, handle of procs window station, types of events in input queue, and milliseconds since Windows was started. */ { byte buffer[20*sizeof(ulong)], *bufptr; bufptr = buffer;#define ADD(f) do { ulong along = (ulong)(f); / memcpy (bufptr, &along, sizeof (along) ); / bufptr += sizeof (along); / } while (0) ADD ( GetActiveWindow ()); ADD ( GetCapture ()); ADD ( GetClipboardOwner ()); ADD ( GetClipboardViewer ()); ADD ( GetCurrentProcess ()); ADD ( GetCurrentProcessId ()); ADD ( GetCurrentThread ()); ADD ( GetCurrentThreadId ()); ADD ( GetDesktopWindow ()); ADD ( GetFocus ()); ADD ( GetInputState ()); ADD ( GetMessagePos ()); ADD ( GetMessageTime ()); ADD ( GetOpenClipboardWindow ()); ADD ( GetProcessHeap ()); ADD ( GetProcessWindowStation ()); ADD ( GetQueueStatus (QS_ALLEVENTS)); ADD ( GetTickCount ()); gcry_assert ( bufptr-buffer < sizeof (buffer) ); (*add) ( buffer, bufptr-buffer, origin );#undef ADD } /* Get multiword system information: Current caret position, current mouse cursor position. */ { POINT point; GetCaretPos (&point); (*add) ( &point, sizeof (point), origin ); GetCursorPos (&point); (*add) ( &point, sizeof (point), origin ); } /* Get percent of memory in use, bytes of physical memory, bytes of free physical memory, bytes in paging file, free bytes in paging file, user bytes of address space, and free user bytes. */ { MEMORYSTATUS memoryStatus; memoryStatus.dwLength = sizeof (MEMORYSTATUS); GlobalMemoryStatus (&memoryStatus); (*add) ( &memoryStatus, sizeof (memoryStatus), origin ); } /* Get thread and process creation time, exit time, time in kernel mode, and time in user mode in 100ns intervals. */ { HANDLE handle; FILETIME creationTime, exitTime, kernelTime, userTime; DWORD minimumWorkingSetSize, maximumWorkingSetSize; handle = GetCurrentThread (); GetThreadTimes (handle, &creationTime, &exitTime, &kernelTime, &userTime); (*add) ( &creationTime, sizeof (creationTime), origin ); (*add) ( &exitTime, sizeof (exitTime), origin ); (*add) ( &kernelTime, sizeof (kernelTime), origin ); (*add) ( &userTime, sizeof (userTime), origin ); handle = GetCurrentProcess (); GetProcessTimes (handle, &creationTime, &exitTime, &kernelTime, &userTime); (*add) ( &creationTime, sizeof (creationTime), origin ); (*add) ( &exitTime, sizeof (exitTime), origin ); (*add) ( &kernelTime, sizeof (kernelTime), origin ); (*add) ( &userTime, sizeof (userTime), origin ); /* Get the minimum and maximum working set size for the current//.........这里部分代码省略.........
开发者ID:Greenchik,项目名称:libgcrypt,代码行数:101,
示例9: GUI_ListenerDWORD GUI_Listener (){ BYTE _receive_buffer [BUFFER_SIZE]; MICROBUFFER * p_message_received = (MICROBUFFER *) _receive_buffer; HWND _requesters_list [MAX_MESSAGE_REQUESTERS]; ULONG _requesters_num; BYTE _i; WORD _gui_msg_id; WORD _get_order; InitRequesters (); // non stop receiving messages loop for (;;) { if ( ShutdownFlag ) { return DB_SUCCESS; } // Wait for message if ( ! ReceiveMessage (GUIAdmRouteId, p_message_received, BUFFER_SIZE, 100 ) ) { Sleep (15); continue; } /*WCG. 02-02-1999 Check for different types of messages*/ switch ( p_message_received->Command ) { case GUIMSG_SESSION_CLOSE : /*ToDo We must find a nicer way to show this close session message to the user and reconnect*/ MessageBox (GetActiveWindow(), "Session Closed By DBService Run The GUI again", "Multigame System Message", MB_OK | MB_ICONERROR); break; default :// if ( p_message_received->Command == GUIMSG_CALC_WINNDIVS// || p_message_received->Command == GUIMSG_CREATE_WINNINGS )// {// Beep (400, 500);// } // XID on 11-NOV-1999 // Added loop to get several gui_msg_id from a message command. // Needed to handle draw progress message in provisional and definitive draws for (_get_order = 0; ; _get_order++) { _gui_msg_id = TranslateMsgToGUI (p_message_received->Command, _get_order); if (_gui_msg_id == (WORD) -1) break; _requesters_num = MAX_MESSAGE_REQUESTERS; GetAllRequestersByMessage (_gui_msg_id, _requesters_list, &_requesters_num); for ( _i = 0 ; _i < _requesters_num ; _i++ ) { // Sends the message and waits for its processing. The we can reuse // the buffer for other receives SendMessage (_requesters_list[_i], WM_GUIMSG, (WPARAM) p_message_received->ByteCount, (LPARAM) p_message_received); } } break; } } return DB_SUCCESS;}
开发者ID:bochaqos,项目名称:tol,代码行数:82,
示例10: PluginMainDLLExport MACPASCAL void PluginMain(const int16 selector, FormatRecordPtr formatParamBlock, intptr_t * data, int16 * result){ PSHandleSuite1* sPSHandleSuite; Boolean oldLock = FALSE; gFormatRecord = formatParamBlock; gResult = result; if (selector == formatSelectorAbout) {#ifdef MSWindows MessageBox(GetActiveWindow(), TEXT("Age of Empires III DirectDraw Texture Plug-in for Adobe Photoshop/n/n") TEXT("Copyright(C) 2016, Cliff Kang"), TEXT("About"), MB_ICONINFORMATION | MB_OK);#endif } else { *gResult = gFormatRecord->sSPBasic->AcquireSuite(kPSHandleSuite, kPSHandleSuiteVersion1, (const void**)&sPSHandleSuite); if (*gResult != noErr) return; if (*data == NULL) { Boolean oldLock = FALSE; *data = reinterpret_cast<intptr_t>(sPSHandleSuite->New(sizeof(DDTPlugInData))); sPSHandleSuite->SetLock(reinterpret_cast<Handle>(*data), TRUE, reinterpret_cast<Ptr*>(&gPlugInData), &oldLock); gPlugInData->InputTextureType = DDT_BGRA; gPlugInData->Options.TextureUsage = DDT_DIFFUSE; gPlugInData->Options.TextureAlphaUsage = DDT_NONE; gPlugInData->Options.TextureType = DDT_BGRA; gPlugInData->Options.ImageCount = 1; gPlugInData->Options.MIPMapSharpness = 0.25f; } else sPSHandleSuite->SetLock(reinterpret_cast<Handle>(*data), TRUE, reinterpret_cast<Ptr*>(&gPlugInData), &oldLock); switch (selector) { case formatSelectorReadPrepare: gFormatRecord->maxData = 0; break; case formatSelectorReadStart: DDTReadBegin(); break; case formatSelectorReadContinue: DDTReadContinue(); break; case formatSelectorReadFinish: gFormatRecord->maxData = 0; break; case formatSelectorOptionsPrepare: gFormatRecord->maxData = 0; break; case formatSelectorOptionsStart: DDTCreateOptionsDialog(); if (*gResult != noErr) return; gFormatRecord->data = NULL; break; case formatSelectorOptionsContinue: break; case formatSelectorOptionsFinish: break; case formatSelectorEstimatePrepare: gFormatRecord->maxData = 0; break; case formatSelectorEstimateStart: DDTEstimateBegin(); break; case formatSelectorEstimateContinue: break; case formatSelectorEstimateFinish: break; case formatSelectorWritePrepare: gFormatRecord->maxData = 0; break; case formatSelectorWriteStart: DDTWriteBegin(); break; case formatSelectorWriteContinue: DDTWriteContinue(); break;//.........这里部分代码省略.........
开发者ID:kangcliff,项目名称:Age-of-Empires-III,代码行数:101,
示例11: Test_SendInputvoid Test_SendInput(){ MSG_ENTRY Thread1_chain[]={ {1,WM_KEYDOWN, POST, VK_SHIFT, 0}, {1,WM_KEYUP, POST, VK_SHIFT, 0}, {0,0}}; MSG_ENTRY Thread0_chain[]={ {0,WM_KEYDOWN, POST, VK_SHIFT, 0}, {0,WM_KEYUP, POST, VK_SHIFT, 0}, {0,0}}; BOOL ret; /* First try sending input without attaching. It will go to the foreground */ { SetForegroundWindow(data[1].hWnd); SetActiveWindow(data[0].hWnd); ok(GetForegroundWindow() == data[1].hWnd, "wrong foreground/n"); ok(GetActiveWindow() == data[0].hWnd, "wrong active/n"); FlushMessages(); EMPTY_CACHE_(&data[0].cache); EMPTY_CACHE_(&data[1].cache); keybd_event(VK_SHIFT, 0,0,0); keybd_event(VK_SHIFT, 0,KEYEVENTF_KEYUP,0); Sleep(100); FlushMessages(); COMPARE_CACHE_(&data[0].cache, empty_chain); COMPARE_CACHE_(&data[1].cache, Thread1_chain); } /* Next attach and send input. It will go to the same thread as before */ { ret = AttachThreadInput( data[1].tid, data[0].tid , TRUE); ok(ret==1, "expected AttachThreadInput to succeed/n"); FlushMessages(); EMPTY_CACHE_(&data[0].cache); EMPTY_CACHE_(&data[1].cache); keybd_event(VK_SHIFT, 0,0,0); keybd_event(VK_SHIFT, 0,KEYEVENTF_KEYUP,0); Sleep(100); FlushMessages(); COMPARE_CACHE_(&data[0].cache, empty_chain); COMPARE_CACHE_(&data[1].cache, Thread1_chain); } /* Now set foregroung and active again. Input will go to thread 0 */ { SetForegroundWindow(data[1].hWnd); SetActiveWindow(data[0].hWnd); FlushMessages(); EMPTY_CACHE_(&data[0].cache); EMPTY_CACHE_(&data[1].cache); keybd_event(VK_SHIFT, 0,0,0); keybd_event(VK_SHIFT, 0,KEYEVENTF_KEYUP,0); Sleep(100); FlushMessages(); COMPARE_CACHE_(&data[0].cache, Thread0_chain); COMPARE_CACHE_(&data[1].cache, empty_chain); ret = AttachThreadInput( data[1].tid, data[0].tid , FALSE); ok(ret==1, "expected AttachThreadInput to succeed/n"); } /* Attach in the opposite order and send input */ { ret = AttachThreadInput( data[0].tid, data[1].tid , TRUE); ok(ret==1, "expected AttachThreadInput to succeed/n"); FlushMessages(); EMPTY_CACHE_(&data[0].cache); EMPTY_CACHE_(&data[1].cache); keybd_event(VK_SHIFT, 0,0,0); keybd_event(VK_SHIFT, 0,KEYEVENTF_KEYUP,0); Sleep(100); FlushMessages(); COMPARE_CACHE_(&data[0].cache, Thread0_chain); COMPARE_CACHE_(&data[1].cache, empty_chain); } /* Now set foregroung and active again. Input will go to thread 0 */ { SetForegroundWindow(data[1].hWnd); SetActiveWindow(data[0].hWnd); FlushMessages(); EMPTY_CACHE_(&data[0].cache); EMPTY_CACHE_(&data[1].cache);//.........这里部分代码省略.........
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:101,
示例12: RecycleBin_DeleteItemsstatic HRESULT WINAPI RecycleBin_DeleteItems(ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl){ TRACE("(%p,%u,%p)/n",iface,cidl,apidl); return erase_items(GetActiveWindow(),apidl,cidl,TRUE);}
开发者ID:YokoZar,项目名称:wine,代码行数:6,
示例13: _tWinMainint WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/){ HRESULT hRes = OleInitialize(NULL); SASSERT(SUCCEEDED(hRes)); int nRet = 0; SComMgr *pComMgr = new SComMgr; //将程序的运行路径修改到项目所在目录所在的目录 TCHAR szCurrentDir[MAX_PATH] = { 0 }; GetModuleFileName(NULL, szCurrentDir, sizeof(szCurrentDir)); LPTSTR lpInsertPos = _tcsrchr(szCurrentDir, _T('//')); _tcscpy(lpInsertPos + 1, _T("..")); SetCurrentDirectory(szCurrentDir); { BOOL bLoaded=FALSE; CAutoRefPtr<SOUI::IImgDecoderFactory> pImgDecoderFactory; CAutoRefPtr<SOUI::IRenderFactory> pRenderFactory; bLoaded = pComMgr->CreateRender_GDI((IObjRef**)&pRenderFactory); SASSERT_FMT(bLoaded,_T("load interface [render] failed!")); bLoaded=pComMgr->CreateImgDecoder((IObjRef**)&pImgDecoderFactory); SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("imgdecoder")); pRenderFactory->SetImgDecoderFactory(pImgDecoderFactory); SApplication *theApp = new SApplication(pRenderFactory, hInstance); //从DLL加载系统资源 HMODULE hModSysResource = LoadLibrary(SYS_NAMED_RESOURCE); if (hModSysResource) { CAutoRefPtr<IResProvider> sysResProvider; CreateResProvider(RES_PE, (IObjRef**)&sysResProvider); sysResProvider->Init((WPARAM)hModSysResource, 0); theApp->LoadSystemNamedResource(sysResProvider); FreeLibrary(hModSysResource); }else { SASSERT(0); } CAutoRefPtr<IResProvider> pResProvider;#if (RES_TYPE == 0) CreateResProvider(RES_FILE, (IObjRef**)&pResProvider); if (!pResProvider->Init((LPARAM)_T("uires"), 0)) { SASSERT(0); return 1; }#else CreateResProvider(RES_PE, (IObjRef**)&pResProvider); pResProvider->Init((WPARAM)hInstance, 0);#endif theApp->AddResProvider(pResProvider); theApp->Init(_T("XML_INIT")); // BLOCK: Run application { CMainDlg dlgMain; dlgMain.Create(GetActiveWindow()); dlgMain.SendMessage(WM_INITDIALOG); dlgMain.CenterWindow(dlgMain.m_hWnd); dlgMain.ShowWindow(SW_SHOWNORMAL); nRet = theApp->Run(dlgMain.m_hWnd); } delete theApp; } delete pComMgr; OleUninitialize(); return nRet;}
开发者ID:Prophecy2015,项目名称:HeatNetWork,代码行数:75,
示例14: DlgProcParentWindow//.........这里部分代码省略......... y = thinfo.pt.y; ScreenToClient(dat->hwndTabs, &thinfo.pt); tabId = TabCtrl_HitTest(dat->hwndTabs, &thinfo); if (tabId != -1) { struct MessageWindowData * mwd = GetChildFromTab(dat->hwndTabs, tabId); //CallService(MS_USERINFO_SHOWDIALOG, (WPARAM) mwd->hContact, 0); HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) mwd->hContact, 0); TrackPopupMenu(hMenu, 0, x, y, 0, mwd->hwnd, NULL); DestroyMenu(hMenu); } } break; } } else if (pNMHDR->hwndFrom == dat->hwndStatus) { switch (pNMHDR->code) { case NM_CLICK: { NMMOUSE *nm=(NMMOUSE*)lParam; RECT rc; SendMessage(dat->hwndStatus, SB_GETRECT, SendMessage(dat->hwndStatus, SB_GETPARTS, 0, 0) - 1, (LPARAM)&rc); if (nm->pt.x >= rc.left) SendMessage(dat->hwndActive, DM_SWITCHUNICODE, 0, 0); } } break; } } break; case WM_DROPFILES: SendMessage(dat->hwndActive, WM_DROPFILES, wParam, lParam); break; case WM_TIMER: if (wParam == TIMERID_FLASHWND) { if ((dat->nFlash > dat->nFlashMax)) {// || ((GetActiveWindow() == hwndDlg) && (GetForegroundWindow() == hwndDlg))) { KillTimer(hwndDlg, TIMERID_FLASHWND); FlashWindow(hwndDlg, FALSE); } else if (dat->nFlash < dat->nFlashMax) { FlashWindow(hwndDlg, TRUE); dat->nFlash++; } } break; case WM_CONTEXTMENU: { if (dat->hwndStatus && dat->hwndStatus == (HWND) wParam) { RECT rc; POINT pt, pt2; GetCursorPos(&pt); pt2.x = pt.x; pt2.y = pt.y; ScreenToClient(dat->hwndStatus, &pt); SendMessage(dat->hwndStatus, SB_GETRECT, SendMessage(dat->hwndStatus, SB_GETPARTS, 0, 0) - 1, (LPARAM)&rc); if (pt.x >= rc.left && dat->hwndActive != NULL) { int codePage = (int) SendMessage(dat->hwndActive, DM_GETCODEPAGE, 0, 0); int i, iSel; for(i = 0; i < GetMenuItemCount(g_dat->hMenuANSIEncoding); i++) { CheckMenuItem (g_dat->hMenuANSIEncoding, i, MF_BYPOSITION | MF_UNCHECKED); } if(codePage == CP_ACP) { CheckMenuItem(g_dat->hMenuANSIEncoding, 0, MF_BYPOSITION | MF_CHECKED); } else { CheckMenuItem(g_dat->hMenuANSIEncoding, codePage, MF_BYCOMMAND | MF_CHECKED); } iSel = TrackPopupMenu(g_dat->hMenuANSIEncoding, TPM_RETURNCMD, pt2.x, pt2.y, 0, hwndDlg, NULL); if (iSel >= 500) { if (iSel == 500) iSel = CP_ACP;
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:67,
示例15: USBaboutvoid CALLBACK USBabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), (DLGPROC)AboutDlgProc);}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:6,
示例16: iupdrvMenuPopupint iupdrvMenuPopup(Ihandle* ih, int x, int y){ HWND hWndActive = GetActiveWindow(); int tray_menu = 0; int menuId; if (!hWndActive) { /* search for a valid handle */ Ihandle* dlg = iupDlgListFirst(); do { if (dlg->handle) { hWndActive = dlg->handle; /* found a valid handle */ /* if not a "TRAY" dialog, keep searching, because TRAY is a special case */ if (iupAttribGetBoolean(dlg, "TRAY")) break; } dlg = iupDlgListNext(); } while (dlg); } /* Necessary to avoid tray dialogs to lock popup menus (they get sticky after the 1st time) */ if (hWndActive) { Ihandle* dlg = iupwinHandleGet(hWndActive); if (dlg && iupAttribGetBoolean(dlg, "TRAY")) { /* To display a context menu for a notification icon, the current window must be the foreground window. */ SetForegroundWindow(hWndActive); tray_menu = 1; } } /* stop processing here. messages will not go to the message loop */ menuId = TrackPopupMenu((HMENU)ih->handle, TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, 0, hWndActive, NULL); if (tray_menu) { /* You must force a task switch to the application that called TrackPopupMenu at some time in the near future. This is done by posting a benign message to the window. */ PostMessage(hWndActive, WM_NULL, 0, 0); } if (menuId) { Icallback cb; Ihandle* ih_item = iupwinMenuGetItemHandle((HMENU)ih->handle, menuId); if (!ih_item) return IUP_NOERROR; winItemCheckToggle(ih_item); cb = IupGetCallback(ih_item, "ACTION"); if (cb && cb(ih_item) == IUP_CLOSE) IupExitLoop(); } return IUP_NOERROR;}
开发者ID:pottootje1982,项目名称:singalong,代码行数:63,
示例17: FWconfigurevoid CALLBACK FWconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigureDlgProc); }
开发者ID:mfitz21,项目名称:pcsx2-rr,代码行数:6,
示例18: DefWindowProc/* * This procedure implements the messages passed by the window * manager for default processing on behalf of the window. */LRESULT WINAPIDefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ HDC hdc; RECT rc; DWORD dwStyle; HBRUSH hbr; HPEN hpen, holdpen; PAINTSTRUCT ps; POINT curpt; int x, y; HWND wp; HWND oldActive; COLORREF crCaption; LPNCCALCSIZE_PARAMS lpnc; CHAR szTitle[64]; static POINT startpt; switch(msg) { case WM_NCCALCSIZE: /* calculate client rect from passed window rect in rgrc[0]*/ lpnc = (LPNCCALCSIZE_PARAMS)lParam; dwStyle = GetWindowLong(hwnd, GWL_STYLE); if(dwStyle & WS_BORDER) { if((dwStyle & WS_CAPTION) == WS_CAPTION) { InflateRect(&lpnc->rgrc[0], -mwSYSMETRICS_CXFRAME, -mwSYSMETRICS_CYFRAME); lpnc->rgrc[0].top += mwSYSMETRICS_CYCAPTION + 1; } else InflateRect(&lpnc->rgrc[0], -1, -1); } break; case WM_NCPAINT: /* repaint all non-client area*/ dwStyle = GetWindowLong(hwnd, GWL_STYLE); if(dwStyle & WS_BORDER) { hdc = GetWindowDC(hwnd); GetWindowRect(hwnd, &rc); if((dwStyle & WS_CAPTION) == WS_CAPTION) { /* draw 2-line 3d border around window*/ Draw3dOutset(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top); InflateRect(&rc, -2, -2); /* draw 1-line inset inside border*/ hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE)); holdpen = SelectObject(hdc, hpen); SelectObject(hdc, GetStockObject(NULL_BRUSH)); Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom); InflateRect(&rc, -1, -1); /* fill caption*/ rc.bottom = rc.top + mwSYSMETRICS_CYCAPTION; crCaption = GetActiveWindow()==hwnd? GetSysColor(COLOR_ACTIVECAPTION): GetSysColor(COLOR_INACTIVECAPTION); hbr = CreateSolidBrush(crCaption); FillRect(hdc, &rc, hbr); DeleteObject(hbr); /* draw 1 line under caption*/ MoveToEx(hdc, rc.left, rc.bottom, NULL); LineTo(hdc, rc.right, rc.bottom); DeleteObject(SelectObject(hdc, holdpen)); /* draw caption text*/ if(GetWindowText(hwnd, szTitle, sizeof(szTitle))) { SetBkMode(hdc, TRANSPARENT); /* set background color even though * transparent in case GdArea is used * to draw text which compares * gr_foreground != gr_background * when transparent... */ SetBkColor(hdc, crCaption); SetTextColor(hdc, GetActiveWindow()==hwnd? GetSysColor(COLOR_CAPTIONTEXT): GetSysColor(COLOR_INACTIVECAPTIONTEXT)); SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); GetWindowRect(hwnd, &rc); TextOut(hdc, rc.left+4, rc.top+2, szTitle, strlen(szTitle)); } /* draw close box*/ GetCloseBoxRect(hwnd, &rc); /*DrawDIB(hdc, rc.right-XSIZE_CLOSEBOX-3,//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:101,
示例19: compressvoid DLL_EXPORT compress(char *oldExeName, int exeSection, int extraDataSize, char *newExeName, char *compressDll){ //compress uncompressed dbpro exe void* (*comp)(void*, int); FILE *oldExe = fopen(oldExeName, "rb"); //uncompressed exe FILE *newExe = fopen(newExeName, "wb"); //compressed exe FILE *compDll = fopen(compressDll, "rb"); void *buffer; SIZE_T compSize; int dataSize, dllLen; long time; float seconds; HANDLE lib = LoadLibrary(compressDll); comp = (void* (*)(void*, int)) GetProcAddress(lib, "compress_block"); //get uncompressed data size fseek(oldExe, 0, SEEK_END); dataSize = ftell(oldExe) - exeSection - extraDataSize; fseek(oldExe, 0, SEEK_SET); //write exe section buffer = malloc(exeSection); fread(buffer, exeSection, 1, oldExe); fwrite(buffer, exeSection, 1, newExe); free(buffer); //write compress.dll dllLen = 12; fwrite(&dllLen, 1, 4, newExe); //namelength fwrite("compress.dll", 1, 12, newExe); //name fseek(compDll, 0, SEEK_END); dllLen = ftell(compDll); fseek(compDll, 0, SEEK_SET); fwrite(&dllLen, 1, 4, newExe); //datalength buffer = malloc(dllLen); fread(buffer, dllLen, 1, compDll); fwrite(buffer, dllLen, 1, newExe); free(buffer); //load uncompressed data into buffer buffer = malloc(dataSize); fread(buffer, dataSize, 1, oldExe); //compress data time = GetTickCount(); void *data = comp(buffer, dataSize); time = GetTickCount() - time; seconds = time / 1000.0; free(buffer); data = GlobalLock((HGLOBAL) data); compSize = GlobalSize((HGLOBAL) data); //write compressed data fwrite(data, compSize, 1, newExe); GlobalUnlock((HGLOBAL) data); //write extra data fwrite(extraData, 16, 1, newExe); //write exeSection size fwrite(&exeSection, 4, 1, newExe); //show decompression stats message box char msg[255]; msg[0] = 0; sprintf(msg, "Compress complete in %.2f seconds", seconds); MessageBox(GetActiveWindow(), msg, "dark_explorer", 0); FreeLibrary(lib); fclose(oldExe); fclose(newExe); fclose(compDll);}
开发者ID:winch,项目名称:winch.pinkbile.com-c-sharp,代码行数:72,
示例20: AssertFailedFuncstatic int AssertFailedFunc(char *sz){ MessageBox(GetActiveWindow(), sz, "Assert failure", MB_OK); int Set_Your_Breakpoint_Here = 1; return 1;}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:6,
示例21: AboutBoxvoid AboutBox(){ DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), (DLGPROC)AboutProc);}
开发者ID:Alchemistxxd,项目名称:pcsx2,代码行数:4,
示例22: FastPoll/* This is the fastpoll function which gathers up info by calling various api's */BOOL FastPoll (void){ int nOriginalRandIndex = nRandIndex; static BOOL addedFixedItems = FALSE; FILETIME creationTime, exitTime, kernelTime, userTime; DWORD minimumWorkingSetSize, maximumWorkingSetSize; LARGE_INTEGER performanceCount; MEMORYSTATUS memoryStatus; HANDLE handle; POINT point; /* Get various basic pieces of system information */ RandaddInt32 (GetActiveWindow ()); /* Handle of active window */ RandaddInt32 (GetCapture ()); /* Handle of window with mouse capture */ RandaddInt32 (GetClipboardOwner ()); /* Handle of clipboard owner */ RandaddInt32 (GetClipboardViewer ()); /* Handle of start of clpbd.viewer list */ RandaddInt32 (GetCurrentProcess ()); /* Pseudohandle of current process */ RandaddInt32 (GetCurrentProcessId ()); /* Current process ID */ RandaddInt32 (GetCurrentThread ()); /* Pseudohandle of current thread */ RandaddInt32 (GetCurrentThreadId ()); /* Current thread ID */ RandaddInt32 (GetCurrentTime ()); /* Milliseconds since Windows started */ RandaddInt32 (GetDesktopWindow ()); /* Handle of desktop window */ RandaddInt32 (GetFocus ()); /* Handle of window with kb.focus */ RandaddInt32 (GetInputState ()); /* Whether sys.queue has any events */ RandaddInt32 (GetMessagePos ()); /* Cursor pos.for last message */ RandaddInt32 (GetMessageTime ()); /* 1 ms time for last message */ RandaddInt32 (GetOpenClipboardWindow ()); /* Handle of window with clpbd.open */ RandaddInt32 (GetProcessHeap ()); /* Handle of process heap */ RandaddInt32 (GetProcessWindowStation ()); /* Handle of procs window station */ RandaddInt32 (GetQueueStatus (QS_ALLEVENTS)); /* Types of events in input queue */ /* Get multiword system information */ GetCaretPos (&point); /* Current caret position */ RandaddBuf ((unsigned char *) &point, sizeof (POINT)); GetCursorPos (&point); /* Current mouse cursor position */ RandaddBuf ((unsigned char *) &point, sizeof (POINT)); /* Get percent of memory in use, bytes of physical memory, bytes of free physical memory, bytes in paging file, free bytes in paging file, user bytes of address space, and free user bytes */ memoryStatus.dwLength = sizeof (MEMORYSTATUS); GlobalMemoryStatus (&memoryStatus); RandaddBuf ((unsigned char *) &memoryStatus, sizeof (MEMORYSTATUS)); /* Get thread and process creation time, exit time, time in kernel mode, and time in user mode in 100ns intervals */ handle = GetCurrentThread (); GetThreadTimes (handle, &creationTime, &exitTime, &kernelTime, &userTime); RandaddBuf ((unsigned char *) &creationTime, sizeof (FILETIME)); RandaddBuf ((unsigned char *) &exitTime, sizeof (FILETIME)); RandaddBuf ((unsigned char *) &kernelTime, sizeof (FILETIME)); RandaddBuf ((unsigned char *) &userTime, sizeof (FILETIME)); handle = GetCurrentProcess (); GetProcessTimes (handle, &creationTime, &exitTime, &kernelTime, &userTime); RandaddBuf ((unsigned char *) &creationTime, sizeof (FILETIME)); RandaddBuf ((unsigned char *) &exitTime, sizeof (FILETIME)); RandaddBuf ((unsigned char *) &kernelTime, sizeof (FILETIME)); RandaddBuf ((unsigned char *) &userTime, sizeof (FILETIME)); /* Get the minimum and maximum working set size for the current process */ GetProcessWorkingSetSize (handle, &minimumWorkingSetSize, &maximumWorkingSetSize); RandaddInt32 (minimumWorkingSetSize); RandaddInt32 (maximumWorkingSetSize); /* The following are fixed for the lifetime of the process so we only add them once */ if (addedFixedItems == 0) { STARTUPINFO startupInfo; /* Get name of desktop, console window title, new window position and size, window flags, and handles for stdin, stdout, and stderr */ startupInfo.cb = sizeof (STARTUPINFO); GetStartupInfo (&startupInfo); RandaddBuf ((unsigned char *) &startupInfo, sizeof (STARTUPINFO)); addedFixedItems = TRUE; } /* The docs say QPC can fail if appropriate hardware is not available. It works on 486 & Pentium boxes, but hasn't been tested for 386 or RISC boxes */ if (QueryPerformanceCounter (&performanceCount)) RandaddBuf ((unsigned char *) &performanceCount, sizeof (LARGE_INTEGER)); else { /* Millisecond accuracy at best... */ DWORD dwTicks = GetTickCount (); RandaddBuf ((unsigned char *) &dwTicks, sizeof (dwTicks)); }//.........这里部分代码省略.........
开发者ID:Rafiot,项目名称:GostCrypt-Win7,代码行数:101,
示例23: _glfwPlatformWindowFocusedint _glfwPlatformWindowFocused(_GLFWwindow* window){ return window->win32.handle == GetActiveWindow();}
开发者ID:netcrack,项目名称:glfw,代码行数:4,
示例24: errorMessage//Show just a message boxvoid errorMessage(std::string msg, std::string title){ MessageBox(GetActiveWindow(), msg.c_str(), title.c_str(), MB_OK);}
开发者ID:GameTechDev,项目名称:Intel-Texture-Works-Plugin,代码行数:5,
示例25: GetCharOutline//.........这里部分代码省略......... ZeroMemory(pMem->pvBuffer, BytesPerRow * Height); BytesPerRowRaw = ROUND_UP(GlyphMetrics.gmBlackBoxX, bitsof(DWORD)) / 8; pbBuffer = Buffer; pbOutline = (PBYTE)pMem->pvBuffer; pbOutline += (GlyphMetrics.gmBlackBoxY - 1) * BytesPerRow; pbOutline += ((Height - GlyphMetrics.gmBlackBoxY) / 2 - 1) * BytesPerRow; pbOutline += DwordOfLeftSpace * 4; Mask = _rotl(1, BitsOfLeftSpace) - 1; for (ULONG i = GlyphMetrics.gmBlackBoxY; i; --i) { PBYTE pbOutline2, pbBuffer2; DWORD BitsHigh, BitsLow; BitsHigh = 0; BitsLow = 0; pbBuffer2 = pbBuffer; pbOutline2 = pbOutline; for (ULONG Count = BytesPerRowRaw / 4; Count; --Count) { DWORD v = *(PDWORD)pbBuffer2; BitsHigh = _rotl(v, BitsOfLeftSpace) & Mask; v = (v << BitsOfLeftSpace) | BitsLow; BitsLow = BitsHigh; *(PDWORD)pbOutline2 = v; pbOutline2 += 4; pbBuffer2 += 4; }// *(PDWORD)pbOutline2 = BitsLow; pbOutline -= BytesPerRow; pbBuffer += BytesPerRowRaw; } WCHAR buf[0x500]; wsprintfW( buf - 1 + GetTextFaceW(hDC, countof(buf), buf), L" Char = %c Index = %02u Bits = %02X", uChar, FontIndex + 1, BitsOfLeftSpace); SetWindowTextW(GetActiveWindow(), buf);#else ULONG BytesPerRowRaw; static BYTE Bits[FONT_COUNT] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x16, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C }; BitsOfLeftSpace = Bits[FontIndex]; if (pBitsPerRow != NULL) *pBitsPerRow = GlyphMetrics.gmBlackBoxX + BitsOfLeftSpace; if (pThis == NULL) return TRUE; BytesPerRow = GlyphMetrics.gmBlackBoxX + BitsOfLeftSpace; BytesPerRow = ROUND_UP(BytesPerRow, bitsof(DWORD)) / 8; ChipSpriteEngAllocMemory(pMem, BytesPerRow * Height); if (pMem->pvBufferEnd == pMem->pvBuffer) goto DEFAULT_PROC; ZeroMemory(pMem->pvBuffer, BytesPerRow * Height); BytesPerRowRaw = ROUND_UP(GlyphMetrics.gmBlackBoxX, bitsof(DWORD)) / 8; pbBuffer = Buffer; pbOutline = (PBYTE)pMem->pvBuffer; pbOutline += (GlyphMetrics.gmBlackBoxY - 1) * BytesPerRow; pbOutline += ((Height - GlyphMetrics.gmBlackBoxY) / 2 - 1) * BytesPerRow; for (ULONG i = GlyphMetrics.gmBlackBoxY; i; --i) { __movsd(pbOutline, pbBuffer, BytesPerRowRaw / 4); pbOutline -= BytesPerRow; pbBuffer += BytesPerRowRaw; }#endif return TRUE;DEFAULT_PROC: if (pThis == NULL) return FALSE; return OldGetCharOutline(Unknown, 0, pThis, Height, uChar, pBitsPerRow, pDescent, pMem);}
开发者ID:AyanamiRei,项目名称:chinesize,代码行数:101,
示例26: generic_view_handlerLRESULT CALLBACK generic_view_handler( HWND win, UINT msg, WPARAM mp1, LPARAM mp2){ LRESULT ret = 0; Handle self = GetWindowLongPtr( win, GWLP_USERDATA); PWidget v = ( PWidget) self; UINT orgMsg = msg; Event ev; Bool hiStage = false; int i, orgCmd; Bool message_result = true; if ( !self || appDead) return DefWindowProcW( win, msg, mp1, mp2); memset( &ev, 0, sizeof (ev)); ev. gen. source = self; switch ( msg) { case WM_NCACTIVATE: // if activation or deactivation is concerned with declipped window ( e.g.self), // notify its top level frame so that it will have the chance to redraw itself correspondingly if ( is_declipped_child( self) && !Widget_is_child( hwnd_to_view(( HWND) mp2), hwnd_top_level( self))) { Handle x = hwnd_top_level( self); if ( x) SendMessage( DHANDLE( x), WM_NCACTIVATE, mp1, mp2); } break; case WM_MOUSEACTIVATE: // if pointing to non-active frame, but its declipped child is active at the moment, // cancel activation - it could produce unwilling focus changes if ( sys className == WC_FRAME) { Handle x = hwnd_to_view( GetActiveWindow()); if ( is_declipped_child(x) && Widget_is_child( x, self)) return MA_NOACTIVATE; } break; case WM_CLOSE: if ( sys className != WC_FRAME) return 0; break; case WM_COMMAND: if (( HIWORD( mp1) == 0 /* menu source */) && ( mp2 == 0)) { if ( LOWORD( mp1) <= MENU_ID_AUTOSTART) { HWND active = GetFocus(); if ( active != nil) SendMessage( active, LOWORD( mp1), 0, 0); } else if ( sys lastMenu) { PAbstractMenu a = ( PAbstractMenu) sys lastMenu; if ( a-> stage <= csNormal) a-> self-> sub_call_id(( Handle) a, LOWORD( mp1) - MENU_ID_AUTOSTART); } } break; case WM_CONTEXTMENU: { POINT a; a. x = ( short)LOWORD( mp2); a. y = ( short)HIWORD( mp2); ev. cmd = cmPopup; // mouse event ev. gen. B = ( GetKeyState( VK_LBUTTON) < 0) | ( GetKeyState( VK_RBUTTON) < 0); if ( !ev. gen. B && GetSystemMetrics( SM_MOUSEPRESENT)) GetCursorPos(( POINT*) &a); MapWindowPoints( NULL, win, &a, 1); ev. gen. P. x = a. x; ev. gen. P. y = sys lastSize. y - a. y - 1; } break; case WM_ENABLE: ev. cmd = mp1 ? cmEnable : cmDisable; hiStage = true; break; case WM_ERASEBKGND: return 1; case WM_FORCEFOCUS: if ( mp2) ((( PWidget) mp2)-> self)-> set_selected(( Handle) mp2, 1); return 0; case WM_HASMATE: *(( Handle*) mp2) = self; return HASMATE_MAGIC; case WM_IME_CHAR: if ( apc_widget_is_responsive( self)) { ev. cmd = cmKeyDown; ev. key. mod = kmUnicode; ev. key. key = kbNoKey; ev. key. code = mp1; } break; case WM_SYSKEYDOWN: case WM_SYSKEYUP: if ( mp2 & ( 1 << 29)) ev. key. mod = kmAlt; case WM_KEYDOWN: case WM_KEYUP: if ( apc_widget_is_responsive( self)) { BYTE * keyState; Bool up = ( msg == WM_KEYUP) || ( msg == WM_SYSKEYUP); Bool extended = mp2 & ( 1 << 24); UINT scan = ( HIWORD( mp2) & 0xFF) | ( up ? 0x80000000 : 0); int deadPollCount = 0; HKL kl = GetKeyboardLayout(0);//.........这里部分代码省略.........
开发者ID:Spchelkin,项目名称:Prima,代码行数:101,
示例27: OleInitializeint CMainFrameWork::InitSoUiFrame(){ HRESULT hRes = OleInitialize(NULL); SASSERT(SUCCEEDED(hRes)); int nRet = 0; SComMgr * pComMgr = new SComMgr; //将程序的运行路径修改到项目所在目录所在的目录 TCHAR szCurrentDir[MAX_PATH]={0}; GetModuleFileName( NULL, szCurrentDir, sizeof(szCurrentDir) ); LPTSTR lpInsertPos = _tcsrchr( szCurrentDir, _T('//') ); _tcscpy(lpInsertPos+1,_T("//..//TestProject")); SetCurrentDirectory(szCurrentDir); { CAutoRefPtr<SOUI::IImgDecoderFactory> pImgDecoderFactory; CAutoRefPtr<SOUI::IRenderFactory> pRenderFactory; pComMgr->CreateRender_GDI((IObjRef**)&pRenderFactory); pComMgr->CreateImgDecoder((IObjRef**)&pImgDecoderFactory); pRenderFactory->SetImgDecoderFactory(pImgDecoderFactory); SApplication *theApp=new SApplication(pRenderFactory,g_hInstance); CAutoRefPtr<IResProvider> pResProvider;#if (RES_TYPE == 0) CreateResProvider(RES_FILE,(IObjRef**)&pResProvider); if(!pResProvider->Init((LPARAM)_T("uires"),0)) { SASSERT(0); return 1; }#else CreateResProvider(RES_PE,(IObjRef**)&pResProvider); pResProvider->Init((WPARAM)hInstance,0);#endif theApp->AddResProvider(pResProvider); CAutoRefPtr<ITranslatorMgr> trans; pComMgr->CreateTranslator((IObjRef**)&trans); if(trans) { theApp->SetTranslator(trans); pugi::xml_document xmlLang; if(theApp->LoadXmlDocment(xmlLang,_T("lang_cn"),_T("translator"))) { CAutoRefPtr<ITranslator> langCN; trans->CreateTranslator(&langCN); langCN->Load(&xmlLang.child(L"language"),1);//1=LD_XML trans->InstallTranslator(langCN); } } theApp->RegisterWndFactory(TplSWindowFactory<SIPAddressCtrl>());//注册IP控件 //加载系统资源 HMODULE hSysResource=LoadLibrary(SYS_NAMED_RESOURCE); if(hSysResource) { CAutoRefPtr<IResProvider> sysSesProvider; CreateResProvider(RES_PE,(IObjRef**)&sysSesProvider); sysSesProvider->Init((WPARAM)hSysResource,0); theApp->LoadSystemNamedResource(sysSesProvider); } theApp->Init(_T("XML_INIT")); // BLOCK: Run application { CMainDlg dlgMain; dlgMain.Create(GetActiveWindow(),0,0,0,0); dlgMain.SendMessage(WM_INITDIALOG); dlgMain.CenterWindow(dlgMain.m_hWnd); dlgMain.ShowWindow(SW_SHOWNORMAL); nRet=theApp->Run(dlgMain.m_hWnd); } delete theApp; } delete pComMgr; OleUninitialize();}
开发者ID:hdwdsj,项目名称:SoUiTestProject,代码行数:85,
示例28: timeGetTimevoid CNewRandom::Initialize(){ ++g_dwNewRandomInstanceCounter; DWORD dw; dw = timeGetTime(); AddRandomObject(&dw, 4); LARGE_INTEGER li; QueryPerformanceCounter(&li); AddRandomObject(&li, sizeof(LARGE_INTEGER)); SYSTEMTIME st; ZeroMemory(&st, sizeof(SYSTEMTIME)); GetLocalTime(&st); AddRandomObject(&st, sizeof(SYSTEMTIME)); POINT pt; GetCursorPos(&pt); AddRandomObject(&pt, sizeof(POINT)); WORD ww; ww = (WORD)(rand()); AddRandomObject(&ww, 2); ww = (WORD)(rand()); AddRandomObject(&ww, 2); ww = (WORD)(rand()); AddRandomObject(&ww, 2); GetCaretPos(&pt); AddRandomObject(&pt, sizeof(POINT)); MEMORYSTATUS ms; GlobalMemoryStatus(&ms); AddRandomObject(&ms, sizeof(MEMORYSTATUS)); dw = (DWORD)(UINT_PTR)GetActiveWindow(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetCapture(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetClipboardOwner(); AddRandomObject(&dw, 4);#ifndef _WIN32_WCE // No support under Windows CE dw = (DWORD)(UINT_PTR)GetClipboardViewer(); AddRandomObject(&dw, 4);#endif dw = GetCurrentProcessId(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetCurrentProcess(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetActiveWindow(); AddRandomObject(&dw, 4); dw = GetCurrentThreadId(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetCurrentThread(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetDesktopWindow(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetFocus(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetForegroundWindow(); AddRandomObject(&dw, 4);#ifndef _WIN32_WCE dw = (DWORD)GetInputState(); AddRandomObject(&dw, 4); #endif dw = GetMessagePos(); AddRandomObject(&dw, 4);#ifndef _WIN32_WCE dw = (DWORD)GetMessageTime(); AddRandomObject(&dw, 4);#endif dw = (DWORD)(UINT_PTR)GetOpenClipboardWindow(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetProcessHeap(); AddRandomObject(&dw, 4); SYSTEM_INFO si; GetSystemInfo(&si); AddRandomObject(&si, sizeof(SYSTEM_INFO)); dw = (DWORD)randXorShift(); AddRandomObject(&dw, 4);//.........这里部分代码省略.........
开发者ID:joshuadugie,项目名称:KeePass-1.x,代码行数:101,
示例29: TagsPopUpVOID TagsPopUp(char *tags, char *msg){ HWND hwnd = GetActiveWindow(); EitherTagsPopUp(tags, msg, FALSE); SetActiveWindow(hwnd);}
开发者ID:arunpersaud,项目名称:xboard,代码行数:6,
注:本文中的GetActiveWindow函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetActivity函数代码示例 C++ GetActiveWeapon函数代码示例 |