当前位置: 首页>>代码示例>>C++>>正文


C++ GetActiveWindow函数代码示例

本文整理汇总了C++中GetActiveWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActiveWindow函数的具体用法?C++ GetActiveWindow怎么用?C++ GetActiveWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetActiveWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Win32_GetActiveWindow

static int
Win32_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,代码来源:jim-win32.c

示例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,代码来源:scrawl.cpp

示例3: isWindowActive

//! returns if window is active. if not, nothing need to be drawn
bool CIrrDeviceWinCE::isWindowActive() const
{
	bool ret = (GetActiveWindow() == HWnd);
	_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
	return ret;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:7,代码来源:CIrrDeviceWinCE.cpp

示例4: Open

void TopWindow::Open()
{
	GuiLock __; 
	Open(GetActiveWindow());
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:5,代码来源:X11Top.cpp

示例5: WizardDlgProc

static 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,代码来源:WIZARD.C

示例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,代码来源:focus.c

示例7: SplitFilename

int 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,代码来源:smdlexp.cpp

示例8: _gcry_rndw32_gather_random_fast

void
_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,代码来源:rndw32.c

示例9: GUI_Listener

DWORD   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,代码来源:DBClient_GUI.c

示例10: PluginMain

DLLExport 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,代码来源:DDTPlugin.cpp

示例11: Test_SendInput

void 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,代码来源:AttachThreadInput.c

示例12: RecycleBin_DeleteItems

static 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,代码来源:recyclebin.c

示例13: _tWinMain

int 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,代码来源:SouiWizard1.cpp

示例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,代码来源:msgwindow.c

示例15: USBabout

void CALLBACK USBabout() {
    DialogBox(hInst,
              MAKEINTRESOURCE(IDD_ABOUT),
              GetActiveWindow(),
              (DLGPROC)AboutDlgProc);
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:6,代码来源:Win32.cpp


注:本文中的GetActiveWindow函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。