• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AfxGetMainWnd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AfxGetMainWnd

//叫分按钮
void CGameClientView::OnBrightCard()
{
	AfxGetMainWnd()->SendMessage(IDM_LAND_SCORE,5,5);
	return;
}
开发者ID:Michael-Z,项目名称:qipai-game,代码行数:6,代码来源:GameClientView.cpp


示例2: switch


//.........这里部分代码省略.........

			return true;
		}
	case SUB_GP_LOGON_ERROR:		//登录失败
		{
			//效验参数
			CMD_GP_LogonError *pLogonError = (CMD_GP_LogonError *)pData;
			ASSERT(wDataSize>=(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe)));
			if (wDataSize<(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe))) return false;

			//关闭连接
			g_GlobalAttemper.DestroyStatusWnd(this);
			m_ClientSocket->CloseSocket();

			//显示消息
			WORD wDescribeSize=wDataSize-(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe));
			if (wDescribeSize>0)
			{
				pLogonError->szErrorDescribe[wDescribeSize-1]=0;
				ShowMessageBox(pLogonError->szErrorDescribe,MB_ICONINFORMATION);
			}

			//发送登录
			SendLogonMessage();

			return true;
		}
	case SUB_GP_LOGON_FINISH:		//登录完成
		{
			//关闭提示
			g_GlobalAttemper.DestroyStatusWnd(this);

			//展开类型
			INT_PTR nIndex=0;
			CListType * pListType=NULL;
			do
			{
				pListType=g_GlobalUnits.m_ServerListManager.EnumTypeItem(nIndex++);
				if (pListType==NULL) break;
				g_GlobalUnits.m_ServerListManager.ExpandListItem(pListType);
			} while (true);

			//展开列表
			nIndex=0;
			CListInside * pListInside=NULL;
			do
			{
				pListInside=g_GlobalUnits.m_ServerListManager.EnumInsideItem(nIndex++);
				if (pListInside==NULL) break;
				g_GlobalUnits.m_ServerListManager.ExpandListItem(pListInside);
			} while (true);

			//记录信息
			m_bLogonPlaza=true;
			m_DlgLogon.OnLogonSuccess();
			m_pHtmlBrower->EnableBrowser(true);

			//记录信息
			g_GlobalUnits.WriteUserCookie();

			//显示头像
			((CGameFrame*)AfxGetMainWnd())->m_UserInfoView.ShowUserInfo(true);

			//自定义判断
			tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();
			if ( GlobalUserData.dwCustomFaceVer!=0)
			{
				//头像名称
				CString strDirName = CString(g_GlobalUnits.GetWorkDirectory()) + TEXT("\\CustomFace");
				CString strFileName;
				strFileName.Format(TEXT("\\%ld_%d.bmp"), GlobalUserData.dwUserID, GlobalUserData.dwCustomFaceVer);

				//读取文件
				CImage FaceImage;
				HRESULT hResult = FaceImage.Load(strDirName + strFileName);
				if (SUCCEEDED(hResult))
				{
					//关闭连接
					m_ClientSocket->CloseSocket();

					FaceImage.Destroy();
				}
				//下载头像
				else
				{
					PostMessage(WM_DOWN_LOAD_FACE, LPARAM(GlobalUserData.dwCustomFaceVer), WPARAM(GlobalUserData.dwUserID));
				}
			}
			else
			{
				//关闭连接
				m_ClientSocket->CloseSocket();
			}

			return true;
		}
	}

	return true;
}
开发者ID:codercold,项目名称:whgame,代码行数:101,代码来源:PlazaViewItem.cpp


示例3: ASSERT

