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


C++ GetKeyName函数代码示例

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


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

示例1: GetAccelKeyName

CString GetAccelKeyName(DWORD dwShift, DWORD dwKeyCode)
{
	CString strText;

	if ((dwShift & 0x2) != 0)
	{
		strText += _T("Ctrl");
	}
	if ((dwShift & 0x4) != 0)
	{
		if (!strText.IsEmpty())
			strText += _T(" + ");
		strText += _T("Alt");
	}
	if ((dwShift & 0x1) != 0)
	{
		if (!strText.IsEmpty())
			strText += _T(" + ");
		strText += _T("Shift");
	}
	
	if (dwKeyCode != VK_CONTROL && dwKeyCode != VK_MENU && dwKeyCode != VK_SHIFT)
	{
		LPCTSTR pKeyName = GetKeyName(dwKeyCode);
		if (pKeyName != NULL)
		{
			if (!strText.IsEmpty())
				strText += _T(" + ");
			
			strText += GetKeyName(dwKeyCode);
		}
	}

	return strText;
}
开发者ID:JackWangCUMT,项目名称:SuperCxHMI,代码行数:35,代码来源:PopupFrame.cpp

示例2: MyListProc

LRESULT CALLBACK MyListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static TCHAR szText[1024];
	switch (msg)
	{
	case WM_CHAR:
		wsprintf(szText, TEXT("WM_CHAR %c"), (TCHAR)wParam);
		SendMessage(hList, LB_ADDSTRING, 0, (LONG_PTR)szText);
		break;
	case WM_KEYDOWN:
		wsprintf(szText, TEXT("WM_KEYDOWN %s"), GetKeyName(wParam));
		SendMessage(hList, LB_ADDSTRING, 0, (LONG_PTR)szText);
		break;
	case WM_KEYUP:
		wsprintf(szText, TEXT("WM_KEYUP %s"), GetKeyName(wParam));
		SendMessage(hList, LB_ADDSTRING, 0, (LONG_PTR)szText);
		break;
	case WM_SYSKEYDOWN:
		wsprintf(szText, TEXT("WM_SYSKEYDOWN %s"), GetKeyName(wParam));
		SendMessage(hList, LB_ADDSTRING, 0, (LONG_PTR)szText);
		break;
	case WM_SYSKEYUP:
		wsprintf(szText, TEXT("WM_SYSKEYUP %s"), GetKeyName(wParam));
		SendMessage(hList, LB_ADDSTRING, 0, (LONG_PTR)szText);
		break;
	default:
		break;
	}
	return CallWindowProc(DefaultListWndProc, hWnd, msg, wParam, lParam);
}
开发者ID:kenjinote,项目名称:KeyboardEvent,代码行数:30,代码来源:Source.cpp

示例3: hsRefCnt_SafeUnRef

