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


C++ PostThreadMessage函数代码示例

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


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

示例1: PostThreadMessage

//-----------------------------------------------------------------------------
// Name: 
// Desc:
//-----------------------------------------------------------------------------
HRESULT CFileWatch::Cleanup()
{
    if( m_hFileChangeThread )
    {
        PostThreadMessage( m_dwFileChangeThreadId, WM_QUIT, 0, 0 );
        WaitForSingleObject( m_hFileChangeThread, INFINITE );
        CloseHandle( m_hFileChangeThread );
        m_hFileChangeThread = NULL;
    }

    return S_OK;
}
开发者ID:ddwefe,项目名称:MyDonuts4,代码行数:16,代码来源:FileWatch.cpp

示例2: while

// Called from the Java Swing dispatch thread
void
DesktopIndicatorHandler::enable
(JNIEnv *jniEnv)
{
    g_desktopIndicatorThread.MakeSureThreadIsUp(jniEnv);
    while (!PostThreadMessage(
            g_desktopIndicatorThread.getWinThreadId(),
            WM_DESKTOPINDICATOR, (WPARAM)enableCode,
            (LPARAM)this)) {
        Sleep(0); //Yield to other threads with any priority
    }
}
开发者ID:BackupTheBerlios,项目名称:limewire,代码行数:13,代码来源:DesktopIndicatorHandler.cpp

示例3: send_notifications

/* Signal to the main thread that we have file notifications for it to
   process.  */
static void
send_notifications (BYTE *info, DWORD info_size, void *desc,
                    volatile int *terminate)
{
    int done = 0;
    struct frame *f = SELECTED_FRAME ();

    /* A single buffer is used to communicate all notifications to the
       main thread.  Since both the main thread and several watcher
       threads could be active at the same time, we use a critical area
       and an "in-use" flag to synchronize them.  A watcher thread can
       only put its notifications in the buffer if it acquires the
       critical area and finds the "in-use" flag reset.  The main thread
       resets the flag after it is done processing notifications.

       FIXME: is there a better way of dealing with this?  */
    while (!done && !*terminate)
    {
        enter_crit ();
        if (!notification_buffer_in_use)
        {
            if (info_size)
                memcpy (file_notifications, info, info_size);
            notifications_size = info_size;
            notifications_desc = desc;
            /* If PostMessage fails, the message queue is full.  If that
               happens, the last thing they will worry about is file
               notifications.  So we effectively discard the
               notification in that case.  */
            if ((FRAME_TERMCAP_P (f)
                    /* We send the message to the main (a.k.a. "Lisp")
                    thread, where it will wake up MsgWaitForMultipleObjects
                      inside sys_select, causing it to report that there's
                      some keyboard input available.  This will in turn cause
                      w32_console_read_socket to be called, which will pick
                      up the file notifications.  */
                    && PostThreadMessage (dwMainThreadId, WM_EMACS_FILENOTIFY, 0, 0))
                    || (FRAME_W32_P (f)
                        && PostMessage (FRAME_W32_WINDOW (f),
                                        WM_EMACS_FILENOTIFY, 0, 0))
                    /* When we are running in batch mode, there's no one to
                    send a message, so we just signal the data is
                     available and hope sys_select will be called soon and
                     will read the data.  */
                    || (FRAME_INITIAL_P (f) && noninteractive))
                notification_buffer_in_use = 1;
            done = 1;
        }
        leave_crit ();
        if (!done)
            Sleep (5);
    }
}
开发者ID:bgamari,项目名称:emacs,代码行数:55,代码来源:w32notify.c

示例4: DspCloseLibrary

void DspCloseLibrary()
#ifdef USE_A_THREAD
{
	if(!dspPluginEnabled) return ;

	PostThreadMessage(UpdateThreadId,WM_QUIT,0,0);
	running=false;
	if(WaitForSingleObject(hUpdateThread,1000)==WAIT_TIMEOUT)
	{
		TerminateThread(hUpdateThread,1);
	}
}
开发者ID:madnessw,项目名称:thesnow,代码行数:12,代码来源:dsp.cpp

示例5: PostThreadMessage

int CSound::Stop()
{
	if(!m_pSecondaryBuffer) return CS_E_NULL_SECONDARY;
	if( m_isStreamFile ){
		PostThreadMessage(m_dwThreadId, CSL_MSG_STOP, 0, 0);
		WaitForSingleObject(m_hThreadMessageDispatchEvent, INFINITE);
	}else{
		m_pSecondaryBuffer->Stop();
		this->StopDuplicatedBuffer();	//まさか複製バッファの音だけ残しておきたいとか無いでしょ・・・
	}
	return CS_E_OK;
}
开发者ID:kioku-systemk,项目名称:4kIntroMonitor,代码行数:12,代码来源:CSound.cpp

示例6: setitimer_timeout

LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
{
	struct timer_msg *msg = (struct timer_msg *) info;

	if (msg) {
		raise((int) msg->signal);
		PostThreadMessage(msg->threadid,
						  WM_NOTIFY, msg->signal, 0);
		free(msg);
	}
	return 0;
}
开发者ID:2yeslater,项目名称:php_threading,代码行数:12,代码来源:time.c

示例7: clear_hook

int clear_hook(void)
{
    if(mouse_ll_hook == NULL) {
        return 1;
    }

    PostThreadMessage(hook_thread_id, HOOK_THREAD_END, 0, 0);
    WaitForSingleObject(hook_thread_end_evt, INFINITE);
    CloseHandle(hook_thread_end_evt);

    return 1;
}
开发者ID:lllllT,项目名称:mouse-processor,代码行数:12,代码来源:hook.c

示例8: wimfilecleanup