//用户消息
bool CPlazaViewItem::OnSocketMainUser(CMD_Command Command, void * pBuffer, WORD wDataSize)
{
	ASSERT(Command.wMainCmdID == MDM_GP_USER);
	switch(Command.wSubCmdID)
	{
	case SUB_GP_USER_DOWNLOAD_FACE:			//下载头像
		{
			//类型转换
			CMD_GP_DownloadFaceSuccess *pDownloadFaceSuccess = (CMD_GP_DownloadFaceSuccess*)pBuffer;

			//参数验证
			WORD wSendSize = WORD(pDownloadFaceSuccess->dwCurrentSize + sizeof(CMD_GP_DownloadFaceSuccess) - sizeof(pDownloadFaceSuccess->bFaceData));
			ASSERT(wDataSize == wSendSize);
			if ( wDataSize != wSendSize ) return false;

			//第一次判断
			if ( m_CustomFace.pFaceData == NULL )
			{
				if ( m_CustomFace.pFaceData != NULL ) delete[] m_CustomFace.pFaceData;
				m_CustomFace.pFaceData = new BYTE[pDownloadFaceSuccess->dwToltalSize];
				if ( m_CustomFace.pFaceData == NULL ) return true;
				m_CustomFace.dwFaceSize = pDownloadFaceSuccess->dwToltalSize;
				m_CustomFace.dwUserID = pDownloadFaceSuccess->dwUserID;
			}

			//拷贝数据
			CopyMemory(m_CustomFace.pFaceData+m_CustomFace.dwCurrentSize, pDownloadFaceSuccess->bFaceData, pDownloadFaceSuccess->dwCurrentSize);
			m_CustomFace.dwCurrentSize += pDownloadFaceSuccess->dwCurrentSize;

			//下载完毕
			if ( m_CustomFace.dwFaceSize == m_CustomFace.dwCurrentSize )
			{
				tagDownloadInfo &DownloadInfo = m_DownloadInfoArrary[0];

				//创建目录
				CString strDirName = CString(g_GlobalUnits.GetWorkDirectory()) + TEXT("\\CustomFace");
				CreateDirectory(strDirName, NULL) ;

				//写入文件
				CFile fileFace;
				CString strZipFileName, strBmpFileName;
				strZipFileName.Format(TEXT("\\%ld_%d.zip"), DownloadInfo.dwUserID, DownloadInfo.bFaceVer);
				strBmpFileName.Format(TEXT("\\%ld_%d.bmp"), DownloadInfo.dwUserID, DownloadInfo.bFaceVer);
				if ( fileFace.Open(strDirName + strZipFileName, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary) )
				{
					fileFace.Write(m_CustomFace.pFaceData, m_CustomFace.dwFaceSize);
					fileFace.Close();

					//解压文件
					CUnzip oUnzip( strDirName + strZipFileName );
					oUnzip.SwapSize( strDirName + strBmpFileName );

					//删除文件
					CFile::Remove(strDirName + strZipFileName);
				}

				//自己判断
				tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();
				if ( GlobalUserData.dwUserID ==  DownloadInfo.dwUserID )
				{
					//更新界面
					((CGameFrame*)AfxGetMainWnd())->m_UserInfoView.UpdateUserInfo();
				}

				//重置变量
				m_CustomFace.Clear();

				//删除元素
				m_DownloadInfoArrary.RemoveAt(0);

				//继续判断
				if ( 0 < m_DownloadInfoArrary.GetCount() )
				{
					//状态判断
					if ( m_ClientSocket->GetSocketStatus() != SOCKET_STATUS_CONNECT )
					{
						//链接网络
						if ( ! ConnectServer() ) return true;

						//设置标识
						m_bDownloadConnect = true;
					}

					//投递请求
					tagDownloadInfo &DownloadInfo = m_DownloadInfoArrary[0];

					CMD_GP_DownloadFace DownloadFace;
					DownloadFace.dwUserID = DownloadInfo.dwUserID;
					m_ClientSocket->SendData(MDM_GP_USER, SUB_GP_USER_DOWNLOAD_FACE, &DownloadFace, sizeof(DownloadFace));
				}
				else
				{
					//关闭链接
					m_ClientSocket->CloseSocket();

					//设置变量
					m_bStartDownloadFace=false;
				}
			}
//.........这里部分代码省略.........
开发者ID:codercold,项目名称:whgame,代码行数:101,代码来源:PlazaViewItem.cpp


示例4: ThreadFun

// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
UINT ThreadFun(LPVOID pParam){  //线程要调用的函数
   WSADATA wsd;
   int len=sizeof(struct sockaddr_in);
   int ret;
	TCHAR recvbuf[BUFSIZE];
   if(WSAStartup(MAKEWORD(2,2),&wsd)!=0)
   {
	   printf("WSAStartup()failed\n");
	   return -1;
   }
   if((sock=WSASocket(AF_INET,SOCK_DGRAM,0,NULL,0,
	   WSA_FLAG_MULTIPOINT_C_LEAF|WSA_FLAG_MULTIPOINT_D_LEAF|
	   WSA_FLAG_OVERLAPPED))==INVALID_SOCKET)
   {
	   printf("socket failed with :%d\n",WSAGetLastError());
	   WSACleanup();
	   return -1;
   }
   //将sock绑定到本机端口上
   local.sin_family=AF_INET;
   local.sin_port=htons(MCASTPORT);
   local.sin_addr.s_addr=INADDR_ANY;

   if(bind(sock,(struct sockaddr*)&local,sizeof(local))==SOCKET_ERROR)
   {
	   printf("bind failed with %d\n",WSAGetLastError());
	   closesocket(sock);
	   WSACleanup();
	   return -1;
   
   
   }
   //加入多播组

   remote.sin_family=AF_INET;
   remote.sin_port=htons(MCASTPORT);
   remote.sin_addr.s_addr=inet_addr(MCASTADDR);

   if((sockM=WSAJoinLeaf(sock,(SOCKADDR*)&remote,sizeof(remote),
	   NULL,NULL,NULL,NULL,
	   JL_BOTH))==INVALID_SOCKET)
   {
     printf("WSAJoinLeaf()failed:%d\n",WSAGetLastError());
     closesocket(sock);
	 WSACleanup();
	 return -1;
   }
   //接收多播数据,当收到的数据为QUIT时退出

   while(1)
   {
	   if((ret=recvfrom(sock,recvbuf,BUFSIZE,0,
		   (struct sockaddr*)&from,&len))==SOCKET_ERROR)
	   {
		   //printf("recvfrom failed with :%d\n",WSAGetLastError());
		   closesocket(sockM);
		   closesocket(sock);
		   WSACleanup();
		   return -1;
	   }
	   if(strcmp(recvbuf,"QUIT")==0)  break;
	   else{
		   recvbuf[ret]='\0';
		   Str+=inet_ntoa(from.sin_addr);
		   Str+=":";
		   Str+=recvbuf;
		   Str+="\r\n";
		   HWND hWnd = GetDlgItem(AfxGetMainWnd()->m_hWnd,IDC_EDIT1);
		   CWnd *pWnd = CWnd::FromHandle(hWnd);
		   pWnd->SetWindowText(_T(Str));

	   }
   }

   closesocket(sockM);
   closesocket(sock);
   WSACleanup();
   return 0;
}
开发者ID:SilentTTxo,项目名称:CurriculumDesign,代码行数:80,代码来源:Ip3Dlg.cpp


示例5: OnEditPaste

void CDataView::OnEditPaste() 
{
	m_Grid.OnEditPaste();
	CGAMDoc *pDoc = (CGAMDoc*)(((CMainFrame *)AfxGetMainWnd())->GetActiveDocument());
	pDoc->SetModifiedFlag();
}
开发者ID:WisemanLim,项目名称:femos,代码行数:6,代码来源:DataView.cpp


示例6: AfxGetMainWnd

void CFMDischargedPaidPatientListByDay::OnDeptListSelectChange(int nOldItem, int nNewItem){
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	
} 
开发者ID:smithgold53,项目名称:HMSReportForms,代码行数:4,代码来源:FMDischargedPaidPatientListByDay.cpp


示例7: AfxGetMainWnd

void CMyClientMainView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	*pResult = 0;
	AfxGetMainWnd()->PostMessage
		(WM_CLIENTMAINRCLICK,IDR_MENU_CLIENT_MANAGER,NULL);
}
开发者ID:lzm-cn,项目名称:PCShare,代码行数:6,代码来源:MyClientMainView.cpp


示例8: CreateRect

//建立消息
int CGameClientView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (__super::OnCreate(lpCreateStruct)==-1) return -1;

	//创建控件
	CRect CreateRect(0,0,0,0);

	//创建扑克
	for (WORD i=0;i<3;i++)
	{
		//用户扑克
		if ( i == 1 )
			m_UserCardControl[i].SetDirection(true);
		else
			m_UserCardControl[i].SetDirection(false);
			
		m_UserCardControl[i].SetDisplayFlag(true);	
		m_UserCardControl[i].SetCardSpace( 16, 20, 16 );

		m_UserCardControl[i].Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,20+i);

		//用户扑克
		if (i!=1)
		{
			m_HandCardControl[i].SetCardSpace(0,18,0);
			m_HandCardControl[i].SetDirection(false);
			m_HandCardControl[i].SetDisplayFlag(false);
			m_HandCardControl[i].Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,30+i);
		}
		else
		{
			m_HandCardControl[i].SetDirection(true);
			m_HandCardControl[i].SetDisplayFlag(false);
			m_HandCardControl[i].Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,30+i);
		}
	}

	//设置扑克
	m_BackCardControl.SetCardSpace(85,0,0);
	m_BackCardControl.SetDisplayFlag(false);
	m_HandCardControl[1].SetSinkWindow(AfxGetMainWnd());
	m_BackCardControl.Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,41);

	//创建按钮
	m_btStart.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_START);
	m_btOutCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_OUT_CARD);
	m_btPassCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_PASS_CARD);
	m_btOneScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_ONE_SCORE);
	m_btTwoScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_TWO_SCORE);
	m_btGiveUpScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_GIVE_UP_SCORE);
	m_btAutoOutCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_AUTO_OUTCARD);
	m_btThreeScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_THREE_SCORE);
	m_btAutoPlayOn.Create(TEXT(""), WS_CHILD ,CreateRect,this,IDC_AUTOPLAY_ON);
	m_btAutoPlayOff.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_AUTOPLAY_OFF);
	m_btSortCard.Create(NULL,WS_CHILD|WS_DISABLED|WS_VISIBLE,CreateRect,this,IDC_SORT_CARD);

	//扩展按钮
	m_btSnatchLand.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_SNATCH_LAND);
	m_btBrightCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_BRIGHT_CARD);	
	m_btBrightStart.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_BRIGHT_START);
	m_btDoubleScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_DOUBLE_SCORE);
	m_btNotDoubleScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_NOT_DOUBLE_SCORE);
    
	//设置按钮
	HINSTANCE hInstance=AfxGetInstanceHandle();
	m_btStart.SetButtonImage(IDB_START,hInstance,false);
	m_btOutCard.SetButtonImage(IDB_OUT_CARD,hInstance,false);
	m_btPassCard.SetButtonImage(IDB_PASS,hInstance,false);
	m_btOneScore.SetButtonImage(IDB_ONE_SCORE,hInstance,false);
	m_btTwoScore.SetButtonImage(IDB_TWO_SCORE,hInstance,false);
	m_btGiveUpScore.SetButtonImage(IDB_GIVE_UP,hInstance,false);
	m_btAutoOutCard.SetButtonImage(IDB_AUTO_OUT_CARD,hInstance,false);
	m_btThreeScore.SetButtonImage(IDB_THREE_SCORE,hInstance,false);
	m_btAutoPlayOn.SetButtonImage  (IDB_AUTOPLAY_ON,hInstance,false);
	m_btAutoPlayOff.SetButtonImage (IDB_AUTOPLAY_OFF,hInstance,false);
	m_btSortCard.SetButtonImage(IDB_COUNT_SORT,hInstance,false);
	m_btSnatchLand.SetButtonImage(IDB_SNATCH_LAND,hInstance,false);
	m_btBrightCard.SetButtonImage(IDB_BRIGHT_CARD,hInstance,false);
	m_btBrightStart.SetButtonImage(IDB_BRIGHT_CARD_START, hInstance, false);
	m_btDoubleScore.SetButtonImage(IDB_DOUBLE_SCORE, hInstance, false);
	m_btNotDoubleScore.SetButtonImage(IDB_NOT_DOUBLE_SCORE, hInstance, false);
    
    m_btAutoPlayOn.ShowWindow(SW_SHOW);
    m_btAutoPlayOff.ShowWindow(SW_HIDE);

	//创建控件
	m_ScoreView.Create(IDD_GAME_SCORE,this);

	//隐藏扑克
	//m_HandCardControl[ 0 ].ShowWindow( SW_HIDE );
	//m_HandCardControl[ 2 ].ShowWindow( SW_HIDE );

