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


C++ PostMessageW函数代码示例

本文整理汇总了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;
            }
        }
    }
}
开发者ID:mikekap,项目名称:wine,代码行数:34,代码来源:input.c

示例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);
}
开发者ID:nakedboov,项目名称:WinClipCursor,代码行数:26,代码来源:win_hook.cpp

示例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;
}
开发者ID:pbatard,项目名称:libwdi,代码行数:37,代码来源:zadig_stdlg.c

示例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);
}
开发者ID:Volkanite,项目名称:Push,代码行数:32,代码来源:push.c

示例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;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:30,代码来源:ddeclient.c

示例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;
}
开发者ID:chhavi1996,项目名称:guipro,代码行数:34,代码来源:iconManager.cpp

示例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);
}
开发者ID:rikvdbrule,项目名称:KinectRecording,代码行数:10,代码来源:KinectWindow.cpp

示例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;
}
开发者ID:Jactry,项目名称:wine,代码行数:30,代码来源:taskdialog.c

示例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;
}
开发者ID:sterlingware,项目名称:starship,代码行数:10,代码来源:KinectWindowManager.cpp

示例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 );
}
开发者ID:AndreRH,项目名称:wine,代码行数:7,代码来源:async.c

示例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;
}
开发者ID:4D4B,项目名称:RInput,代码行数:26,代码来源:rinput.cpp

示例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);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:8,代码来源:appswitch.c

示例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);
}
开发者ID:Strongc,项目名称:reactos,代码行数:8,代码来源:guiterm.c

示例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;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:8,代码来源:main.c

示例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;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:9,代码来源:CShellDispatch.cpp


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