void wimfilecleanup(JSContext * cx, JSObject * obj)
{
    HANDLE wimHandle = JS_GetPrivate(cx, obj);
    if(wimHandle == NULL)
        return;
    if(threadID != 0)
    {
        while(!PostThreadMessage(threadID, WM_APP + 2, 0, (LPARAM)wimHandle))
            Sleep(200);
    }
    WIMUnregisterMessageCallback(wimHandle, NULL);
    WIMCloseHandle(wimHandle);
}
开发者ID:z4y4,项目名称:njord,代码行数:13,代码来源:js_wimg.cpp

示例9: PostThreadMessage

CCoFAHost::~CCoFAHost()
{
    TRY_CATCH
    Log.Add(_MESSAGE_,_T("CCoFAHost::~CCoFAHost()"));

    PostThreadMessage(GetTid(), WM_QUIT, 0, 0);
    m_brokerEvents.Revoke();

//	if( m_server.get() )
//		m_server->Stop();

    CATCH_LOG()
}
开发者ID:uvbs,项目名称:SupportCenter,代码行数:13,代码来源:CCoFAHost.cpp

示例10: notify_notification_close

LIBNOTIFY_API gboolean notify_notification_close(
	NotifyNotification *notification, GError **error)
{
	UNREFERENCED_PARAMETER(error);

	if(notification_thread && notification)
		return PostThreadMessage(notification_thread_id,
								 WM_LIBNOTIFYCLOSE,
								 0,
								 (LPARAM) notification);

	return FALSE;
}
开发者ID:sria91,项目名称:artha,代码行数:13,代码来源:libnotify.c

示例11: sizeof

int d3d::EnterMsgLoop()
{
	MSG msg;
	::ZeroMemory(&msg, sizeof(MSG));

	timeBeginPeriod(1);
	unsigned int thid;

	g_ThreadCnt++;
	_beginthreadex(NULL, 0, GameLoop,NULL,0,&thid);
	while(msg.message != WM_QUIT)
	{
		if(::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			if(msg.message == WM_KEYDOWN || msg.message == WM_CHAR || (msg.message == WM_KEYUP && (msg.wParam == VK_SHIFT || msg.wParam == VK_CONTROL)))
				PostThreadMessage(thid,msg.message,msg.wParam,msg.lParam);
			::TranslateMessage(&msg);
			::DispatchMessage(&msg);
		}
		Sleep(16);	
		if(!Display(0))
		{
			::MessageBox(0, "디스플레이 에러", 0, 0);
		}
		if(!g_ThreadCnt)
			break;
		//if(0)
		//{
		//	PostQuitMessage(0);
		//}
    }
	PostThreadMessage(thid,WM_QUIT,msg.wParam,msg.lParam);
	int i=0;
	while(g_ThreadCnt > 0 && i++ <= 50)
		Sleep(200);
	if(i>50)
		::MessageBox(0, "쓰레드 종료 실패", 0, 0);
	return msg.wParam;
}
开发者ID:kimjoy2002,项目名称:touhou_crawl,代码行数:39,代码来源:d3dUtility.cpp

示例12: ConsoleEventHandler

BOOL WINAPI ConsoleEventHandler(DWORD dwCtrlType)
{
	switch(dwCtrlType)
	{
		case CTRL_C_EVENT:
		case CTRL_CLOSE_EVENT:
			PostThreadMessage(dwMainThread, WM_QUIT, NULL, NULL);
			return TRUE;

		default:
			return FALSE;
	}
}
开发者ID:Bentusi,项目名称:keymapper,代码行数:13,代码来源:keymapper.cpp

示例13: DspCloseLibrary

void DspCloseLibrary()
#ifdef USE_A_THREAD
{
	if(!dspPluginEnabled) return ;

	PostThreadMessage(UpdateThreadId,WM_QUIT,0,0);
	running=false;
	if(WaitForSingleObject(hUpdateThread,1000)==WAIT_TIMEOUT)
	{
		ConLog("SPU2-X: WARNING: DSP Thread did not close itself in time. Assuming hung. Terminating.\n");
		TerminateThread(hUpdateThread,1);
	}
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:13,代码来源:dsp.cpp

示例14: vmsvga3dSendThreadMessage

/**
 * Send a message to the async window thread and wait for a reply
 *
 * @returns VBox status code.
 * @param   pWindowThread   Thread handle
 * @param   WndRequestSem   Semaphore handle for waiting
 * @param   msg             Message id
 * @param   wParam          First parameter
 * @param   lParam          Second parameter
 */
int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam)
{
    int  rc;
    BOOL ret;

    ret = PostThreadMessage(RTThreadGetNative(pWindowThread), msg, wParam, lParam);
    AssertMsgReturn(ret, ("PostThreadMessage %x failed with %d\n", RTThreadGetNative(pWindowThread), GetLastError()), VERR_INTERNAL_ERROR);

    rc = RTSemEventWait(WndRequestSem, RT_INDEFINITE_WAIT);
    Assert(RT_SUCCESS(rc));

    return rc;
}
开发者ID:stefano-garzarella,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:23,代码来源:DevVGA-SVGA3d-shared.cpp

示例15: NotifyApplication

void NotifyApplication(char *buffer)
{
	WORD msgSize, command;

	msgSize = *(WORD*)&buffer[0];
	command = *(WORD*)&buffer[2];

	if (blockingMode)
		PostThreadMessage (applProcID, WM_FL_ARRIVED, MAKELONG(command,msgSize), (LPARAM)(buffer+4));
	else
		SendMessage (hMom, WM_FL_ARRIVED, MAKELONG(command,msgSize), (LPARAM)(buffer+4));
	remRecvItems++;
}
开发者ID:jhp333,项目名称:aux,代码行数:13,代码来源:flyplus.cpp


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