#ifdef VIDEO_GAME

	//创建视频
	for (WORD i=0; i<GAME_PLAYER; i++)
	{
		//创建视频
		m_DlgVedioService[i].Create(NULL,NULL,WS_CHILD|WS_VISIBLE,CreateRect,this,200+i);
//.........这里部分代码省略.........
开发者ID:Michael-Z,项目名称:qipai-game,代码行数:101,代码来源:GameClientView.cpp


示例9: UNREFERENCED_PARAMETER


//.........这里部分代码省略.........
		{
			CPen line(PS_INSIDEFRAME, 1, bkg);
			CPen* old = dc.SelectObject(&line);
			dc.MoveTo( cur , r.top );
			dc.LineTo( r.right, r.top );
			dc.MoveTo( cur , r.top + CORBARS - 1);
			dc.LineTo( r.right, r.top + CORBARS - 1);
		}
		CRect rFilled(r);
		rFilled.left =   cur;
		rFilled.top++;
		rFilled.bottom--;
		dc.FillSolidRect(&rFilled,  havntplayed ); //fEnabled ?
		
		//r = GetChannelRect();
		for(int i = 0; i < CORBARS ; i++){
			CPen line(PS_INSIDEFRAME, 1, Bars[i]);
			CPen* old = dc.SelectObject(&line);
			dc.MoveTo( r.left , r.top + i);
			dc.LineTo( cur, r.top + i);
		}

		{
			COLORREF P2 = s.GetColorFromTheme(_T("SeekBarBorder1"), 0x000d3324);
			COLORREF P1 = s.GetColorFromTheme(_T("SeekBarBorder2"),0x00091611);
			dc.SetPixel(r.left-1, r.top+1, P2);
			dc.SetPixel(r.left, r.top, P2);
			dc.SetPixel(r.left-1, r.bottom-2, P2);
			dc.SetPixel(r.left, r.bottom-1, P2);
			dc.SetPixel(cur+1, r.top+1, P2);
			dc.SetPixel(cur, r.top, P2);
			dc.SetPixel(cur+1, r.bottom-2, P2);
			dc.SetPixel(cur, r.bottom-1, P2);
			dc.SetPixel(cur+1, r.top, P1);
			dc.SetPixel(cur+1, r.bottom-1, P1);
			dc.SetPixel(r.left-1, r.top, P1);
			dc.SetPixel(r.left-1, r.bottom-1, P1);

			CPen line(PS_INSIDEFRAME, 1, Bars[0]);
			CPen* old = dc.SelectObject(&line);

			dc.MoveTo( r.left-1 , r.top + 2);
			dc.LineTo( r.left-1 , r.bottom-2);
			dc.MoveTo( cur+1 , r.top + 2);
			dc.LineTo( cur+1 , r.bottom-2);
		}

		CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
		if( pFrame->m_aRefTime > 0){
			CRect rFilled(r);
			
			rFilled.left += (__int64)r.Width() * (pFrame->m_aRefTime - m_start) / (m_stop - m_start) ;
			if( pFrame->m_aRefTime < pFrame->m_bRefTime )
				rFilled.right = r.left + (__int64)r.Width() * (pFrame->m_bRefTime - m_start) / (m_stop - m_start) ;
			else
				rFilled.right = rFilled.left + 1;

			rFilled.top+=2;
			rFilled.bottom-=2;

			CBrush nBrush(HS_DIAGCROSS,  s.GetColorFromTheme(_T("SeekBarABArea"), 0x003fff9a ));
			dc.FillRect(&rFilled,&nBrush ); //fEnabled ?
		}
		
		/*
		switch( cur % 4 ){
					case 3:
						cur--;
						break;
					case 2:
						cur+=2;
						break;
					case 1:
						cur++;
						break;
				}
				for(int drawPos = cur ; drawPos < r.right; drawPos +=2){
					CRect step(drawPos,r.top, drawPos+2, r.bottom);
					if(drawPos % 4){
						dc.FillSolidRect( &step, NEWUI_COLOR_TOOLBAR_UPPERBG);
					}else{
						dc.FillSolidRect( &step, white);
					}
				}*/
		
		//r.InflateRect(1, 1);
		//dc.Draw3dRect(&r, shadow, light);
		dc.ExcludeClipRect(&r);
	}

	// background
	{
		CRect r;
		GetClientRect(&r);
		dc.FillRect(&r, &bBkg);
	}


	// Do not call CDialogBar::OnPaint() for painting messages
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:101,代码来源:PlayerSeekBar.cpp