void plObjectInVolumeDetector::ITrigger(plKey hitter, bool entering, bool immediate)
{
    hsRefCnt_SafeUnRef(fSavedActivatorMsg);
    fSavedActivatorMsg = new plActivatorMsg;
    fSavedActivatorMsg->AddReceivers(fReceivers);

    if (fProxyKey)
        fSavedActivatorMsg->fHiteeObj = fProxyKey;
    else
        fSavedActivatorMsg->fHiteeObj = GetTarget()->GetKey();

    fSavedActivatorMsg->fHitterObj = hitter;
    fSavedActivatorMsg->SetSender(GetKey());

    if (entering)
    {
        DetectorLog("%s: Saving Entering volume - Evals=%d", GetKeyName().c_str(), fNumEvals);
        fSavedActivatorMsg->SetTriggerType(plActivatorMsg::kVolumeEnter);
        fLastEnterEval = fNumEvals;
    }
    else
    {
        DetectorLog("%s: Saving Exiting volume - Evals=%d", GetKeyName().c_str(), fNumEvals);
        fSavedActivatorMsg->SetTriggerType(plActivatorMsg::kVolumeExit);
        fLastExitEval = fNumEvals;
    }

    if (immediate)
        ISendSavedTriggerMsgs();
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:30,代码来源:plCollisionDetector.cpp

示例4: OpenSubkey

LONG CRegistryKey::OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, CRegistryKey &rKey)
{
  HKEY hKey;
  LONG nError = OpenSubkey(samDesired, pszSubkeyName, hKey);

  if (nError == ERROR_SUCCESS)
  {
    const TCHAR *pszKeyName = GetKeyName();
    size_t size = _tcslen(pszKeyName) + _tcslen(pszSubkeyName) + 1;
    TCHAR *pszSubkeyFullName = new (std::nothrow) TCHAR [size];
    if (!pszSubkeyFullName)
    {
      nError = RegCloseKey(hKey);
      ASSERT(nError == ERROR_SUCCESS);
      return ERROR_OUTOFMEMORY;
    }
    _tcscpy(pszSubkeyFullName,pszKeyName);
    _tcscat(pszSubkeyFullName,pszSubkeyName);
    HRESULT hr = rKey.Init(hKey,GetKeyName(),pszSubkeyName,samDesired);
    delete[] pszSubkeyName;
    if (FAILED(hr))
    {
      nError = RegCloseKey(hKey);
      ASSERT(nError == ERROR_SUCCESS);
      if (hr == (HRESULT)E_OUTOFMEMORY)
        return ERROR_OUTOFMEMORY;
      else
        return ERROR_INTERNAL_ERROR;
    }
  }

  return nError;
}
开发者ID:GYGit,项目名称:reactos,代码行数:33,代码来源:RegistryKey.cpp

示例5: DetectorLogRed

void plCameraRegionDetector::ITrigger(plKey hitter, bool entering, bool immediate)
{
    if (fSavingSendMsg)
        DetectorLogRed("%s: Stale messages on ITrigger. This should never happen!", GetKeyName().c_str());
    if (fIsInside && entering)
        DetectorLogRed("%s: Duplicate enter! Did we miss an exit?", GetKeyName().c_str());
    else if (!fIsInside && !entering)
        DetectorLogRed("%s: Duplicate exit! Did we miss an enter?", GetKeyName().c_str());

    fSavingSendMsg = true;
    fSavedMsgEnterFlag = entering;
    if (entering)
    {
        DetectorLog("%s: Saving camera Entering volume - Evals=%d", GetKeyName().c_str(),fNumEvals);
        fLastEnterEval = fNumEvals;
    }
    else
    {
        DetectorLog("%s: Saving camera Exiting volume - Evals=%d", GetKeyName().c_str(),fNumEvals);
        fLastExitEval = fNumEvals;
    }

    if (immediate)
        ISendSavedTriggerMsgs();
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:25,代码来源:plCollisionDetector.cpp

示例6: OnInitDlg

void OnInitDlg(HWND hDlg)
{
	LoadSettings();
	UpdateData(DIRECTION, BUTTON, SPEED);
	SetNumTimeReplay(REPLAYTIME);
	Button_SetCheck(GetDlgItem(hDlg, IDC_AUTORUN), AUTORUN);

	OldEditProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITRIGHT), GWLP_WNDPROC);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITRIGHT), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITLEFT), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITUP), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITDOWN), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITLBUTTON), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITRBUTTON), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITMBUTTON), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITWUP), GWLP_WNDPROC, (LONG_PTR)NewEditProc);
	SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDITWDOWN), GWLP_WNDPROC, (LONG_PTR)NewEditProc);

	TCHAR buffer[100];
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITDOWN), GetKeyName(DIRECTION[DOWN], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITUP), GetKeyName(DIRECTION[UP], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITLEFT), GetKeyName(DIRECTION[LEFT], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITRIGHT), GetKeyName(DIRECTION[RIGHT], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITLBUTTON), GetKeyName(BUTTON[LBUTTON], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITRBUTTON), GetKeyName(BUTTON[RBUTTON], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITMBUTTON), GetKeyName(BUTTON[MBUTTON], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITWUP), GetKeyName(BUTTON[WHEELUP], buffer));
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITWDOWN), GetKeyName(BUTTON[WHEELDOWN], buffer));

	_itow(SPEED, buffer, 10);
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITSPEED), buffer);
	_itow(REPLAYTIME, buffer, 10);
	Edit_SetText(GetDlgItem(hDlg, IDC_EDITREPLAY), buffer);
}
开发者ID:trunghai95,项目名称:Group6_G.3_LTWin,代码行数:34,代码来源:MainApp.cpp

