本文整理汇总了C++中GetMessageTime函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMessageTime函数的具体用法?C++ GetMessageTime怎么用?C++ GetMessageTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMessageTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWnd
// Left button
void CMouse::InternalOnLButtonDown(UINT nFlags, const CPoint& point)
{
GetWnd().SetFocus();
m_bLeftDown = false;
SetCursor(nFlags, point);
if (MVRDown(nFlags, point)) {
return;
}
bool bIsOnFS = IsOnFullscreenWindow();
if ((!m_bD3DFS || !bIsOnFS) && (abs(GetMessageTime() - m_popupMenuUninitTime) < 2)) {
return;
}
if (m_pMainFrame->GetLoadState() == MLS::LOADED && m_pMainFrame->GetPlaybackMode() == PM_DVD &&
(m_pMainFrame->IsD3DFullScreenMode() ^ m_bD3DFS) == 0 &&
(m_pMainFrame->m_pDVDC->ActivateAtPosition(GetVideoPoint(point)) == S_OK)) {
return;
}
if (m_bD3DFS && bIsOnFS && m_pMainFrame->m_OSD.OnLButtonDown(nFlags, point)) {
return;
}
m_bLeftDown = true;
bool bDouble = false;
if (m_bLeftDoubleStarted &&
GetMessageTime() - m_leftDoubleStartTime < (int)GetDoubleClickTime() &&
CMouse::PointEqualsImprecise(m_leftDoubleStartPoint, point)) {
m_bLeftDoubleStarted = false;
bDouble = true;
} else {
m_bLeftDoubleStarted = true;
m_leftDoubleStartTime = GetMessageTime();
m_leftDoubleStartPoint = point;
}
auto onButton = [&]() {
GetWnd().SetCapture();
bool ret = false;
if (bIsOnFS || !m_pMainFrame->IsCaptionHidden()) {
ret = OnButton(wmcmd::LDOWN, point, bIsOnFS);
}
if (bDouble) {
ret = OnButton(wmcmd::LDBLCLK, point, bIsOnFS) || ret;
}
if (!ret) {
ReleaseCapture();
}
return ret;
};
m_drag = (!onButton() && !bIsOnFS) ? Drag::BEGIN_DRAG : Drag::NO_DRAG;
if (m_drag == Drag::BEGIN_DRAG) {
GetWnd().SetCapture();
m_beginDragPoint = point;
GetWnd().ClientToScreen(&m_beginDragPoint);
}
}
示例2: process_button_released
static void process_button_released(MSLLHOOKSTRUCT *mshook, uint16_t button) {
// Populate mouse released event.
event.time = GetMessageTime();
event.reserved = 0x00;
event.type = EVENT_MOUSE_RELEASED;
event.mask = get_modifiers();
event.data.mouse.button = button;
event.data.mouse.clicks = click_count;
event.data.mouse.x = mshook->pt.x;
event.data.mouse.y = mshook->pt.y;
logger(LOG_LEVEL_INFO, "%s [%u]: Button %u released %u time(s). (%u, %u)\n",
__FUNCTION__, __LINE__, event.data.mouse.button,
event.data.mouse.clicks,
event.data.mouse.x, event.data.mouse.y);
// Fire mouse released event.
dispatch_event(&event);
// If the pressed event was not consumed...
if (event.reserved ^ 0x01 && last_click.x == mshook->pt.x && last_click.y == mshook->pt.y) {
// Populate mouse clicked event.
event.time = GetMessageTime();
event.reserved = 0x00;
event.type = EVENT_MOUSE_CLICKED;
event.mask = get_modifiers();
event.data.mouse.button = button;
event.data.mouse.clicks = click_count;
event.data.mouse.x = mshook->pt.x;
event.data.mouse.y = mshook->pt.y;
logger(LOG_LEVEL_INFO, "%s [%u]: Button %u clicked %u time(s). (%u, %u)\n",
__FUNCTION__, __LINE__, event.data.mouse.button, event.data.mouse.clicks,
event.data.mouse.x, event.data.mouse.y);
// Fire mouse clicked event.
dispatch_event(&event);
}
// Reset the number of clicks.
if (button == click_button && (long int) (event.time - click_time) > hook_get_multi_click_time()) {
// Reset the click count.
click_count = 0;
}
}
示例3: VERIFY
void CMouse::EventCallback(MpcEvent ev)
{
CPoint screenPoint;
VERIFY(GetCursorPos(&screenPoint));
switch (ev) {
case MpcEvent::SWITCHED_TO_FULLSCREEN:
case MpcEvent::SWITCHED_TO_FULLSCREEN_D3D:
m_switchingToFullscreen.first = false;
break;
case MpcEvent::SWITCHING_TO_FULLSCREEN:
case MpcEvent::SWITCHING_TO_FULLSCREEN_D3D:
m_switchingToFullscreen = std::make_pair(true, screenPoint);
// no break
case MpcEvent::MEDIA_LOADED:
if (CursorOnWindow(screenPoint, GetWnd())) {
SetCursor(screenPoint);
}
break;
case MpcEvent::CONTEXT_MENU_POPUP_UNINITIALIZED:
m_popupMenuUninitTime = GetMessageTime();
break;
case MpcEvent::SYSTEM_MENU_POPUP_INITIALIZED:
if (!GetCapture() && CursorOnWindow(screenPoint, GetWnd())) {
::SetCursor(m_cursors[Cursor::ARROW]);
}
break;
default:
ASSERT(FALSE);
}
}
示例4: win_mouse_click
void
win_mouse_click(mouse_button b, LPARAM lp)
{
static mouse_button last_button;
static uint last_time, count;
static pos last_click_pos;
win_show_mouse();
if (tab_bar_click(lp)) return;
mod_keys mods = get_mods();
pos p = get_mouse_pos(lp);
uint t = GetMessageTime();
if (b != last_button ||
p.x != last_click_pos.x || p.y != last_click_pos.y ||
t - last_time > GetDoubleClickTime() || ++count > 3)
count = 1;
term_mouse_click(win_active_terminal(), b, mods, p, count);
last_pos = (pos){INT_MIN, INT_MIN};
last_click_pos = p;
last_time = t;
last_button = b;
if (alt_state > ALT_NONE)
alt_state = ALT_CANCELLED;
}
示例5: win_mouse_click
void
win_mouse_click(mouse_button b, LPARAM lp)
{
static mouse_button last_button;
static uint last_time, count;
static pos last_click_pos;
win_show_mouse();
mod_keys mods = get_mods();
pos p = get_mouse_pos(lp);
uint t = GetMessageTime();
if (b != last_button ||
p.x != last_click_pos.x || p.y != last_click_pos.y ||
t - last_time > GetDoubleClickTime() || ++count > 3)
count = 1;
SetFocus(wnd); // in case focus was in search bar
term_mouse_click(b, mods, p, count);
last_pos = (pos){INT_MIN, INT_MIN};
last_click_pos = p;
last_time = t;
last_button = b;
if (alt_state > ALT_NONE)
alt_state = ALT_CANCELLED;
}
示例6: GetMessageTime
bool WinAltGrMonitor::isCurrentEventDefinitelyFake(unsigned iDownScanCode,
bool fKeyDown,
bool fExtendedKey) const
{
MSG peekMsg;
LONG messageTime = GetMessageTime();
if ( iDownScanCode != 0x1d /* scan code: Control */ || fExtendedKey)
return false;
if (!PeekMessage(&peekMsg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE))
return false;
if (messageTime != peekMsg.time)
return false;
if ( fKeyDown
&& (peekMsg.message != WM_KEYDOWN && peekMsg.message != WM_SYSKEYDOWN))
return false;
if ( !fKeyDown
&& (peekMsg.message != WM_KEYUP && peekMsg.message != WM_SYSKEYUP))
return false;
if ( ((RT_HIWORD(peekMsg.lParam) & 0xFF) != 0x38 /* scan code: Alt */)
|| !(RT_HIWORD(peekMsg.lParam) & KF_EXTENDED))
return false;
if (!doesCurrentLayoutHaveAltGr())
return false;
return true;
}
示例7: BytesRandomD
double BytesRandomD()
{
BYTE Buffer[0x464];
SHA_CTX Context;
int idx;
idx = 0;
memcpy(Buffer, RandomSeed, SHA_DIGEST_LENGTH);
idx += sizeof(RandomSeed);
GlobalMemoryStatus((LPMEMORYSTATUS)&Buffer[idx]);
idx += sizeof(MEMORYSTATUS);
UuidCreate((UUID *)&Buffer[idx]);
idx += sizeof(UUID);
GetCursorPos((LPPOINT)&Buffer[idx]);
idx += sizeof(POINT);
*(DWORD *)(Buffer + idx) = GetTickCount();
*(DWORD *)(Buffer + idx + 4) = GetMessageTime();
*(DWORD *)(Buffer + idx + 8) = GetCurrentThreadId();
*(DWORD *)(Buffer + idx + 12) = GetCurrentProcessId();
idx += 16;
QueryPerformanceCounter((LARGE_INTEGER *)&Buffer[idx]);
SHA1_Init(&Context);
SHA1_Update(&Context, Buffer, 0x464);
SHA1_Update(&Context, "additional salt...", 0x13);
SHA1_Final(RandomSeed, &Context);
return BytesSHA1d(Buffer, 0x464);
}
示例8: GetMessageTime
WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam)
{
WebKeyboardEvent result;
// TODO(pkasting): http://b/1117926 Are we guaranteed that the message that
// GetMessageTime() refers to is the same one that we're passed in? Perhaps
// one of the construction parameters should be the time passed by the
// caller, who would know for sure.
result.timeStampSeconds = GetMessageTime() / 1000.0;
result.windowsKeyCode = result.nativeKeyCode = static_cast<int>(wparam);
switch (message) {
case WM_SYSKEYDOWN:
result.isSystemKey = true;
case WM_KEYDOWN:
result.type = WebInputEvent::RawKeyDown;
break;
case WM_SYSKEYUP:
result.isSystemKey = true;
case WM_KEYUP:
result.type = WebInputEvent::KeyUp;
break;
case WM_IME_CHAR:
result.type = WebInputEvent::Char;
break;
case WM_SYSCHAR:
result.isSystemKey = true;
result.type = WebInputEvent::Char;
case WM_CHAR:
result.type = WebInputEvent::Char;
break;
default:
ASSERT_NOT_REACHED();
}
if (result.type == WebInputEvent::Char || result.type == WebInputEvent::RawKeyDown) {
result.text[0] = result.windowsKeyCode;
result.unmodifiedText[0] = result.windowsKeyCode;
}
if (result.type != WebInputEvent::Char)
result.setKeyIdentifierFromWindowsKeyCode();
if (GetKeyState(VK_SHIFT) & 0x8000)
result.modifiers |= WebInputEvent::ShiftKey;
if (GetKeyState(VK_CONTROL) & 0x8000)
result.modifiers |= WebInputEvent::ControlKey;
if (GetKeyState(VK_MENU) & 0x8000)
result.modifiers |= WebInputEvent::AltKey;
// NOTE: There doesn't seem to be a way to query the mouse button state in
// this case.
if (LOWORD(lparam) > 1)
result.modifiers |= WebInputEvent::IsAutoRepeat;
if (isKeyPad(wparam, lparam))
result.modifiers |= WebInputEvent::IsKeyPad;
return result;
}
示例9: MDIWndProc
/*
MDIWndProc
*/
LRESULT CALLBACK MDIWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HANDLE hInfo;
PINFO pInfo;
MSG msg;
EventRecord macEvent;
LONG thePoints = GetMessagePos();
PAINTSTRUCT ps;
msg.hwnd = hwnd;
msg.message = message;
msg.wParam = wParam;
msg.lParam = lParam;
msg.time = GetMessageTime();
msg.pt.x = LOWORD(thePoints);
msg.pt.y = HIWORD(thePoints);
WinEventToMacEvent(&msg, &macEvent);
switch (message)
{
case WM_CREATE:
case WM_MDICREATE:
break;
case WM_DESTROY:
hInfo = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
if (hInfo)
{
if ((pInfo = (PINFO)LocalLock(hInfo)) != NULL){
if (pInfo->gi)
// close the graphic import component
CloseComponent(pInfo->gi);
// Destroy our port association
DestroyPortAssociation((CGrafPort *)GetHWNDPort(pInfo->hwndChildWindow));
}
LocalUnlock(hInfo);
}
break;
// Draw our graphic
case WM_PAINT:
BeginPaint(hwnd, &ps);
hInfo = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
if (hInfo)
{
if ((pInfo = (PINFO)LocalLock(hInfo)) != NULL)
GraphicsImportDraw(pInfo->gi);
LocalUnlock(hInfo);
}
EndPaint(hwnd, &ps);
break;
default:
return DefMDIChildProc(hwnd, message, wParam, lParam);
}
return DefMDIChildProc(hwnd, message, wParam, lParam);
}
示例10: GetMessageTime
void MsgBubbleItem::SetShowTime(bool show)
{
if(show)
{
std::wstring tm = GetMessageTime(msg_.timetag_, false);
msg_time_->SetText(tm);
}
msg_time_->SetVisible(show);
}
示例11: translate_pos
static pos
translate_pos(int x, int y)
{
return (pos){
.x = floorf((x - PADDING) / (float)font_width ),
.y = floorf((y - PADDING) / (float)font_height),
};
}
static pos
get_mouse_pos(LPARAM lp)
{
return translate_pos(GET_X_LPARAM(lp), GET_Y_LPARAM(lp));
}
static mouse_button clicked_button;
static pos last_pos;
void
win_mouse_click(mouse_button b, LPARAM lp)
{
static mouse_button last_button;
static uint last_time, count;
static pos last_click_pos;
win_show_mouse();
mod_keys mods = get_mods();
pos p = get_mouse_pos(lp);
if (clicked_button) {
term_mouse_release(b, mods, p);
clicked_button = 0;
}
uint t = GetMessageTime();
if (b != last_button ||
p.x != last_click_pos.x || p.y != last_click_pos.y ||
t - last_time > GetDoubleClickTime() || ++count > 3)
count = 1;
term_mouse_click(b, mods, p, count);
last_pos = last_click_pos = p;
last_time = t;
clicked_button = last_button = b;
if (alt_state > ALT_NONE)
alt_state = ALT_CANCELLED;
}
void
win_mouse_release(mouse_button b, LPARAM lp)
{
win_show_mouse();
if (b == clicked_button) {
term_mouse_release(b, get_mods(), get_mouse_pos(lp));
clicked_button = 0;
ReleaseCapture();
}
}
示例12: fastPoll
void fastPoll( void )
{
RANDOM_STATE randomState;
BYTE buffer[ RANDOM_BUFSIZE ];
SYSHEAPINFO sysHeapInfo;
MEMMANINFO memManInfo;
TIMERINFO timerInfo;
POINT point;
initRandomData( randomState, buffer, RANDOM_BUFSIZE );
/* Get various basic pieces of system information: Handle of the window
with mouse capture, handle of window with input focus, amount of
space in global heap, whether system queue has any events, cursor
position for last message, 55 ms time for last message, number of
active tasks, 55 ms time since Windows started, current mouse cursor
position, current caret position */
addRandomValue( randomState, GetCapture() );
addRandomValue( randomState, GetFocus() );
addRandomValue( randomState, GetFreeSpace( 0 ) );
addRandomValue( randomState, GetInputState() );
addRandomValue( randomState, GetMessagePos() );
addRandomValue( randomState, GetMessageTime() );
addRandomValue( randomState, GetNumTasks() );
addRandomValue( randomState, GetTickCount() );
GetCursorPos( &point );
addRandomData( randomState, &point, sizeof( POINT ) );
GetCaretPos( &point );
addRandomData( randomState, &point, sizeof( POINT ) );
/* Get the largest free memory block, number of lockable pages, number of
unlocked pages, number of free and used pages, and number of swapped
pages */
memManInfo.dwSize = sizeof( MEMMANINFO );
MemManInfo( &memManInfo );
addRandomData( randomState, &memManInfo, sizeof( MEMMANINFO ) );
/* Get the execution times of the current task and VM to approximately
1ms resolution */
timerInfo.dwSize = sizeof( TIMERINFO );
TimerCount( &timerInfo );
addRandomData( randomState, &timerInfo, sizeof( TIMERINFO ) );
/* Get the percentage free and segment of the user and GDI heap */
sysHeapInfo.dwSize = sizeof( SYSHEAPINFO );
SystemHeapInfo( &sysHeapInfo );
addRandomData( randomState, &sysHeapInfo, sizeof( SYSHEAPINFO ) );
/* Flush any remaining data through */
endRandomData( randomState, 25 );
}
示例13: hook_stop_proc
void hook_stop_proc() {
// Get the local system time in UNIX epoch form.
uint64_t timestamp = GetMessageTime();
// Populate the hook stop event.
event.time = timestamp;
event.reserved = 0x00;
event.type = EVENT_HOOK_DISABLED;
event.mask = 0x00;
// Fire the hook stop event.
dispatch_event(&event);
}
示例14: RelayEvent
LRESULT RelayEvent(HWND hwnd, UINT uMsg, int x, int y)
{
MSG msg;
DWORD pos = GetMessagePos();
msg.hwnd = hwnd;
msg.message = uMsg;
msg.time = GetMessageTime();
msg.wParam = 0;
msg.lParam = MAKELPARAM(x, y);//GetMessagePos();
msg.pt.x = x;//(short)LOWORD(pos);//msg.lParam);
msg.pt.y = y;//(short)HIWORD(pos);//msg.lParam);
return SendMessage(hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
}
示例15: process_button_pressed
static void process_button_pressed(MSLLHOOKSTRUCT *mshook, uint16_t button) {
uint64_t timestamp = GetMessageTime();
// Track the number of clicks, the button must match the previous button.
if (button == click_button && (long int) (timestamp - click_time) <= hook_get_multi_click_time()) {
if (click_count < USHRT_MAX) {
click_count++;
}
else {
logger(LOG_LEVEL_WARN, "%s [%u]: Click count overflow detected!\n",
__FUNCTION__, __LINE__);
}
}
else {
// Reset the click count.
click_count = 1;
// Set the previous button.
click_button = button;
}
// Save this events time to calculate the click_count.
click_time = timestamp;
// Store the last click point.
last_click.x = mshook->pt.x;
last_click.y = mshook->pt.y;
// Populate mouse pressed event.
event.time = timestamp;
event.reserved = 0x00;
event.type = EVENT_MOUSE_PRESSED;
event.mask = get_modifiers();
event.data.mouse.button = button;
event.data.mouse.clicks = click_count;
event.data.mouse.x = mshook->pt.x;
event.data.mouse.y = mshook->pt.y;
logger(LOG_LEVEL_INFO, "%s [%u]: Button %u pressed %u time(s). (%u, %u)\n",
__FUNCTION__, __LINE__, event.data.mouse.button, event.data.mouse.clicks,
event.data.mouse.x, event.data.mouse.y);
// Fire mouse pressed event.
dispatch_event(&event);
}