示例10: GetCursorPos

void CPlayerSeekBar::SetTimecodeTip(){
	CString toolTip;
	CPoint point , screenPos;
	GetCursorPos(&point);
	screenPos = point;
	ScreenToClient(&point);
	CRect rcClient;
	if( !rcClient.PtInRect(point)){

		//return;
	}
	CRect r = GetChannelRect();

	if(r.left <= r.right){

		__int64 mPos = 0;
		if(point.x < r.left) mPos = m_start;
		else if(point.x >= r.right) mPos = m_stop;
		else
		{
			__int64 w = r.right - r.left;
			if(m_start < m_stop)
				mPos = (m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
		}
		DVD_HMSF_TIMECODE tcNow = RT2HMSF(mPos);

		if( tcNow.bHours > 0)
			toolTip.Format(_T("%02d:%02d:%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
		else 
			toolTip.Format(_T("%02d:%02d"), tcNow.bMinutes, tcNow.bSeconds);


		//AfxMessageBox(toolTip);
		//if(toolTip.IsEmpty())
		//	toolTip = _T("Unkown");

		if(!toolTip.IsEmpty()){
			CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
			pFrame->m_tip.m_text = toolTip;
			CSize tipsize = pFrame->m_tip.CountSize();
			point = screenPos;
			CRect rcTip ( point.x - tipsize.cx/2 , point.y - tipsize.cy - 6,point.x + tipsize.cx/2 , point.y -  6);
			//SVP_LogMsg5(_T("Tip %d %d %d %d") , rcTip.left,rcTip.top , rcTip.right,rcTip.left);

			HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);

			MONITORINFO mi;
			mi.cbSize = sizeof(MONITORINFO);
			GetMonitorInfo(hMonitor, &mi);

			if(rcTip.left < mi.rcWork.left){
				rcTip.MoveToX(mi.rcWork.left + 3);
			}else if(rcTip.right > mi.rcWork.right){
				rcTip.MoveToX(mi.rcWork.right - rcTip.Width() - 3);
			}

			pFrame->m_tip.MoveWindow( rcTip );
			pFrame->m_tip.ShowWindow(SW_SHOWNOACTIVATE);
			pFrame->m_tip.Invalidate();
		}
	}
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:62,代码来源:PlayerSeekBar.cpp


示例11: GetParentFrame

void CUserListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	//		make sure window is active
	//
	GetParentFrame()->ActivateFrame();


	///////////////////////////////
	// See ContextMenuRules.txt for order of menu commands!

	//		create an empty context menu
	//
	CP4Menu popMenu;
    popMenu.LoadMenu(IDR_USER);

	int	index;
    SetIndexAndPoint( index, point );

	if( index != -1 )
	{
		// Can only edit or delete my user
		if ( GetSelectedItemText( ) == GET_P4REGPTR( )->GetP4User( ) )
		{
            // can't switch if already there
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_SWITCHTOUSER,MF_BYCOMMAND);
        }
        else
        {
            // can't edit, delete, set password or set as default if not current
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_EDITMY,MF_BYCOMMAND);
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_DELETE,MF_BYCOMMAND);
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_PASSWORD,MF_BYCOMMAND);
            popMenu.GetSubMenu(0)->DeleteMenu(ID_SETDEFUSER,MF_BYCOMMAND);
        }
	}
    else
    {
        // can't do much if no user selected
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_EDITMY,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_DESCRIBE,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_DELETE,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_SWITCHTOUSER,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_PASSWORD,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_SETDEFUSER,MF_BYCOMMAND);
        // clobber extra separator
        popMenu.GetSubMenu(0)->DeleteMenu(1,MF_BYPOSITION);

    }

	MainFrame()->AddToolsToContextMenu((CP4Menu *)(popMenu.GetSubMenu(0)));

	popMenu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,	point.x, point.y, AfxGetMainWnd());
}
开发者ID:danieljennings,项目名称:p4win,代码行数:53,代码来源:UserListCtrl.cpp