示例7: DetectorLog

void plObjectInVolumeDetector::ISendSavedTriggerMsgs()
{
    if (fSavedActivatorMsg)
    {
        if (fSavedActivatorMsg->fTriggerType == plActivatorMsg::kVolumeEnter)
            DetectorLog("%s: Sending Entering volume - Evals=%d", GetKeyName().c_str(), fNumEvals);
        else
            DetectorLog("%s: Sending Exiting volume - Evals=%d", GetKeyName().c_str(), fNumEvals);

        // we're saving the message to be dispatched later...
        plgDispatch::MsgSend(fSavedActivatorMsg);
    }
    fSavedActivatorMsg = nil;
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:14,代码来源:plCollisionDetector.cpp

示例8: GetKeyName

void CPreferencesKeyboard::OnSelchangeKeydlgCmdlist() 
{
	m_Combo.ResetContent();
	m_Remove.EnableWindow(false);
	m_Edit.SetWindowText("");

	int Sel = m_List.GetCurSel();

	if (Sel == LB_ERR)
		return;

	LC_KEYBOARD_COMMAND& Cmd = KeyboardShortcuts[m_List.GetItemData(Sel)];

	// Update the combo box with the shortcuts for the current selection.
	if (Cmd.Key1)
	{
		CString str;

		if (Cmd.Flags & LC_KEYMOD1_SHIFT)
			str = "Shift+";

		if (Cmd.Flags & LC_KEYMOD1_CONTROL)
			str += "Ctrl+";

		str += GetKeyName(Cmd.Key1);

		m_Combo.AddString(str);
		m_Combo.SetCurSel(0);
		m_Remove.EnableWindow(true);

		if (Cmd.Key2)
		{
			str = "";

			if (Cmd.Flags & LC_KEYMOD2_SHIFT)
				str = "Shift+";

			if (Cmd.Flags & LC_KEYMOD2_CONTROL)
				str += "Ctrl+";

			str += GetKeyName(Cmd.Key2);

			m_Combo.AddString(str);
		}
	}

	m_Edit.EnableWindow(Cmd.Key2 == 0);
	m_Assign.EnableWindow((Cmd.Key2 == 0) && m_Edit.m_Key);
}
开发者ID:ldraw-linux,项目名称:leocad,代码行数:49,代码来源:Prefpage.cpp

示例9: plProfile_Inc

// Called after the simulation has run....sends new positions to the various scene objects
// *** want to do this in response to an update message....
void plPXPhysical::SendNewLocation(bool synchTransform, bool isSynchUpdate)
{
    // we only send if:
    // - the body is active or forceUpdate is on
    // - the mass is non-zero
    // - the physical is not passive
    bool bodyActive = !fActor->isSleeping();
    bool dynamic = fActor->isDynamic();
    
    if ((bodyActive || isSynchUpdate) && dynamic)// && fInitialTransform)
    {
        plProfile_Inc(MaySendLocation);

        if (!GetProperty(plSimulationInterface::kPassive))
        {
            hsMatrix44 curl2w = fCachedLocal2World;
            // we're going to cache the transform before sending so we can recognize if it comes back
            IGetTransformGlobal(fCachedLocal2World);

            if (!CompareMatrices(curl2w, fCachedLocal2World, .0001f))
            {
                plProfile_Inc(LocationsSent);
                plProfile_BeginLap(PhysicsUpdates, GetKeyName().c_str());

                // quick peek at the translation...last time it was corrupted because we applied a non-unit quaternion
//              hsAssert(real_finite(fCachedLocal2World.fMap[0][3]) &&
//                       real_finite(fCachedLocal2World.fMap[1][3]) &&
//                       real_finite(fCachedLocal2World.fMap[2][3]), "Bad transform outgoing");

                if (fCachedLocal2World.GetTranslate().fZ < kMaxNegativeZPos)
                {
                    SimLog("Physical %s fell to %.1f (%.1f is the max).  Suppressing.", GetKeyName().c_str(), fCachedLocal2World.GetTranslate().fZ, kMaxNegativeZPos);
                    // Since this has probably been falling for a while, and thus not getting any syncs,
                    // make sure to save it's current pos so we'll know to reset it later
                    DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients);
                    IEnable(false);
                }

                hsMatrix44 w2l;
                fCachedLocal2World.GetInverse(&w2l);
                plCorrectionMsg *pCorrMsg = new plCorrectionMsg(GetObjectKey(), fCachedLocal2World, w2l, synchTransform);
                pCorrMsg->Send();
                if (fProxyGen)
                    fProxyGen->SetTransform(fCachedLocal2World, w2l);
                plProfile_EndLap(PhysicsUpdates, GetKeyName().c_str());
            }
        }
    }
}
开发者ID:branan,项目名称:Plasma-nobink,代码行数:51,代码来源:plPXPhysical.cpp

