本文整理汇总了C++中PostMessageW函数的典型用法代码示例。如果您正苦于以下问题:C++ PostMessageW函数的具体用法?C++ PostMessageW怎么用?C++ PostMessageW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PostMessageW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_mouse_leave
static void check_mouse_leave(HWND hwnd, int hittest)
{
if (tracking_info.tme.hwndTrack != hwnd)
{
if (tracking_info.tme.dwFlags & TME_NONCLIENT)
PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
else
PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
/* remove the TME_LEAVE flag */
tracking_info.tme.dwFlags &= ~TME_LEAVE;
}
else
{
if (hittest == HTCLIENT)
{
if (tracking_info.tme.dwFlags & TME_NONCLIENT)
{
PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
/* remove the TME_LEAVE flag */
tracking_info.tme.dwFlags &= ~TME_LEAVE;
}
}
else
{
if (!(tracking_info.tme.dwFlags & TME_NONCLIENT))
{
PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
/* remove the TME_LEAVE flag */
tracking_info.tme.dwFlags &= ~TME_LEAVE;
}
}
}
}
示例2: CallWndHookProc
static LRESULT CALLBACK CallWndHookProc(UINT nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode < 0)
return CallNextHookEx(nullptr, nCode, wParam, lParam);
if (nCode == HC_ACTION)
{
PCWPSTRUCT swpStruct = (PCWPSTRUCT)lParam;
//skip messages from childs
if (g_hWndTarget == swpStruct->hwnd)
{
switch(swpStruct->message)
{
case WM_ACTIVATE:
PostMessageW(g_hWndSrv, WMU_ACTIVATE, swpStruct->wParam, swpStruct->lParam);
break;
case WM_DESTROY:
PostMessageW(g_hWndSrv, WMU_DESTROY, (WPARAM)swpStruct->hwnd, swpStruct->lParam);
break;
}
}
}
return CallNextHookEx(nullptr, nCode, wParam, lParam);
}
示例3: BrowseInfoCallback
/*
* Main BrowseInfo callback to set the initial directory and populate the edit control
*/
INT CALLBACK BrowseInfoCallback(HWND hDlg, UINT message, LPARAM lParam, LPARAM pData)
{
char dir[MAX_PATH];
wchar_t* wpath;
LPITEMIDLIST pidl;
switch(message) {
case BFFM_INITIALIZED:
pOrgBrowseWndproc = (WNDPROC)SetWindowLongPtr(hDlg, GWLP_WNDPROC, (LONG_PTR)BrowseDlgCallback);
// Windows hides the full path in the edit box by default, which is bull.
// Get a handle to the edit control to fix that
hBrowseEdit = FindWindowExA(hDlg, NULL, "Edit", NULL);
SetWindowTextU(hBrowseEdit, szFolderPath);
SetDialogFocus(hDlg, hBrowseEdit);
// On Windows 7, MinGW only properly selects the specified folder when using a pidl
wpath = utf8_to_wchar(szFolderPath);
pidl = SHSimpleIDListFromPath(wpath);
safe_free(wpath);
// NB: see http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7
// for details as to why we send BFFM_SETSELECTION twice.
SendMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl);
Sleep(100);
PostMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl);
break;
case BFFM_SELCHANGED:
// Update the status
if (SHGetPathFromIDListU((LPITEMIDLIST)lParam, dir)) {
SendMessageLU(hDlg, BFFM_SETSTATUSTEXT, 0, dir);
SetWindowTextU(hBrowseEdit, dir);
}
break;
}
return 0;
}
示例4: CacheFiles
VOID CacheFiles( CHAR driveLetter )
{
HANDLE threadHandle;
FILE_LIST_ENTRY *file = (FILE_LIST_ENTRY*) PushFileList;
//create copy progress window
NtCreateThreadEx(
&threadHandle,
THREAD_ALL_ACCESS,
NULL,
NtCurrentProcess(),
&CpwThread,
NULL,
NoThreadFlags,
0, 0, 0,
NULL
);
while (file != 0)
{
CacheFile(file->Name, driveLetter);
file = file->NextEntry;
}
//close the window
PostMessageW( CpwWindowHandle, WM_CLOSE, 0, 0 );
//destroy the thread
NtTerminateThread(threadHandle, 0);
}
示例5: WDML_ClientHandle
/*****************************************************************
* WDML_ClientHandle
*/
HDDEDATA WDML_ClientHandle(WDML_CONV *pConv, WDML_XACT *pXAct, DWORD dwTimeout, LPDWORD pdwResult)
{
HDDEDATA hDdeData;
if (!PostMessageW(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam))
{
WARN("Failed posting message %x to %p (error=0x%x)\n",
pXAct->ddeMsg, pConv->hwndServer, GetLastError());
pConv->wStatus &= ~ST_CONNECTED;
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
return 0;
}
pXAct->dwTimeout = dwTimeout;
/* FIXME: should set the app bits on *pdwResult */
if (dwTimeout == TIMEOUT_ASYNC)
{
if (pdwResult)
*pdwResult = MAKELONG(0, pXAct->xActID);
hDdeData = (HDDEDATA)1;
}
else
hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct, pdwResult);
return hDdeData;
}
示例6: retrieveIconFrom
HICON* retrieveIconFrom(iconLoader* loader, WPARAM wParam, LPARAM lParam)
{
/*
//Maybe we should add some semaphore checks
DWORD waitFor = WaitForSingleObject( loader->semaphore, 0L );
*/
if( loader->thread == NULL)
{
if( loader->icon != NULL )
return &(loader->icon);
return NULL;
}
if( wParam != NULL || lParam != NULL )
{
DWORD waitFor = WaitForSingleObject( loader->semaphore, INFINITE );
if( waitFor == WAIT_OBJECT_0 )
{
refreshParam* param = (refreshParam*)malloc(sizeof(refreshParam));
memset(param, 0, sizeof(refreshParam));
param->lParam = lParam;
param->wParam = wParam;
loader->refreshs->insert( loader->refreshs->end(), param );
}
else
{
PostMessageW(g_hwndMain, WM_DRAWITEM, lParam, wParam);
}
}
return NULL;
}
示例7: HideView
/// <summary>
/// Explictly called by main window to close Kinect window and stop the thread on exit of main window
/// </summary>
void KinectWindow::NotifyOfExit()
{
HideView();
m_hWndParent = nullptr; // Don't need Kinect window send back message of quit in this case
PostMessageW(m_hWnd, WM_CLOSE, 0, 0);
}
示例8: taskdialog_callback_proc_timer
static HRESULT CALLBACK taskdialog_callback_proc_timer(HWND hwnd, UINT notification,
WPARAM wParam, LPARAM lParam, LONG_PTR ref_data)
{
struct timer_notification_data *data = (struct timer_notification_data *)ref_data;
if (notification == TDN_TIMER)
{
DWORD elapsed_ms;
int delta;
elapsed_ms = (DWORD)wParam;
if (data->num_fired == 3)
ok(data->last_elapsed_ms > elapsed_ms, "Expected reference time update.\n");
else
{
delta = elapsed_ms - data->last_elapsed_ms;
ok(delta > 0, "Expected positive time tick difference.\n");
}
data->last_elapsed_ms = elapsed_ms;
if (data->num_fired == 3)
PostMessageW(hwnd, TDM_CLICK_BUTTON, IDOK, 0);
++data->num_fired;
return data->num_fired == 3 ? S_FALSE : S_OK;
}
return S_OK;
}
示例9: KinectWindow
/// <summary>
/// Create a Kinect window to display the sensor
/// </summary>
KinectWindow* KinectWindowManager::CreateKinectWindow(INuiSensor* pNuiSensor)
{
KinectWindow* pKinectWindow = new KinectWindow(GetModuleHandle(0), m_hWnd, pNuiSensor);
pKinectWindow->StartWindow();
PostMessageW(pKinectWindow->GetWindow(), WM_SHOWKINECTWINDOW, m_kinectWindowShowParam, 0);
return pKinectWindow;
}
示例10: async_worker
static void WINAPI async_worker( TP_CALLBACK_INSTANCE *instance, void *context )
{
struct async_query_header *query = context;
LPARAM lparam = query->func( query );
PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam );
HeapFree( GetProcessHeap(), 0, query );
}
示例11: PostMessageW
void RInput::deinitialise(){
if(false == RInput::_initialised){
return;
}
RInput::_initialised = false;
if(0 == PostMessageW(RInput::_hwnd_message, WM_DESTROY, 0, 0)){
std::cerr << "RInput::deinitialise(): 0 == PostMessageW(RInput::_hwnd_message, WM_DESTROY, 0, 0), GetLastError():" << std::dec << GetLastError() << std::endl;
}
MSG msg;
while(GetMessageW(&msg, RInput::_hwnd_message, 0, 0)){
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
if(0 == DestroyWindow(RInput::_hwnd_message)){
std::cerr << "RInput::deinitialise(): 0 == DestroyWindow(RInput::_hwnd_message), GetLastError(): " << std::dec << GetLastError() << std::endl;
return;
}
RInput::_rinput_instance = std::shared_ptr<RInput>(nullptr);
RInput::_initialised = false;
RInput::_hwnd_message = 0;
}
示例12: MakeWindowActive
void MakeWindowActive(HWND hwnd)
{
if (IsIconic(hwnd))
PostMessageW(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
BringWindowToTop(hwnd); // same as: SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); ?
SetForegroundWindow(hwnd);
}
示例13: GuiResizeTerminal
static VOID NTAPI
GuiResizeTerminal(IN OUT PFRONTEND This)
{
PGUI_CONSOLE_DATA GuiData = This->Context;
/* Resize the window to the user's values */
PostMessageW(GuiData->hWindow, PM_RESIZE_TERMINAL, 0, 0);
}
示例14: TranslateChildTabMessage
static BOOL TranslateChildTabMessage(MSG *msg)
{
if (msg->message != WM_KEYDOWN) return FALSE;
if (msg->wParam != VK_TAB) return FALSE;
if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE;
PostMessageW(g_pChildWnd->hWnd, WM_COMMAND, ID_SWITCH_PANELS, 0);
return TRUE;
}
示例15: TRACE
HRESULT STDMETHODCALLTYPE CShellDispatch::ToggleDesktop()
{
TRACE("(%p)\n", this);
HWND hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
PostMessageW(hTrayWnd, WM_COMMAND, TRAYCMD_TOGGLE_DESKTOP, 0);
return S_OK;
}