示例12: CreateLoadDialog

bool MeaPositionLogMgr::Load(LPCTSTR pathname)
{
    // If there is a modified set of positions, ask the user if
    // they should be saved before loading a new set.
    //
    if (!SaveIfModified()) {
        return false;
    }

    if (pathname != NULL) {
        m_pathname = pathname;
    } else {
        CFileDialog *dlg = CreateLoadDialog();

        if (dlg->DoModal() != IDOK) {
            return false;
        }
        m_pathname = dlg->GetPathName();
    }

    bool status = false;
    TCHAR drive[_MAX_DRIVE];
    TCHAR dir[_MAX_DIR];

    //
    // Remember the directory for persisting.
    //
    _tsplitpath_s(m_pathname, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL, 0, NULL, 0);
    m_initialDir = drive;
    m_initialDir += dir;

    //
    // Load the positions
    //
    if (Open(m_pathname, CFile::modeRead)) {
        //
        // Delete old positions.
        //
        ClearPositions();
    
        //
        // Parse the contents of the log file
        //
        MeaXMLParser parser(this, true);

        try {
            UINT numBytes;

            do {
                void *buf = parser.GetBuffer(kChunkSize);
                numBytes = m_stdioFile.Read(buf, kChunkSize);
                parser.ParseBuffer(numBytes, numBytes == 0);
            } while (numBytes > 0);

            status = true;
        } catch (MeaXMLParserException&) {
            // Handled by the parser.
        } catch (MeaLogFileException&) {
            CString msg(reinterpret_cast<LPCSTR>(IDS_MEA_INVALID_LOGFILE));
            MessageBox(*AfxGetMainWnd(), msg, NULL, MB_OK | MB_ICONERROR);
        } catch (...) {
            CString msg(reinterpret_cast<LPCSTR>(IDS_MEA_NO_POSITIONS));
            MessageBox(*AfxGetMainWnd(), msg, NULL, MB_OK | MB_ICONERROR);
        }

        Close();

        if (status) {
            //
            // Process the log file DOM
            //
            ProcessDOM(parser.GetDOM());

            m_modified = false;

            if (m_observer != NULL) {
                m_observer->LogLoaded();
            }
        }
    } else {
        m_pathname.Empty();
    }

    return status;
}
开发者ID:craigshaw,项目名称:Meazure,代码行数:85,代码来源:PositionLogMgr.cpp