示例10: switch

const char*
ShortcutsSpec::GetCellText(int whichColumn) const
{
	const char* temp = ""; // default
	switch(whichColumn) {
		case KEY_COLUMN_INDEX:
		{
			if ((fKey > 0) && (fKey <= 0xFF)) {
				temp = GetKeyName(fKey);
				if (temp == NULL)
					temp = "";
			} else if (fKey > 0xFF) {
				sprintf(fScratch, "#%lx", fKey);
				return fScratch;
			}
			break;
		}

		case STRING_COLUMN_INDEX:
			temp = fCommand;
			break;

		default:
			if ((whichColumn >= 0) && (whichColumn < NUM_META_COLUMNS))
				temp = sMetaMaps[whichColumn].GetNthStateDesc(
							fMetaCellStateIndex[whichColumn]);
			break;
	}
	return temp;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:30,代码来源:ShortcutsSpec.cpp

示例11: GetKeyName

void plResponderModifier::Trigger(plNotifyMsg *msg)
{
#if 0
    plNetClientApp::GetInstance()->DebugMsg("RM: Responder {} is triggering, num cmds={}, enabled={}, curCmd={}, t={f}\n",
        GetKeyName(), fStates[fCurState].fCmds.GetCount(),
        fEnabled, fCurCommand, hsTimer::GetSysSeconds());
#endif

    // If we're not in the middle of sending, reset and start sending commands
    if (fCurCommand == int8_t(-1) && fEnabled)
    {
        ResponderLog(ILog(plStatusLog::kGreen, "Trigger"));

        fNotifyMsgFlags = msg->GetAllBCastFlags();
        fTriggerer = msg->GetSender();
        fPlayerKey = msg->GetAvatarKey();

        ISetResponderStateFromNotify(msg);

        proCollisionEventData *cEvent = (proCollisionEventData *)msg->FindEventRecord(proEventData::kCollision);
        fEnter = (cEvent ? cEvent->fEnter : false);

        fCompletedEvents.Reset();
        fCurCommand = 0;

        DirtySynchState(kSDLResponder, 0);

        IContinueSending();
    }
    else
    {
        ResponderLog(ILog(plStatusLog::kRed, "Rejected Trigger, %s", !fEnabled ? "responder disabled" : "responder is running"));
    }
}
开发者ID:H-uru,项目名称:Plasma,代码行数:34,代码来源:plResponderModifier.cpp

示例12: CopyKeyName

BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCWSTR keyName)
{
    BOOL bClipboardOpened = FALSE;
    BOOL bSuccess = FALSE;
    WCHAR szBuffer[512];
    HGLOBAL hGlobal;
    LPWSTR s;

    if (!OpenClipboard(hWnd))
        goto done;
    bClipboardOpened = TRUE;

    if (!EmptyClipboard())
        goto done;

    if (!GetKeyName(szBuffer, COUNT_OF(szBuffer), hRootKey, keyName))
        goto done;

    hGlobal = GlobalAlloc(GMEM_MOVEABLE, (wcslen(szBuffer) + 1) * sizeof(WCHAR));
    if (!hGlobal)
        goto done;

    s = GlobalLock(hGlobal);
    wcscpy(s, szBuffer);
    GlobalUnlock(hGlobal);

    SetClipboardData(CF_UNICODETEXT, hGlobal);
    bSuccess = TRUE;

done:
    if (bClipboardOpened)
        CloseClipboard();
    return bSuccess;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:34,代码来源:framewnd.c

示例13: plProfile_BeginTiming

void plWin32StreamingSound::IStreamUpdate()
{
    if(!fReallyPlaying)
        return;

    if(hsTimer::GetMilliSeconds() - fLastStreamingUpdate < STREAMING_UPDATE_MS) // filter out update requests so we aren't doing this more that we need to 
        return;

    plProfile_BeginTiming( StreamSndShoveTime );
    if(fDSoundBuffer)
    {
        if(fDSoundBuffer->BuffersQueued() == 0 && fDataStream->NumBytesLeft() == 0 && !fDSoundBuffer->IsLooping())
        {
            // If we are fading out it's possible that we will hit this multiple times causing this sound to try and fade out multiple times, never allowing it to actually stop
            if(!fStopping)
            {
                fStopping = true;
                Stop();
                plProfile_EndTiming( StreamSndShoveTime );
            }
            return;
        }

        if(!fDSoundBuffer->StreamingFillBuffer(fDataStream))
        {
            plStatusLog::AddLineS("audio.log", "%s Streaming buffer fill failed", GetKeyName().c_str());
        }
    }
    plProfile_EndTiming( StreamSndShoveTime );
}
开发者ID:Asteral,项目名称:Plasma,代码行数:30,代码来源:plWin32StreamingSound.cpp

示例14: path

bool wxIniConfig::Read(const wxString& szKey, wxString *pstr,
                       const wxString& szDefault) const
{
    wxConfigPathChanger path(this, szKey);
    wxString strKey = GetPrivateKeyName(path.Name());

    wxChar szBuf[1024]; // @@ should dynamically allocate memory...

    // first look in the private INI file

    // NB: the lpDefault param to GetPrivateProfileString can't be NULL
    // GetPrivateProfileString(m_strGroup, strKey, "",
    //                         szBuf, WXSIZEOF(szBuf), m_strLocalFilename);
    if ( ::wxIsEmpty((PSZ)szBuf) )
    {
      // now look in win.ini
      wxString strKey = GetKeyName(path.Name());
      // GetProfileString(m_strGroup, strKey, "", szBuf, WXSIZEOF(szBuf));
    }

    if ( ::wxIsEmpty((PSZ)szBuf) )
    {
        *pstr = szDefault;
        return false;
    }
    else
    {
        *pstr = szBuf ;
        return true;
    }
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:31,代码来源:iniconf.cpp

示例15: EndDialog

BOOL CKeyBoardSet::OnInitDialog()
{
	CTopAceDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	if( !m_cfg.LoadCfg() )
	{
		EndDialog( IDCANCEL );
		return FALSE;
	}

	m_cList.SetExtendedStyle( m_cList.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );

	m_cList.InsertColumn( 0 , L"功能" , LVCFMT_LEFT , 100 );
	m_cList.InsertColumn( 1 , L"按键" , LVCFMT_LEFT , 100 );
	m_cList.SetRedraw( FALSE );

	for( int i = 0 ; i < E_GO_MAX ; ++i )
	{
		if( i != m_cList.InsertItem( i , m_cfg.GetItemName( EGameOperate(i) ) ) )
		{
			EndDialog( IDCANCEL );
			return FALSE;
		}

		m_cList.SetItemData( i , (DWORD_PTR)EGameOperate(i) );
		m_cList.SetItemText( i , 1 , GetKeyName(m_cfg.GetItemMapKey( EGameOperate(i) )) );
	}

	m_cList.SetRedraw( TRUE );

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
开发者ID:SHIYUENING,项目名称:topace,代码行数:34,代码来源:KeyBoardSet.cpp


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