Exemple #1
0
TCHAR* CMsnProto::GetContactNameT(MCONTACT hContact)
{
	if (hContact)
		return (TCHAR*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0);

	TCHAR *str = Contact_GetInfo(CNF_DISPLAY, NULL, m_szModuleName);
	if (str != NULL) {
		mir_free(m_DisplayNameCache);
		return m_DisplayNameCache = str;
	}

	return _T("Me");
}
void WASocketConnection::write(const std::vector<unsigned char> &bytes, int length)
{
    NETLIBBUFFER nlb;
    std::string tmpBuf = std::string(bytes.begin(), bytes.end());
    nlb.buf = (char*)&(tmpBuf.c_str()[0]);
    nlb.len = length;
    nlb.flags = MSG_NODUMP;

    int result = CallService(MS_NETLIB_SEND, WPARAM(hConn), LPARAM(&nlb));
    if (result < length) {
        throw WAException(getLastErrorMsg(), WAException::SOCKET_EX, WAException::SOCKET_EX_SEND);
    }
}
Exemple #3
0
//数据接收事件
void CALLBACK CTCPClientDlg::OnRead(void* pOwner,const char * buf,DWORD dwBufLen )
{
	BYTE *pRecvBuf = NULL; //接收缓冲区
	//得到父对象指针
	CTCPClientDlg* pThis = (CTCPClientDlg*)pOwner;
	//将接收的缓冲区拷贝到pRecvBuf种
	pRecvBuf = new BYTE[dwBufLen];
	CopyMemory(pRecvBuf,buf,dwBufLen);

	//发送异步消息,表示收到TCP数据,消息处理完,应释放内存
	pThis->PostMessage(WM_RECV_TCP_DATA,WPARAM(pRecvBuf),dwBufLen);

}
Exemple #4
0
//定义串口接收数据函数类型
void CALLBACK CSerialSampleDlg::OnSerialRead(void * pOwner,BYTE* buf,DWORD bufLen)
{
	BYTE *pRecvBuf = NULL; //接收缓冲区
	//得到父对象指针
	CSerialSampleDlg* pThis = (CSerialSampleDlg*)pOwner;
	//将接收的缓冲区拷贝到pRecvBuf种
	pRecvBuf = new BYTE[bufLen];
	CopyMemory(pRecvBuf,buf,bufLen);

	//发送异步消息,表示收到串口数据,消息处理完,应释放内存
	pThis->PostMessage(WM_RECV_SERIAL_DATA,WPARAM(pRecvBuf),bufLen);

}
Exemple #5
0
bool TerScroller::Next()
{
    ProcessMessages();

    if (g_bCancel)
        return false;

    int iCurrentPos = ::GetScrollPos(m_hWnd, SB_VERT);
    if (iCurrentPos < m_iLastPosition) // Takes care of a buggy (MM/AS)
        return false;
    else
        m_iLastPosition = iCurrentPos;
    Sleep(0);
    ::SendMessage(m_hWnd, WM_KEYDOWN, WPARAM(VK_NEXT), (LPARAM)m_hWnd);
    ::SendMessage(m_hWnd, WM_KEYUP, WPARAM(VK_NEXT), (LPARAM)m_hWnd);
    Sleep(0);
    if (iCurrentPos == ::GetScrollPos(m_hWnd, SB_VERT))
    {
        return false;
    }
    return true;
}
Exemple #6
0
//===================================== TlevelsPage =====================================
void TlevelsPage::init(void)
{
    deciD->queryFilterInterface(IID_IimgFilterLevels,(void**)&filter);
    memset(&histogramBmp.bmiHeader,0,sizeof(histogramBmp.bmiHeader));
    histogramBmp.bmiHeader.biSize=sizeof(histogramBmp.bmiHeader);
    histogramBmp.bmiHeader.biWidth=256;
    histogramBmp.bmiHeader.biHeight=64;
    histogramBmp.bmiHeader.biPlanes=1;
    histogramBmp.bmiHeader.biBitCount=8;
    histogramBmp.bmiHeader.biCompression=BI_RGB;
    histogramBmp.bmiHeader.biXPelsPerMeter=100;
    histogramBmp.bmiHeader.biYPelsPerMeter=100;
    memset(histogramBmp.bmiColors,0,256*sizeof(RGBQUAD));
    histogramBmp.bmiColors[1].rgbRed=histogramBmp.bmiColors[1].rgbGreen=histogramBmp.bmiColors[1].rgbBlue=255;
    histogramBmp.bmiColors[2].rgbRed=histogramBmp.bmiColors[2].rgbGreen=histogramBmp.bmiColors[2].rgbBlue=192;
    memset(histogramBits,1,sizeof(histogramBits));

    curvesBmp=histogramBmp;
    curvesBmp.bmiHeader.biHeight=256;
    hcurves=GetDlgItem(m_hwnd,IDC_BMP_LEVELS_CURVES);

    bmpGradient=LoadBitmap(hi,MAKEINTRESOURCE(IDB_GRADIENT));
    HDC hdc=GetDC(m_hwnd);
    hdcGradient=CreateCompatibleDC(hdc);
    oldHDCgradient=SelectObject(hdcGradient,bmpGradient);
    LOGFONT oldFont;
    HFONT hf=(HFONT)GetCurrentObject(hdc,OBJ_FONT);
    GetObject(hf,sizeof(LOGFONT),&oldFont);
    strcpy(oldFont.lfFaceName,_l("Courier"));
    oldFont.lfWeight=FW_LIGHT;
    oldFont.lfHeight=-11;
    oldFont.lfWidth=0;
    fontCurier=CreateFontIndirect(&oldFont);
    SendMessage(GetDlgItem(m_hwnd,IDC_LBX_LEVELS_CURVES),WM_SETFONT,WPARAM(fontCurier),FALSE);
    strcpy(oldFont.lfFaceName,_l("Small fonts"));
    fontGradient=CreateFontIndirect(&oldFont);
    ReleaseDC(m_hwnd,hdc);
    isMap=false;
    hIn=GetDlgItem(m_hwnd,IDC_BMP_LEVELS_IN);
    hOut=GetDlgItem(m_hwnd,IDC_BMP_LEVELS_OUT);
    RECT r;
    GetWindowRect(hIn,&r);
    bdx=r.right-r.left-2;
    tbrSetRange(IDC_TBR_LEVELS_GAMMA,1,400,40);
    tbrSetRange(IDC_TBR_LEVELS_POSTERIZE,1,255);
    SendDlgItemMessage(m_hwnd,IDC_UD_Y_MAX_DELTA ,UDM_SETRANGE,0,MAKELONG(50,1));
    SendDlgItemMessage(m_hwnd,IDC_UD_Y_THRESHOLD ,UDM_SETRANGE,0,MAKELONG(150,1));
    SendDlgItemMessage(m_hwnd,IDC_UD_Y_TEMPORAL ,UDM_SETRANGE,0,MAKELONG(20,1));
    startup=true;
    addHint(IDC_CHB_LEVELS_RGB, L"You need to force RGB conversion to get accurate color. If your computer is fast enough, we recommend you to check it. If the video is interlaced, please make sure to deinterlace before RGB conversion.\nFor the range setting, output levels in RGB conversion page is used even if the picture is RGB from the start.");
}
void PresetWindow::OnCreate()
{
	// Set window options
	WindowHelper::SetTitle(GetWindowHandle(), WindowHelper::GetCurrentModuleHandle(), IDS_PRESETS);
	SetWindowPos(GetWindowHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

	// Create controls
	presetListbox = CreateWindowEx(WS_EX_CLIENTEDGE, L"Listbox", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT, 12, 12, 165, 121, GetWindowHandle(), reinterpret_cast<HMENU>(PresetCommand::ListboxSelect), WindowHelper::GetCurrentModuleHandle(), NULL);
	removeButton = CreateWindow(L"Button", L"Remove", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 12, 146, 75, 23, GetWindowHandle(), reinterpret_cast<HMENU>(PresetCommand::RemovePreset), WindowHelper::GetCurrentModuleHandle(), NULL);
	titleLabel = CreateWindow(L"Static", L"Name:", WS_CHILD | WS_VISIBLE | SS_LEFT, 192, 12, 30, 13, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	sizeLabel = CreateWindow(L"Static", L"Size:", WS_CHILD | WS_VISIBLE | SS_LEFT, 192, 60, 30, 13, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	posxText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 202, 90, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	posyText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 258, 78, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	heightText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 258, 104, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	widthText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 314, 90, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	saveButton = CreateWindow(L"Button", L"Save", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 297, 146, 75, 23, GetWindowHandle(), reinterpret_cast<HMENU>(PresetCommand::SavePreset), WindowHelper::GetCurrentModuleHandle(), NULL);

	titleText.SetCoords(195, 28, 175, 20);
	titleText.Create();

	// Set fonts
	defaultFont = WindowHelper::CreateFont(GetWindowHandle(), L"Microsoft Sans Serif", 8.25, FW_NORMAL, false, false, false);
	SendMessage(presetListbox, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(removeButton, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(titleLabel, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(titleText.GetWindowHandle(), WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(sizeLabel, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(posxText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(posyText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(widthText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(heightText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(saveButton, WM_SETFONT, WPARAM(defaultFont), TRUE);

	windowMonitor->RegisterObserver(this);
	UpdatePresetList();
	UpdateListSelection();
	UpdateDimensions();
}
Exemple #8
0
void PAGE::MakeWindowTop ( void )
{
	LRESULT   cnt;
  LPARAM		item;

	cnt = SendDlgItemMessage(hDialog, PAGESELECT, LB_GETSELCOUNT, 0, 0L);

	if (cnt == 1)
	{
		SendDlgItemMessage(hDialog, PAGESELECT, LB_GETSELITEMS, 1, LPARAM(&item));
		hObjectWnd = (HWND)SendDlgItemMessage(hDialog, PAGESELECT, LB_GETITEMDATA, WPARAM(item), 0L);
		BringWindowToTop(hObjectWnd);
	}
}
static void DDE_StartConversation(HWND hwndClientDDE, LPCSTR szApplication, LPCSTR szTopic)
{
	//static BOOL fInInitiate = FALSE; 

	ATOM atomApplication = *szApplication ? GlobalAddAtom(szApplication) : 0; 
	ATOM atomTopic       = *szTopic       ? GlobalAddAtom(szTopic      ) : 0; 

	//fInInitiate = TRUE; 
	SendMessage(HWND(-1), WM_DDE_INITIATE, WPARAM(hwndClientDDE), MAKELONG(atomApplication, atomTopic));
	//fInInitiate = FALSE; 

	if (atomApplication) GlobalDeleteAtom(atomApplication); 
	if (atomTopic      ) GlobalDeleteAtom(atomTopic      ); 
}
void CInteractionAreaDialog::OnPopupExtern() 
{
	const MSG* pMsg = GetCurrentMessage( );

	AreaActionTypeId nActionTypeId = INTERACTION_NO_ACTION;
	UINT nEditId = 0;
	switch (WPARAM(pMsg->wParam))
	{
	case IDC_POPUP_ACTIVATION_EXTERN:
		nActionTypeId = (AreaActionTypeId)m_wndClickAction.GetItemData(m_wndClickAction.GetCurSel());
		nEditId = IDC_ACTIVATION_DESTINATION;
		break;
	case IDC_POPUP_MOUSEDOWN_EXTERN:
		nActionTypeId = (AreaActionTypeId)m_wndDownAction.GetItemData(m_wndDownAction.GetCurSel());
		nEditId = IDC_MOUSEDOWN_DESTINATION;
		break;
	case IDC_POPUP_MOUSEUP_EXTERN:
		nActionTypeId = (AreaActionTypeId)m_wndUpAction.GetItemData(m_wndUpAction.GetCurSel());
		nEditId = IDC_MOUSEUP_DESTINATION;
		break;
	case IDC_POPUP_MOUSEIN_EXTERN:
		nActionTypeId = (AreaActionTypeId)m_wndEnterAction.GetItemData(m_wndEnterAction.GetCurSel());
		nEditId = IDC_MOUSEIN_DESTINATION;
		break;
	case IDC_POPUP_MOUSEOUT_EXTERN:
		nActionTypeId = (AreaActionTypeId)m_wndLeaveAction.GetItemData(m_wndLeaveAction.GetCurSel());
		nEditId = IDC_MOUSEOUT_DESTINATION;
		break;
	default:
		return;
	}

	CString csFilter;
	if (nActionTypeId == INTERACTION_OPEN_URL)
		csFilter.LoadString(IDS_HTML_FILTER);
	else 
		csFilter.LoadString(IDS_ALL_FILES);

	CFileDialog *pFileDialog = new CFileDialog(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, csFilter, this);
	pFileDialog->DoModal();

	CString csFileName = pFileDialog->GetPathName();
	
	CEdit *pEdit = (CEdit *)GetDlgItem(nEditId);
	if (pEdit)
		pEdit->SetWindowText(csFileName);

	delete pFileDialog;

}
Exemple #11
0
int msn_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend)
{
    ThreadData* T = FindThreadConn(hConn);
    if (T != NULL)
    {
        if (T->sessionClosed)
            return SOCKET_ERROR;

        T->applyGatewayData(hConn, len == 0);
    }

    NETLIBBUFFER tBuf = { (char*)buf, len, flags };
    return pfnNetlibSend((LPARAM)hConn, WPARAM(&tBuf));
}
Exemple #12
0
void TrayIcon::SendCallback(UINT message, WPARAM /* wParam */, LPARAM /* lParam */) {
  WPARAM wParam;
  LPARAM lParam;
  if (mData.version >= NOTIFYICON_VERSION_4) {
    D2D1_RECT_F r;
    mPane->GetScreenPosition(&r);
    wParam = MAKEWPARAM(r.left, r.top);
    lParam = MAKELPARAM(message, mData.id);
  } else {
    wParam = WPARAM(mData.id);
    lParam = LPARAM(message);
  }
  PostMessage(mData.window, mData.callbackMessage, wParam, lParam);
}
//------------------------------------------------------------------
DWORD WINAPI down_http_file::httpfileload_proc(void* p_param)
{
	down_task* p_task = (down_task*)p_param;
	assert(p_task);
	if(!p_task) return 0;
// 	CurlData* pdata = new CurlData();
// 	pdata->SetURL(mci::unicode_2_utf8(p_task->s_url).c_str());
// 	pdata->SetFileName(mci::unicode_2_ansi(p_task->s_local_file_down).c_str());
// 	pdata->h_notify_wnd = p_task->h_notify_wnd;
// 	pdata->n_notify_msg = p_task->n_notify_msg;
// 	pdata->n_lparam = p_task->n_lparam;
// 	pdata->n_wparam = p_task->n_wparam;
// 	pdata->bshowprogress = true;
//  
//  int e_result = HttpManagerProto::Instance()->DoHttpGet(pdata);

	down_result_e e_result = http_file_down(p_task->s_url, p_task->s_local_file_down);
 
 	if(e_result == dr_success)
	{
		switch (p_task->task_type)
		{
		case TT_NORMAL:
			{
			}
			break;
		default:
			break;
		}
		if(!p_task->s_local_file_normal.IsEmpty())
		{
			BOOL bResult = ::MoveFile(p_task->s_local_file_down,p_task->s_local_file_normal);
			bResult ? sLog("::MoveFile[%s ---> %s]",
				mci::unicode_2_ansi(p_task->s_local_file_down).c_str(),
				mci::unicode_2_ansi(p_task->s_local_file_normal).c_str()) : sLogError("::MoveFile[%s--->%s]",
				mci::unicode_2_ansi(p_task->s_local_file_down).c_str(),
				mci::unicode_2_ansi(p_task->s_local_file_normal).c_str());
		}
		if (p_task->h_notify_wnd != NULL && p_task->n_notify_msg > 0)
		{
			::PostMessage(p_task->h_notify_wnd,p_task->n_notify_msg,WPARAM(p_task->n_wparam),WP_LOAD_FINISH);
		}
	}//end if (e_result == dr_success)
	
	delete p_task;
	p_task = NULL;
//	delete param;
	return 0;
}
bool AutoCompletion::showApiAndWordComplete()
{
	int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
	int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));

	if (curPos == startPos)
		return false;

	const size_t bufSize = 256;
	TCHAR beginChars[bufSize];
	
	size_t len = (curPos > startPos)?(curPos - startPos):(startPos - curPos);
	if (len >= bufSize)
		return false;

	// Get word array
	vector<generic_string> wordArray;
	_pEditView->getGenericText(beginChars, bufSize, startPos, curPos);

	getWordArray(wordArray, beginChars);


	for (size_t i = 0, len = _keyWordArray.size(); i < len; ++i)
	{
		if (_keyWordArray[i].find(beginChars) == 0)
		{
			if (!isInList(_keyWordArray[i], wordArray))
				wordArray.push_back(_keyWordArray[i]);
		}
	}

	sort(wordArray.begin(), wordArray.end());

	// Get word list
	generic_string words(TEXT(""));

	for (size_t i = 0, len = wordArray.size(); i < len; ++i)
	{
		words += wordArray[i];
		if (i != wordArray.size()-1)
			words += TEXT(" ");
	}

	_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
	_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
	_pEditView->showAutoComletion(curPos - startPos, words.c_str());

	return true;
}
Exemple #15
0
void CDebug::_ShowDebugMessage( int nLevel, CString strMess )
{
	static HWND s_hMainWnd = AfxGetMainWnd() ? AfxGetMainWnd()->GetSafeHwnd() : NULL;
	HWND hMessWnd = ::FindWindow( _T("DebugMess"), NULL);

	if( hMessWnd && !strMess.IsEmpty())
	{	
		COPYDATASTRUCT copyData = {0};
		copyData.dwData = nLevel;
		copyData.cbData = strMess.GetLength()+1;
		copyData.lpData = strMess.GetBuffer(0);

		::SendMessage(hMessWnd, WM_COPYDATA, WPARAM(s_hMainWnd), LPARAM(&copyData));
	}
}
Exemple #16
0
		void Show(LPTSTR text, LPTSTR title, HICON icon = (HICON)TTI_INFO_LARGE, UINT time = 2000) {
			TOOLINFO tInfo = {0};
			tInfo.cbSize = sizeof(TOOLINFO);
			tInfo.hwnd = hParent;
			tInfo.lpszText = text;
			
			SendMessage(hHint, TTM_UPDATETIPTEXT, NULL, (LPARAM)&tInfo);
			SendMessage(hHint, TTM_SETTITLE, (WPARAM)icon, (LPARAM)title);
			SendMessage(hHint, TTM_TRACKACTIVATE, WPARAM(TRUE), (LPARAM)&tInfo);
			uSize = HIWORD(SendMessage(hHint, TTM_GETBUBBLESIZE, NULL, (LPARAM)&tInfo));
			
			Update();
			
			SetTimer(hHint, 2012, time, &Hide); // 2012 - Timer ID
		};
Exemple #17
0
//检测GPS当前数据
DWORD WINAPI CGPS::GpsCheckThreadFunc(LPVOID lparam)
{
	//得到当前GPS指针
	CGPS *pGps = (CGPS*)lparam;

	int iRecCount = 0;
	//然后开始做循环检测,间隔为1秒
	while (TRUE)
	{
		//判断两次收到的时间是否相同
		if (strcmp(pGps->m_gpsCurData.time,pGps->m_gpsLastData.time) == 0)
		{
			//计数加1
			iRecCount++;
		}
		else
		{
			//将当前的GPS数据赋给历史值
			pGps->m_gpsLastData = pGps->m_gpsCurData;
			iRecCount = 0 ;
		}

		//代表连续三次没有收到数据
		if (iRecCount == 3)
		{
			if (pGps->m_gpsDev_State != GPS_NODATA)
			{
				//将GPS状态置为“无数据”
				pGps->m_gpsDev_State = GPS_NODATA;
				//发送GPS状态改变消息
				::PostMessage(pGps->m_pWnd->m_hWnd,WM_GPS_STATE_CHANGE_MESSAGE,WPARAM(GPS_NODATA),1);
			}
		}

		//延时1秒
		for (int i =0; i<10;i++)
		{
			//线程退出
			if (WaitForSingleObject(pGps->m_hThreadQuitEvent,100) == WAIT_OBJECT_0)
			{
				goto finish;
			}
		}
	}
finish:
	TRACE(L"GPS 检测线程退出\n");
	return 0;
}
bool AutoCompletion::showWordComplete(bool autoInsert)
{
	int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
	int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));

	if (curPos == startPos)
		return false;

	const size_t bufSize = 256;
	TCHAR beginChars[bufSize];
	
	size_t len = (curPos > startPos)?(curPos - startPos):(startPos - curPos);
	if (len >= bufSize)
		return false;

	// Get word array
	vector<generic_string> wordArray;
	_pEditView->getGenericText(beginChars, bufSize, startPos, curPos);

	getWordArray(wordArray, beginChars);

	if (wordArray.size() == 0) return false;

	if (wordArray.size() == 1 && autoInsert) 
	{
		_pEditView->replaceTargetRegExMode(wordArray[0].c_str(), startPos, curPos);
		_pEditView->execute(SCI_GOTOPOS, startPos + wordArray[0].length());
		return true;
	}

	sort(wordArray.begin(), wordArray.end());

	// Get word list
	generic_string words(TEXT(""));

	for (size_t i = 0, len = wordArray.size(); i < len; ++i)
	{
		words += wordArray[i];
		if (i != wordArray.size()-1)
			words += TEXT(" ");
	}

	// UNICODE TO DO
	_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
	_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
	_pEditView->showAutoComletion(curPos - startPos, words.c_str());
	return true;
}
Exemple #19
0
static void PostVideoFilterResult(const Url & url,DWORD dwFilterType)
{
	static HWND hNotifyWnd = ::FindWindow(L"{AF78EE96-9716-455c-B89E-BC1CA0AEC7F1}_cleanmainmsg", NULL);
	if(hNotifyWnd != NULL) 
	{
		int len = url.GetString().length();
		char *szUrl = new char[len+1];
		memset(szUrl,0,len+1);
		strcpy_s(szUrl,len+1,url.GetString().c_str());

		if (!::PostMessage(hNotifyWnd, WM_USER + 302,WPARAM(dwFilterType), LPARAM(szUrl)))
		{
			delete szUrl;
		}
	}
}
Exemple #20
0
TCHAR* CMsnProto::GetContactNameT(MCONTACT hContact)
{
	if (hContact)
		return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR);
	else
	{
		CONTACTINFO ci = {0};
		ci.cbSize = sizeof(ci);
		ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
		ci.szProto = m_szModuleName;
		if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
			return (TCHAR*)ci.pszVal;
		else
			return _T("Me");
	}
}
LRESULT InternalCallback(int type, int code, WPARAM wParam, LPARAM lParam)
{
	if (code >= 0)
	{
		if(IsWindow(hWindow[type]))
		{
			MSG msg = {hWindow[type], code, wParam, lParam, 0, 0, 0};
			COPYDATASTRUCT cd = {type, sizeof(msg), &msg};
			BOOL handled = 0;
			if(SendMessageTimeout(hWindow[type], WM_COPYDATA, WPARAM(hModule), LPARAM(&cd),
				SMTO_NORMAL, 50, PDWORD_PTR(&handled)) && handled) return 1;
		}
		else FreeHookWrapper(type);
	}
	return CallNextHookEx(hHook[type], code, wParam, lParam);
}
Exemple #22
0
int ShowAllTray()
{
	NOTIFYICONDATA nid;
	int i = 0;
	if(g_QuickHideAllTray == NULL)
	{
		return 0;
	}
	while(g_QuickHideAllTray && g_QuickHideAllTray[i].lPID != 0 && i < 100)
	{
		if(g_QuickHideAllTray[i].bHide > 0)
		{
			memset(&nid,0,sizeof(nid));
			nid.cbSize           = sizeof(NOTIFYICONDATA);
			nid.uFlags           = NIF_ICON|NIF_TIP|NIF_MESSAGE;
			nid.uID              = g_QuickHideAllTray[i].trayicon.uID;
			nid.hIcon            = g_QuickHideAllTray[i].trayicon.hIcon;
			nid.hWnd             = g_QuickHideAllTray[i].trayicon.hwnd;
			nid.uCallbackMessage = g_QuickHideAllTray[i].trayicon.uCallbackMessage;
			{
				int iCommandId = g_QuickHideAllTray[i].bHide;
				if(iCommandId == 0)
				{
					iCommandId = g_QuickHideAllTray[i].iCommandId;
				}
				SendMessageW(hTrayWnd_dll,TB_HIDEBUTTON,WPARAM(iCommandId),(LPARAM)MAKELONG(FALSE,0));
			}
			{
				NOTIFYICONDATA nid2;
				memset(&nid2,0,sizeof(nid2));
				nid2.cbSize=sizeof(nid2);
				nid2.hWnd=nid.hWnd;
				nid2.uID=nid.uID;
				nid2.uFlags=NIF_STATE;
				nid2.dwState=NIS_HIDDEN;
				::SendMessage(hTrayWnd_dll,WM_SETREDRAW,(WPARAM)FALSE,0);
				Shell_NotifyIcon(NIM_MODIFY,&nid2);
				SendMessage(hTrayWnd_dll,WM_SETREDRAW,(WPARAM)TRUE,0);
			}
		}
		i ++;
	}
	


	return 1;
}
static void PostVideoFilterResult(const Url & url,DWORD dwFilterType)
{
	static std::wstring szClassName = GetMsgWndClassNameByPid();
	static HWND hNotifyWnd = ::FindWindow(szClassName.c_str(), NULL);
	if(hNotifyWnd != NULL) 
	{
		int len = url.GetString().length();
		char *szUrl = new char[len+1];
		memset(szUrl,0,len+1);
		strcpy_s(szUrl,len+1,url.GetString().c_str());

		if (!::PostMessage(hNotifyWnd, WM_USER + 302,WPARAM(dwFilterType), LPARAM(szUrl)))
		{
			delete szUrl;
		}
	}
}
Exemple #24
0
/*
*函数介绍:写入内存映射文件内容
*入口参数:buf :要写入的字符串数据指针
*出口参数:(无)
*返回值:-1 :失败;1:成功
*/
DWORD CMemFileMap::WriteBuffer(LPCTSTR buf)
{
  if ((lstrlen(buf)) > m_MaxSize)
  {
	  return -1; //写入缓冲区,大于定义大小
  }
  //同步写过程,等待同步信号,且等到同步信号,自动关闭信号
  if (WaitForSingleObject(m_hSynEvent,INFINITE) == WAIT_OBJECT_0)
  {
    lstrcpy(m_pMapPointer,buf);
  }
 
  ::SendMessage(HWND_BROADCAST,m_SynMessageID,WPARAM(m_hWnd),0);
  //使同步事件有信号
  SetEvent(m_hSynEvent);
  return 1;
}
Exemple #25
0
void ipcGetSkinIcons(THeaderIPC *ipch)
{
	TSlotProtoIcons spi;
	char szTmp[64];

	int protoCount;
	PROTOACCOUNT **pp;
	if ( CallService(MS_PROTO_ENUMACCOUNTS, WPARAM(&protoCount), LPARAM(&pp)) == 0 && protoCount != 0) {
		spi.pid = GetCurrentProcessId();
		while (protoCount > 0) {
			PROTOACCOUNT *pa = *pp;
			lstrcpyA(szTmp, pa->szModuleName);
			lstrcatA(szTmp, PS_GETCAPS);
			DWORD dwCaps = CallService(szTmp, PFLAGNUM_1, 0);
			if (dwCaps & PF1_FILESEND) {
				TSlotIPC *pct = ipcAlloc(ipch, sizeof(TSlotProtoIcons));
				if (pct != NULL) {
					// capture all the icons!
					spi.hProto = murmur_hash(pa->szModuleName);
					for (int j = 0; j <= 10; j++)
						spi.hIcons[j] = LoadSkinnedProtoIcon(pa->szModuleName, ID_STATUS_OFFLINE + j);

					pct->fType = REQUEST_NEWICONS;
					memcpy(LPSTR(pct) + sizeof(TSlotIPC), &spi, sizeof(TSlotProtoIcons));
					if (ipch->NewIconsBegin == NULL)
						ipch->NewIconsBegin = pct;
				}
			}
			pp++;
			protoCount--;
		}
	}

	// add Miranda icon
	TSlotIPC *pct = ipcAlloc(ipch, sizeof(TSlotProtoIcons));
	if (pct != NULL) {
		ZeroMemory(&spi.hIcons, sizeof(spi.hIcons));
		spi.hProto = 0; // no protocol
		spi.hIcons[0] = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
		pct->fType = REQUEST_NEWICONS;
		memcpy(LPSTR(pct) + sizeof(TSlotIPC), &spi, sizeof(TSlotProtoIcons));
		if (ipch->NewIconsBegin == NULL)
			ipch->NewIconsBegin = pct;
	}
}
Exemple #26
0
void TwitterProto::UpdateSettings()
{
	if (getByte(TWITTER_KEY_CHATFEED)) {
		if (!in_chat_)
			OnJoinChat(0, 0);
	}
	else {
		if (in_chat_)
			OnLeaveChat(0, 0);

		for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) {
			MCONTACT hNext = db_find_next(hContact, m_szModuleName);
			if (isChatRoom(hContact))
				CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
			hContact = hNext;
		}
	}
}
// This is a duplication of TrayIcon::SendMessage().  There is a race condition
// that can occur with DoTimer if TrayIcon::SendMessage() is called at the
// time that TrayIcon is being destroyed.
BOOL Balloon::SendMessage(LPARAM lParam)
{
  if (trayIconVersion == NOTIFYICON_VERSION_4)
  {
    POINT messagePt;

    messagePt.x = trayIconRect.left;
    messagePt.y = trayIconRect.top;
    ClientToScreen(balloonWnd, &messagePt);

    return SendNotifyMessage(trayIconWnd, trayIconCallbackMessage,
                             MAKEWPARAM(messagePt.x, messagePt.y),
                             MAKELPARAM(lParam, trayIconID));
  }

  return SendNotifyMessage(trayIconWnd, trayIconCallbackMessage,
                           WPARAM(trayIconID), lParam);
}
Exemple #28
0
void CScrollerCorner::OnLButtonDown(wxMouseEvent &event)
{
#ifdef GERRYXXX
	CWnd::OnLButtonDown(nFlags, pt);

	CWnd* pParent = GetParent();
	CRect rWin;
	pParent->GetWindowRect(&rWin);

	// calc screen coords of bottom-right frame corner
	pt.x = rWin.Width() - 1;
	pt.y = rWin.Height() - 1;
	pParent->ClientToScreen(&pt);

	pParent->SendMessage(WM_NCLBUTTONDOWN, WPARAM(HTSIZE),
						 MAKELPARAM(WORD(pt.x), WORD(pt.y)));
#endif
}
Exemple #29
0
void CBroadcastDlg::OnOK()
{
	// TODO: 在此添加专用代码和/或调用基类

	UpdateData();
	if (m_Info != "")
	{
		m_Broadcast_t.iUserID = 0;
		strcpy(m_Broadcast_t.szMsg, m_Info.GetBuffer());
		AfxGetMainWnd()->PostMessage(MSG_CMD_BROADCAST, WPARAM(&m_Broadcast_t), 0);
		m_Info = "";
		UpdateData(false);
		CDialog::OnOK();
	}
	else 
	{
		AfxMessageBox("公告内容不能为空!");
	}
}
Exemple #30
0
void CDateTimeCtrlEx::CreateControls()
{
	RECT rcClientRect;
	GetClientRect(&rcClientRect);
	DWORD dwStyle=WS_GROUP | WS_TABSTOP | WS_CHILD;
	if (GetStyle()&WS_DISABLED)
		dwStyle|=WS_DISABLED;

	if (m_hTheme!=NULL && m_pDrawThemeBackground!=NULL)
		rcClientRect.right-=BUTTON_WIDTHTHEME;
	else
		rcClientRect.right-=BUTTON_WIDTHORIG;

	if (m_hTimePickerWnd==NULL)
	{
		m_hTimePickerWnd=CreateWindowEx(WS_EX_NOPARENTNOTIFY|WS_EX_CLIENTEDGE,
			"SysDateTimePick32","",dwStyle|DTS_RIGHTALIGN|WS_VISIBLE,
			rcClientRect.left,rcClientRect.top,rcClientRect.right,rcClientRect.bottom,
			*this,(HMENU)IDC_EXPLICITIDATE,GetInstanceHandle(),NULL);
	}
	if (m_hEditWnd==NULL)
	{
		m_hEditWnd=CreateWindowEx(WS_EX_NOPARENTNOTIFY|WS_EX_CLIENTEDGE|WS_EX_RIGHT,
			"EDIT","",dwStyle|ES_AUTOHSCROLL|ES_NUMBER,
			rcClientRect.left,rcClientRect.top,rcClientRect.right,rcClientRect.bottom,
			*this,(HMENU)IDC_RELATIVEDATE,GetInstanceHandle(),NULL);
	}
	if (m_hSpinWnd==NULL)
	{
		m_hSpinWnd=CreateWindowEx(WS_EX_NOPARENTNOTIFY|WS_EX_CLIENTEDGE|WS_EX_RIGHT,
			"msctls_updown32","",dwStyle|UDS_ALIGNRIGHT|UDS_ARROWKEYS,
			rcClientRect.left,rcClientRect.top,rcClientRect.right,rcClientRect.bottom,
			*this,(HMENU)IDC_RELATIVEDATESPIN,GetInstanceHandle(),NULL);
		::SendMessage(m_hSpinWnd,UDM_SETBUDDY,WPARAM(m_hEditWnd),0);
		::SendMessage(m_hSpinWnd,UDM_SETRANGE,0,UD_MAXVAL);
	}

	
	SetRelativeDate(0,DTXF_NOMODECHANGE);

	m_dwFlags&=~DontSendNotifications;
}