示例13: GetAbsPosition

// Resize parent 
void CSplitterFrame::UpdateParent()
{
  CRect rcParent;
  CRect rcMainFrame;
  CRect rcMainClientFrame;
  CPoint pt = GetAbsPosition();
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());

  
  CDlgTemplate &wndParent = *(CDlgTemplate*)GetParent();
  pMainFrame->GetClientRect(&rcMainClientFrame);
  pMainFrame->GetWindowRect(&rcMainFrame);

  pt.x -=rcMainFrame.left;
  pt.y -=rcMainFrame.top;

  wndParent.GetWindowRect(&rcParent);
  wndParent.ShowWindow(SW_HIDE);


  INDEX iWidth = rcParent.right - rcParent.left;
  INDEX iHeight = rcParent.bottom - rcParent.top;

  if(sp_bDockingEnabled) {
    pMainFrame->FloatControlBar(&wndParent,CPoint(rcParent.left,rcParent.top));
    // is splitter attached on left side
    if(sp_uiDockSide == AFX_IDW_DOCKBAR_LEFT) {
      SET_BAR_SIZE(wndParent,rcMainClientFrame.right - pt.x,iHeight);
    // is splitter attached on right side
    } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_RIGHT) {
      SET_BAR_SIZE(wndParent,pt.x,iHeight);
    // is splitter attached on top side
    } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_TOP) {
      SET_BAR_SIZE(wndParent,iWidth,iHeight + sp_ptStartPoint.y - pt.y);
    // is splitter attached on bottom side
    } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_BOTTOM) {
      ASSERT(FALSE);
    }

    // Chose docking side
    INDEX iDockSide = 0;
    // is splitter attached on left side
    if(sp_uiDockSide==AFX_IDW_DOCKBAR_LEFT) {
      iDockSide = AFX_IDW_DOCKBAR_RIGHT;
    // is splitter attached on right side
    } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_RIGHT) {
      iDockSide = AFX_IDW_DOCKBAR_LEFT;
    // is splitter attached on top side
    } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_TOP) {
      iDockSide = AFX_IDW_DOCKBAR_BOTTOM;
    // is splitter attached on bottom side
    } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_BOTTOM) {
      iDockSide = AFX_IDW_DOCKBAR_TOP;
    }
    pMainFrame->DockControlBar(&wndParent,iDockSide);
  } else {
      SET_BAR_SIZE(wndParent,300,300);
    // wndParent.SetWindowPos(&wndBottom,0,0,100,300,SWP_NOZORDER);
    //pMainFrame->FloatControlBar(&wndParent,CPoint(rcParent.left,rcParent.top));
    //pMainFrame->DockControlBar(&wndParent,AFX_IDW_DOCKBAR_BOTTOM);
  }
  


  wndParent.ShowWindow(SW_SHOW);
  wndParent.UpdateWindow();
}
开发者ID:EgoIncarnate,项目名称:Serious-Engine,代码行数:68,代码来源:SplitterFrame.cpp


示例14: GetDocument

void COpenScrapeView::OnDraw(CDC* pDC)
{
	COpenScrapeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	CPen		*pTempPen, oldpen;
	CBrush		*pTempBrush, oldbrush;	
	HDC			hdc = *pDC;
	HDC			hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); 
	HDC			hdcCompatible = CreateCompatibleDC(hdcScreen);
	HBITMAP		hbmp = CreateCompatibleBitmap(hdcScreen, 
										      pDoc->attached_rect.right - pDoc->attached_rect.left, 
										      pDoc->attached_rect.bottom - pDoc->attached_rect.top);
	HBITMAP		old_bitmap1, old_bitmap2;
	CMainFrame	*pmyframe = (CMainFrame*)AfxGetMainWnd(); 
	RECT		crect;

	// Draw attached window's bitmap as background
	if (pDoc->attached_bitmap)
	{
		old_bitmap1 = (HBITMAP) SelectObject(hdcCompatible, pDoc->attached_bitmap);
		old_bitmap2 = (HBITMAP) SelectObject(hdc, hbmp);
		BitBlt(hdc, 0, 0,
			   pDoc->attached_rect.right - pDoc->attached_rect.left,
			   pDoc->attached_rect.bottom - pDoc->attached_rect.top,
			   hdcCompatible, 0, 0, SRCCOPY);
		SelectObject(hdc, old_bitmap2);
		SelectObject(hdcCompatible, old_bitmap1);
	}
	else
	{
		pTempPen = (CPen*)pDC->SelectObject(null_pen);
		oldpen.FromHandle((HPEN)pTempPen);
		pTempBrush = (CBrush*)pDC->SelectObject(white_brush);
		oldbrush.FromHandle((HBRUSH)pTempBrush);

		GetClientRect(&crect);
		pDC->Rectangle(&crect);

		pDC->SelectObject(oldpen);
		pDC->SelectObject(oldbrush);
	}

	// Draw all region rectangles
	if (pmyframe->show_regions)
	{
		for (RMapCI r_iter=p_tablemap->r$()->begin(); r_iter!=p_tablemap->r$()->end(); r_iter++)
		{
			if ( (r_iter->second.name==dragged_region && dragging) || 
				 (r_iter->second.name==drawrect_region && drawing_rect && drawing_started) )
			{
				// Set pen and brush
				pTempPen = (CPen*)pDC->SelectObject(black_dot_pen);
				oldpen.FromHandle((HPEN)pTempPen);
				pTempBrush = (CBrush*)pDC->SelectObject(GetStockObject(NULL_BRUSH));
				oldbrush.FromHandle((HBRUSH)pTempBrush);

				pDC->Rectangle(r_iter->second.left-1, r_iter->second.top-1, r_iter->second.right+2, r_iter->second.bottom+2);

				pDC->SelectObject(oldpen);
				pDC->SelectObject(oldbrush);
			}

			else
			{
				// Set pen and brush
				pTempPen = (CPen*)pDC->SelectObject(red_pen);
				oldpen.FromHandle((HPEN)pTempPen);
				pTempBrush = (CBrush*)pDC->SelectObject(GetStockObject(NULL_BRUSH));
				oldbrush.FromHandle((HBRUSH)pTempBrush);

				pDC->Rectangle(r_iter->second.left-1, r_iter->second.top-1, r_iter->second.right+2, r_iter->second.bottom+2);

				pDC->SelectObject(oldpen);
				pDC->SelectObject(oldbrush);
			}
		}
	}

	// Clean Up
	DeleteObject(hbmp);
	DeleteDC(hdcCompatible);
	DeleteDC(hdcScreen);
}
开发者ID:ohzooboy,项目名称:oh,代码行数:86,代码来源:OpenScrapeView.cpp


示例15: pszConvertedAnsiString

bool PT_Network::ReadGTFFiles(GDRect network_rect)  // Google Transit files
{

	//	// step 1: read  route files
	string str0 = m_ProjectDirectory +"routes.txt";
	//string str =  "h:/routes.csv";

	CT2CA pszConvertedAnsiString (str0.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd (pszConvertedAnsiString);
	CCSVParser parser;

	if (parser.OpenCSVFile(strStd))
	{

		//	AfxMessageBox("Start reading Google Transit Feed files...", MB_ICONINFORMATION);

		int count =0;
		PT_Route route;
		while(parser.ReadRecord())
		{


			if(parser.GetValueByFieldName("route_id",route.route_id ) == false)
				break;
			if(parser.GetValueByFieldName("route_long_name",route.route_long_name) == false)
				route.route_long_name="";
			if(parser.GetValueByFieldName("route_short_name",route.route_short_name) == false)
				route.route_short_name="";			
			if(parser.GetValueByFieldName("route_url",route.route_url) == false)
				route.route_url="";			
			if(parser.GetValueByFieldName("route_type",route.route_type) == false)
				route.route_type="";		

			// make sure there is not duplicated key
			// If the requested key is not found, find() returns the end iterator for
			//the container, so:

			if(m_PT_RouteMap.find(route.route_id)  == m_PT_RouteMap.end() )
			{ 
				m_PT_RouteMap[route.route_id] = route;  
			}
			else
			{
				AfxMessageBox("Duplicated Route ID!");
			}


			count++;

		}
		parser.CloseCSVFile ();

		CMainFrame* pMainFrame = (CMainFrame*) AfxGetMainWnd();

		pMainFrame->m_bShowLayerMap[layer_transit] = true;

	}else
	{
		return false;
	}

	CString missing_stops_message;
	// step 1: read stop information
	string str2 = m_ProjectDirectory +"stops.txt";


	CT2CA pszConvertedAnsiString2 (str2.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd2 (pszConvertedAnsiString2);
	if (parser.OpenCSVFile(strStd2))
	{
		int count =0;
		while(parser.ReadRecord())
		{
			PT_Stop stop;

			if(parser.GetValueByFieldName("stop_id",stop.stop_id ) == false)
				break;


			bool NonnegativeFlag = false;
			if(parser.GetValueByFieldName("stop_lat",stop.m_ShapePoint.y, NonnegativeFlag) == false)
				break;

			if(parser.GetValueByFieldName("stop_lon",stop.m_ShapePoint.x , NonnegativeFlag) == false)
				break;

			if(parser.GetValueByFieldName("direction",stop.direction  ) == false)
				stop.direction="";

			if(parser.GetValueByFieldName("location_type",stop.location_type) == false)
				stop.location_type=0;

			if(parser.GetValueByFieldName("position",stop.position  ) == false)
				stop.position="";

			if(parser.GetValueByFieldName("stop_code",stop.stop_code ) == false)
				stop.stop_code=0;

//.........这里部分代码省略.........
开发者ID:lidapeng,项目名称:dtalite_beta_test,代码行数:101,代码来源:Transit.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AfxGetModuleState函数代码示例发布时间:2022-05-30
下一篇:
C++ AfxGetInstanceHandle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap