您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EndPaint函数代码示例

51自学网 2021-06-01 20:37:52
  C++
这篇教程C++ EndPaint函数代码示例写得很实用,希望能帮到您。

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

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

示例1: WndProc

////  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)////  PURPOSE:  Processes messages for the main window.////  WM_COMMAND	- process the application menu//  WM_PAINT	- Paint the main window//  WM_DESTROY	- post a quit message and return////LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	int wmId, wmEvent;	PAINTSTRUCT ps;	HDC hdc;	switch (message)	{	case WM_COMMAND:		wmId    = LOWORD(wParam);		wmEvent = HIWORD(wParam);		// Parse the menu selections:		switch (wmId)		{		case IDM_ABOUT:			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);			break;		case IDM_EXIT:			DestroyWindow(hWnd);			break;		default:			return DefWindowProc(hWnd, message, wParam, lParam);		}		break;	case WM_PAINT:		hdc = BeginPaint(hWnd, &ps);		::TextOut(hdc, 10, 10, L"Arrow keys to turn.", 19);		::SetTextColor(hdc, RGB(200,0,0));		::TextOut(hdc, 10, 25, L"Red = Original;", 15);		::SetTextColor(hdc, RGB(0,0,255));		::TextOut(hdc, 120, 25, L"Blue = Extrapolated", 19);		::SetTextColor(hdc, RGB(0,0,0));		{		  wchar_t buf[100];		  _snwprintf(buf, 100, L"Latency %d ms Jitter %d ms Droprate %d%%", (int)(LATENCY*1000), (int)(JITTER*1000),		      (int)(DROPRATE*100));		  buf[99] = 0;		  ::TextOut(hdc, 10, 40, buf, (INT)wcslen(buf));		}		::TextOut(hdc, 10, 55, L"F2: change draw mode", 20);		::TextOut(hdc, 10, 70, L"F3: pause/go", 12);		::TextOut(hdc, 10, 85, L"F4: single step", 15);		if (gPaused) {		  ::SetTextColor(hdc, RGB(255,0,0));		  ::TextOut(hdc, 300, 10, L"PAUSED", 6);		  ::SetTextColor(hdc, RGB(0,0,0));		}		if (gPointDisplay) {		  ::TextOut(hdc, 300, 25, L"POINTS", 6);		}		else {		  ::TextOut(hdc, 300, 25, L"LINES", 5);		}    DrawWindow(hWnd, hdc);		EndPaint(hWnd, &ps);		break;	case WM_DESTROY:		PostQuitMessage(0);		gRunning = false;		break;  case WM_SYSKEYDOWN:  case WM_KEYDOWN:    keyDown[wParam&0xff] = true;    break;  case WM_SYSKEYUP:  case WM_KEYUP:    keyDown[wParam&0xff] = false;    break;  case WM_ACTIVATEAPP:    gActive = (wParam != 0);    memset(keyDown, 0, sizeof(keyDown));    break;	default:		return DefWindowProc(hWnd, message, wParam, lParam);	}	return 0;}
开发者ID:Gachuk,项目名称:Hardwar,代码行数:88,


示例2: WndPauseProc

LRESULT CALLBACKWndPauseProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){	HDC hdc;	PAINTSTRUCT ps;	RECT rect;	TEXTMETRIC tm;	LPPW lppw;	int cxChar, cyChar, middle;	lppw = (LPPW)GetWindowLongPtr(hwnd, 0);	switch(message) {		case WM_KEYDOWN:			if (wParam == VK_RETURN)				SendMessage(hwnd, WM_COMMAND, lppw->bDefOK ? IDOK : IDCANCEL, 0L);			else if (wParam == VK_ESCAPE)				SendMessage(hwnd, WM_COMMAND, IDCANCEL, 0L);			return 0;		case WM_COMMAND:			if ((LOWORD(wParam) == IDCANCEL) || (LOWORD(wParam) == IDOK)) {				lppw->bPauseCancel = LOWORD(wParam);				lppw->bPause = FALSE;				break;			}			return 0;		case WM_SETFOCUS:			SetFocus(lppw->bDefOK ? lppw->hOK : lppw->hCancel);			return 0;		case WM_PAINT: {			hdc = BeginPaint(hwnd, &ps);			SelectObject(hdc, GetStockObject(SYSTEM_FONT));			SetTextAlign(hdc, TA_CENTER);			GetClientRect(hwnd, &rect);			SetBkMode(hdc,TRANSPARENT);			TextOut(hdc, (rect.right + rect.left) / 2, (rect.bottom + rect.top) / 6,				lppw->Message, strlen(lppw->Message));			EndPaint(hwnd, &ps);			return 0;		}		case WM_CREATE: {			int ws_opts = WS_CHILD | WS_TABSTOP;#ifdef USE_MOUSE			if (!paused_for_mouse) /* don't show buttons during pausing for mouse or key */				ws_opts |= WS_VISIBLE;#endif			lppw = (LPPW) ((CREATESTRUCT *)lParam)->lpCreateParams;			SetWindowLongPtr(hwnd, 0, (LONG_PTR)lppw);			lppw->hWndPause = hwnd;			hdc = GetDC(hwnd);			SelectObject(hdc, GetStockObject(SYSTEM_FONT));			GetTextMetrics(hdc, &tm);			cxChar = tm.tmAveCharWidth;			cyChar = tm.tmHeight + tm.tmExternalLeading;			ReleaseDC(hwnd, hdc);			middle = ((LPCREATESTRUCT) lParam)->cx / 2;			lppw->hOK = CreateWindow((LPSTR)"button", (LPSTR)"OK",					ws_opts | BS_DEFPUSHBUTTON,					middle - 10 * cxChar, 3 * cyChar,					8 * cxChar, 7 * cyChar / 4,					hwnd, (HMENU)IDOK,					((LPCREATESTRUCT) lParam)->hInstance, NULL);			lppw->bDefOK = TRUE;			lppw->hCancel = CreateWindow((LPSTR)"button", (LPSTR)"Cancel",					ws_opts | BS_PUSHBUTTON,					middle + 2 * cxChar, 3 * cyChar,					8 * cxChar, 7 * cyChar / 4,					hwnd, (HMENU)IDCANCEL,					((LPCREATESTRUCT) lParam)->hInstance, NULL);			lppw->lpfnOK = (WNDPROC) GetWindowLongPtr(lppw->hOK, GWLP_WNDPROC);			SetWindowLongPtr(lppw->hOK, GWLP_WNDPROC, (LONG_PTR)PauseButtonProc);			lppw->lpfnCancel = (WNDPROC) GetWindowLongPtr(lppw->hCancel, GWLP_WNDPROC);			SetWindowLongPtr(lppw->hCancel, GWLP_WNDPROC, (LONG_PTR)PauseButtonProc);			if (GetParent(hwnd))				EnableWindow(GetParent(hwnd), FALSE);			return 0;		}		case WM_DESTROY:			GetWindowRect(hwnd, &rect);			lppw->Origin.x = (rect.right + rect.left) / 2;			lppw->Origin.y = (rect.bottom + rect.top) / 2;			lppw->bPause = FALSE;			if (GetParent(hwnd))				EnableWindow(GetParent(hwnd), TRUE);			break;	}	return DefWindowProc(hwnd, message, wParam, lParam);}
开发者ID:ConstantB,项目名称:gnuplot,代码行数:89,


示例3: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	int wmId, wmEvent;	PAINTSTRUCT ps;	HDC hdc;	//RECT rect;	int num=0;	switch (message) 	{	case WM_CREATE:		StartUp();		break;	case WM_COMMAND:		wmId    = LOWORD(wParam); 		wmEvent = HIWORD(wParam); 		// Parse the menu selections:		switch (wmId)		{		case IDM_FILE_NEW:						StartUp();			WinCheck();			if(wongame==true)				StartUp();			InvalidateRect(hWnd,NULL,FALSE);			break;		case IDM_ABOUT:			DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);			break;		case IDM_EXIT:			DestroyWindow(hWnd);			break;		default:			return DefWindowProc(hWnd, message, wParam, lParam);		}		break;	case WM_PAINT:		hdc = BeginPaint(hWnd, &ps);		//GetClientRect(hWnd,&rect);				for(int i=0;i<4;i++)			for(int j=0;j<4;j++)				OnPaint(hdc,j*64,i*64,Pole[i][j]);		// TODO: Add any drawing code here...				EndPaint(hWnd, &ps);				break;			case WM_DESTROY:		PostQuitMessage(0);		break;	case WM_LBUTTONDOWN:		POINT pt;		GetCursorPos(&pt);		ScreenToClient(hWnd,&pt);		SwapNum((int)pt.x/64,(int)pt.y/64);		InvalidateRect(hWnd,NULL,FALSE);		if(wongame == true)			MessageBox(hWnd,"You Won The Game!","Congradulations !",NULL);		break;	case WM_WINDOWPOSCHANGED:	//case WM_MOVE:		InvalidateRect(hWnd,NULL,FALSE);		break;	default:		return DefWindowProc(hWnd, message, wParam, lParam);	}	return 0;}
开发者ID:maxya,项目名称:old_sources,代码行数:67,


示例4: GetClientRect

//.........这里部分代码省略.........		SetTextColor(hdc,0x600000);		TextOut(hdc,17,rowY1,temp,(int)wcslen(temp));		SetTextColor(hdc,0x000000);				TCHAR *dis = debugger->disasm(address);		TCHAR *dis2=_tcschr(dis,'/t');		if (dis2)		{			*dis2=0;			dis2++;			wchar *mojs=wcsstr(dis2,L"0x8");			if (mojs)			for (int i=0; i<8; i++)			{				bool found=false;				for (int j=0; j<22; j++)				{					if (mojs[i+2]==L"0123456789ABCDEFabcdef"[j])						found=true;				}				if (!found)				{					mojs=0;					break;				}			}			if (mojs)			{				int offs;				swscanf(mojs+2,L"%08X",&offs);				branches[numBranches].src=rowY1 + rowHeight/2;				branches[numBranches].srcAddr=address/align;				branches[numBranches++].dst=(int)(rowY1+((__int64)offs-(__int64)address)*rowHeight/align + rowHeight/2);			//	sprintf(desc,"-->%s", debugger->getDescription(offs));				SetTextColor(hdc,0x600060);			}			else				SetTextColor(hdc,0x000000);			TextOut(hdc,198,rowY1,dis2,(int)wcslen(dis2));		}		SetTextColor(hdc,0x007000);		TextOut(hdc,90,rowY1,dis,(int)wcslen(dis));		SetTextColor(hdc,0x0000FF);		//char temp[256];		//UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE);		if (wcslen(desc))			TextOut(hdc,320,rowY1,desc,(int)wcslen(desc));		if (debugger->isBreakpoint(address))		{			DrawIconEx(hdc,2,rowY1,breakPoint,32,32,0,0,DI_NORMAL);		}	}	SelectObject(hdc,currentPen);	for (i=0; i<numBranches; i++)	{		int x=250+(branches[i].srcAddr%9)*8;		MoveToEx(hdc,x-2,branches[i].src,0);		if (branches[i].dst<rect.bottom+200 && branches[i].dst>-200)		{			LineTo(hdc,x+2,branches[i].src);			LineTo(hdc,x+2,branches[i].dst);			LineTo(hdc,x-4,branches[i].dst);						MoveToEx(hdc,x,branches[i].dst-4,0);			LineTo(hdc,x-4,branches[i].dst);			LineTo(hdc,x+1,branches[i].dst+5);		}		else		{			LineTo(hdc,x+4,branches[i].src);			//MoveToEx(hdc,x+2,branches[i].dst-4,0);			//LineTo(hdc,x+6,branches[i].dst);			//LineTo(hdc,x+1,branches[i].dst+5);		}		//LineTo(hdc,x,branches[i].dst+4);		//LineTo(hdc,x-2,branches[i].dst);	}	SelectObject(hdc,oldFont);	SelectObject(hdc,oldPen);	SelectObject(hdc,oldBrush);		DeleteObject(nullPen);	DeleteObject(currentPen);	DeleteObject(selPen);	DeleteObject(nullBrush);	DeleteObject(pcBrush);	DeleteObject(currentBrush);		DestroyIcon(breakPoint);	DestroyIcon(breakPointDisable);		EndPaint(wnd, &ps);}
开发者ID:ABelliqueux,项目名称:nulldc,代码行数:101,


示例5: TSButtonWndProc

//.........这里部分代码省略.........                    if (bct->pbState)                        bct->pbState = 0;                    else                        bct->pbState = 1;                    InvalidateRect(bct->hwnd, NULL, TRUE);                }                if(!bct->bSendOnDown)					SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg);                return 0;            }            break;        case WM_THEMECHANGED:            {                if (bct->bThemed)                    LoadTheme(bct);                InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it                break;            }        case WM_SETFONT:    // remember the font so we can use it later            {                bct->hFont = (HFONT) wParam; // maybe we should redraw?                break;            }        case WM_NCPAINT:        case WM_PAINT:            {                PAINTSTRUCT ps;                HDC hdcPaint;                hdcPaint = BeginPaint(hwndDlg, &ps);                if (hdcPaint) {                    PaintWorker(bct, hdcPaint);                    EndPaint(hwndDlg, &ps);                }                break;            }        case BM_GETIMAGE:            if(wParam == IMAGE_ICON)                return (LRESULT)(bct->hIconPrivate ? bct->hIconPrivate : bct->hIcon);            break;        case BM_SETIMAGE:            if(!lParam)                break;            bct->hIml = 0;            bct->iIcon = 0;            if (wParam == IMAGE_ICON) {                ICONINFO ii = {0};                BITMAP bm = {0};                if (bct->hIconPrivate) {                    DestroyIcon(bct->hIconPrivate);                    bct->hIconPrivate = 0;                }                GetIconInfo((HICON) lParam, &ii);                GetObject(ii.hbmColor, sizeof(bm), &bm);                if (bm.bmWidth > g_cxsmIcon || bm.bmHeight > g_cysmIcon) {                    HIMAGELIST hImageList;                    hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);                    ImageList_AddIcon(hImageList, (HICON) lParam);                    bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);                    ImageList_RemoveAll(hImageList);                    ImageList_Destroy(hImageList);                    bct->hIcon = 0;                } else {
开发者ID:dineshkummarc,项目名称:miranda-im-v0.9.47-src,代码行数:67,


示例6: WindowProcedure

//.........这里部分代码省略.........                           }                            SetTimer(hwnd,Time1,times,NULL);                             leng=1;                             plays=Play;                           break;                      case VK_F1:                           break;                      case VK_F2:                                                      SetTimer(hwnd,Time1,times,NULL);                             leng=1;                             plays=Play;                             break;                       case VK_F3:                           if(plays==Play)                             {                                 KillTimer(hwnd,Time1);                                 plays=Paush;                                      }                             else                             if(plays==Paush)                               {                                 SetTimer(hwnd,Time1,times,NULL);                                 plays=Play;                               }                                                      break;                                }               break;          case WM_TIMER:                  switch (wParam)                    {                      case Time1:                       timechage(hwnd);                              break;                         }                     break;                  case WM_CREATE:                plays=Stop;                play=Player1;               break;          case WM_SIZE:               xw=LOWORD(lParam);               yw=HIWORD(lParam);               xw-=TextWidth;               InvalidateRect(hwnd,NULL,TRUE);                           break;          case WM_LBUTTONDOWN:                //获取但前鼠标坐标                 point.x=LOWORD(lParam);                point.y=HIWORD(lParam);                //初始化设备DC                  Init(hwnd);                //鼠标坐标换为数组坐标                 x=(point.x)/(xw/MAX);                y=(point.y)/(yw/MAX);             if(plays==Stop)break;                        if(x<MAX&&y<MAX)             {                                            if(iGame[x][y]==Default&&plays==Play)//判断但前位置是否有棋子覆盖                   {                        leng=1;                      paint(play,x,y);                      if(Look(x,y,play))                        over(hwnd,play);                      chagePlayer();                                        }                   }               break;                  case WM_PAINT:                            hdc=BeginPaint(hwnd,&ps);               Init(hwnd);               Rectangle(hdc,0,0,xw,yw);               for(x=0;x<MAX;x++)                  for(y=0;y<MAX;y++)                  {                    Rectangle(hdc,x*xw/MAX,y*yw/MAX,(x+1)*xw/MAX,(y+1)*yw/MAX) ;                    paint(iGame[x][y],x,y);                  }               EndPaint(hwnd,&ps);               break;             case WM_DESTROY:              PostQuitMessage (0);         /* send a WM_QUIT to the message queue */              break;          default:                        /* for messages that we don't deal with */              return DefWindowProc (hwnd, message, wParam, lParam);      }      return 0;}
开发者ID:3588,项目名称:au-cs433,代码行数:101,


示例7: WndProc

//.........这里部分代码省略.........			DrawText(hdc,TEXT("Intel Micro Media Server"),-1,&r,0);			// Paint the transfer count stat label & value			r.left = 50;			r.right = rt.right-1;			r.top = 20;			r.bottom = 50;			if (MmsCurrentTransfersCount == 0)			{				DrawText(hdc,TEXT("No File Transfers          "),-1,&r,0);			}			if (MmsCurrentTransfersCount == 1)			{				DrawText(hdc,TEXT("1 File Transfer          "),-1,&r,0);			}			if (MmsCurrentTransfersCount > 1)			{				wsprintf((unsigned short*)str,TEXT("%d File Transfers        "),MmsCurrentTransfersCount);				DrawText(hdc,(unsigned short*)str,-1,&r,0);			}			// Paint the main portion of the screen			r.left = 1;			r.right = rt.right-1;			r.top = 42;			r.bottom = 267;			FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR));			// Paint global media server stats labels			r.left = 8;			r.right = 150;			r.top = 50;			r.bottom = 70;			DrawText(hdc,TEXT("Browse Requests"),-1,&r,0);			r.left = 8;			r.right = 150;			r.top = 70;			r.bottom = 90;			DrawText(hdc,TEXT("HTTP Requests"),-1,&r,0);			// Paint global media server stats values			wsprintf((unsigned short*)str,TEXT("%d"),MmsBrowseCount);			r.left = 180;			r.right = rt.right-5;			r.top = 50;			r.bottom = 70;			DrawText(hdc,(unsigned short*)str,-1,&r,DT_RIGHT);			wsprintf((unsigned short*)str,TEXT("%d"),MmsHttpRequestCount);			r.left = 180;			r.right = rt.right-5;			r.top = 70;			r.bottom = 90;			DrawText(hdc,(unsigned short*)str,-1,&r,DT_RIGHT);			// Paint the transfer window edge			r.left = 2;			r.right = rt.right-1;			r.top = 94;			r.bottom = 264;			DrawEdge(hdc,&r,EDGE_SUNKEN,BF_RECT);			// Paint the white transfer window			r.left = 4;			r.right = rt.right-5;			r.top = 96;			r.bottom = 262;			FillRect(hdc,&r,GetSysColorBrush(COLOR_MENU));			// Draw all of the active transfers on the screen (up to 5)			for (i=0;i<5;i++)			{				DrawTransferInfo(hdc,i,g_DownloadStatsMapping[i]);			}			EndPaint(hWnd, &ps);			break;		case WM_CLOSE:			ILibStopChain(TheChain);			break;		case WM_DESTROY:			DestroyIcon(HICON_MEDIASERVER);			DestroyIcon(HICON_MEDIASERVER2);			DestroyIcon(HICON_RIGHTARROW);			DestroyIcon(HICON_LEFTARROW);			CommandBar_Destroy(g_hwndCB);			PostQuitMessage(0);			break;		case WM_ACTIVATE:            // Notify shell of our activate message			SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);     		break;		case WM_SETTINGCHANGE:			SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);     		break;		default:			return DefWindowProc(hWnd, message, wParam, lParam);   }   return 0;}
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:101,


示例8: FilterboxDlgHandler

//.........这里部分代码省略.........				  acttype=SendMessage( GetDlgItem(hDlg, IDC_FILTERTYPECOMBO), CB_GETCURSEL, 0, 0 ) ;				  update_filterdialog(hDlg,acttype);			case IDC_FILTERPAR0:			case IDC_FILTERPAR1:			case IDC_FILTERPAR2:			case IDC_FROMFREQ:			case IDC_TOFREQ:				if (!dinit)				{					newf=do_filt_design(hDlg,acttype);					if (newf) tempf=newf; 					InvalidateRect(hDlg,NULL,TRUE);				}				break;			case IDC_FILTERSTORE:				if (newf)				{					GetDlgItemText(hDlg, IDC_FILTERNEWNAME,newname,sizeof(newname));									st->filtertype=acttype;					st->par0=GetDlgItemInt(hDlg,IDC_FILTERPAR0, NULL, 0);					GetDlgItemText(hDlg,IDC_FILTERPAR1,sztemp,sizeof(sztemp)); 					sscanf(sztemp,"%f",&st->par1);					GetDlgItemText(hDlg,IDC_FILTERPAR2,sztemp,sizeof(sztemp));					st->dispfrom=GetDlgItemInt(hDlg, IDC_FROMFREQ, NULL, 0);					st->dispto=GetDlgItemInt(hDlg, IDC_TOFREQ, NULL, 0);					sscanf(sztemp,"%f",&st->par2);					strcpy(st->name,newname);					st->filt=do_filt_design(hDlg, acttype);					st->run= fid_run_new(st->filt, &(st->funcp));					if (st->fbuf!=NULL)					{						fid_run_freebuf(st->fbuf);   						st->fbuf=fid_run_newbuf(st->run);					}				}				break;				}				return(TRUE);		case WM_PAINT:			{				PAINTSTRUCT ps;				HDC hdc;				RECT rect;				HPEN	 tpen;				HBRUSH	 tbrush;				int height;				int f1,f2;				float fstep,val,x;				hdc = BeginPaint (hDlg, &ps);				GetClientRect(hDlg, &rect);				tpen    = CreatePen (PS_SOLID,1,0);				SelectObject (hdc, tpen);				tbrush  = CreateSolidBrush(RGB(240,240,240));				SelectObject(hdc,tbrush);				rect.top+=80;				rect.bottom -= 18;				height= rect.bottom-rect.top;				Rectangle(hdc,rect.left,rect.top-1,rect.right,rect.bottom+20);				Rectangle(hdc,rect.left,rect.top-1,rect.right,rect.bottom);				Rectangle(hdc,rect.left,rect.bottom-(int)(height/1.3),rect.right,rect.bottom);								DeleteObject(tbrush);				DeleteObject(tpen);				tpen = CreatePen (PS_SOLID,1,RGB(0,100,0));				SelectObject (hdc, tpen);				f1=GetDlgItemInt(hDlg, IDC_FROMFREQ, NULL, 0);				f2=GetDlgItemInt(hDlg, IDC_TOFREQ, NULL, 0);				fstep=(float)(f2-f1)/(rect.right-rect.left);				MoveToEx(hdc,rect.left+1,rect.bottom-(int)(height*fid_response(tempf, (float)f1/256.0)/1.3),NULL);				for (t=rect.left; t<rect.right; t++)				{ 					MoveToEx(hdc,1+t,rect.bottom,NULL);					LineTo(hdc,1+t,rect.bottom-(int)(height*fid_response(tempf, (((float)f1+fstep*(t-rect.left))/PACKETSPERSECOND))/1.3));				}				SelectObject(hdc, DRAW.scaleFont);				wsprintf(sztemp,"1.0"); 				ExtTextOut( hdc, rect.left+2,rect.top+(int)(height*0.2308), 0, &rect,sztemp, strlen(sztemp), NULL ) ;				val=(f2-f1)/10.0f;				fstep=((rect.right-25)-rect.left)/10.0f;				for (t=0; t<=10; t++)				{ 					x=f1+val*t;					wsprintf(sztemp,"%d.%d",(int)x,(int)(x*10)%10); 					ExtTextOut( hdc, rect.left+2+(int)(fstep*t),rect.bottom+2, 0, &rect,sztemp, strlen(sztemp), NULL ) ;				}				DeleteObject(tpen);				EndPaint(hDlg, &ps );				}				break;		case WM_SIZE:		case WM_MOVE:  update_toolbox_position(hDlg);		break;		return(TRUE);	}    return FALSE;}
开发者ID:dadymax,项目名称:BrainBay,代码行数:101,


示例9: waoWC_button0Proc

//.........这里部分代码省略.........        {            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_NORMAL );            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );            DLGPROC parProc = ( DLGPROC ) GetWindowLong ( GetParent( hwnd ), DWL_DLGPROC );            if( msg != WM_CLEAR ) // what about making this a seperate thread?                parProc( GetParent ( hwnd ), WM_COMMAND,                         MAKEWPARAM( GetWindowLong( hwnd, GWL_ID ),                         WAO_TBBN_LCLCKED ),                         ( LPARAM ) hwnd );            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_NOTIFY )            {                KillTimer( hwnd, WAO_TMR_TBRPW );                KillTimer( hwnd, WAO_TMR_TBRPT );            }            return FALSE;        }        case WM_RBUTTONUP:            // should be clicked first:            if( !( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CLICKED ) )                return FALSE;            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_RIGHTBUTTON )            {                DLGPROC parProc = ( DLGPROC ) GetWindowLong( GetParent( hwnd ), DWL_DLGPROC );                parProc( GetParent( hwnd ),                         WM_COMMAND,                         MAKEWPARAM( GetWindowLong ( hwnd, GWL_ID ), WAO_TBBN_RCLCKED ),                         ( LPARAM ) hwnd );            }            return FALSE;        case WM_TIMER:        {            if( wParam == WAO_TMR_TBRPW ) // repeat wait            {                KillTimer( hwnd, WAO_TMR_TBRPW );                SetTimer( hwnd, WAO_TMR_TBRPT, WAO_TBBN_RPTTIME, NULL );            }            DLGPROC parProc = ( DLGPROC ) GetWindowLong( GetParent( hwnd ), DWL_DLGPROC );            parProc( GetParent( hwnd ),                     WM_COMMAND,                     MAKEWPARAM( GetWindowLong( hwnd, GWL_ID ), WAO_TBBN_LCLCKED ),                     ( LPARAM ) hwnd );            return FALSE;        }        case WM_PAINT:        {            PAINTSTRUCT paintStruct;            BeginPaint( hwnd, &paintStruct );            RECT rcWnd;            GetClientRect( hwnd, &rcWnd ); // should this be calculated every time?            int btnStt = GetWindowLong( hwnd, GWL_USERDATA );            if( btnStt & WAO_TBBS_CHECKED )            {                FillRect( paintStruct.hdc, &rcWnd, CreateSolidBrush( 0x99ffff ) );                DrawEdge( paintStruct.hdc, &rcWnd, BDR_SUNKENOUTER, BF_RECT );            }            else if( btnStt == WAO_TBBS_CLICKED )            {                DrawEdge( paintStruct.hdc, &rcWnd, BDR_SUNKENOUTER, BF_RECT );            }            else if( btnStt == WAO_TBBS_HOVERED )            {                DrawEdge( paintStruct.hdc, &rcWnd, BDR_RAISEDINNER, BF_RECT );            }            // drawing icon            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_ICON ) // maybe later bitmap too            {                HICON hIco = LoadIcon( GetModuleHandle( NULL ),                                       MAKEINTRESOURCE( GetWindowLong( hwnd, GWL_ID ) ) );                DrawIconEx( paintStruct.hdc,                            ( rcWnd.right - rcWnd.left - 16 ) / 2,                            ( rcWnd.bottom - rcWnd.top - 16 ) / 2,                            hIco, 16, 16, 0, NULL, DI_NORMAL );            }            // drawing text            else            {                int tmpLen = GetWindowTextLength( hwnd );                wchar_t buffer[ tmpLen + 1 ];                SIZE tmpSze;                GetWindowText( hwnd, buffer, tmpLen + 1 );                SetBkMode( paintStruct.hdc, TRANSPARENT );                SelectObject( paintStruct.hdc, GetStockObject( DEFAULT_GUI_FONT ) );                GetTextExtentPoint32( paintStruct.hdc, buffer, tmpLen, &tmpSze );                DrawState( paintStruct.hdc, NULL, NULL,                         ( LPARAM ) buffer, tmpLen,                         ( rcWnd.right-rcWnd.left-tmpSze.cx ) / 2,                         ( rcWnd.bottom-rcWnd.top-tmpSze.cy ) / 2,                         tmpSze.cx, tmpSze.cy, DST_TEXT|(                                ( btnStt & WAO_TBBS_DISABLED ) ? DSS_DISABLED : 0 ) );            }            EndPaint( hwnd, &paintStruct );            return FALSE;        }        default:            return DefWindowProc( hwnd, msg, wParam, lParam );    }}
开发者ID:AresDice,项目名称:lifeograph-windows,代码行数:101,


示例10: GetWindowLong

LRESULT CALLBACK ChatView::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {    PAINTSTRUCT ps;    HDC hdc;    ChatView *p=(ChatView *) GetWindowLong(hWnd, GWL_USERDATA);    switch (message) {    case WM_CREATE:        {            p=(ChatView *) (((CREATESTRUCT *)lParam)->lpCreateParams);            SetWindowLong(hWnd, GWL_USERDATA, (LONG) p );            p->msgList=VirtualListView::ref(new VirtualListView(hWnd, std::string("Chat")));            p->msgList->setParent(hWnd);            p->msgList->showWindow(true);            p->msgList->wrapList=false;            p->msgList->colorInterleaving=true;            p->editWnd=DoCreateEditControl(hWnd);            p->calcEditHeight();            p->msgList->bindODRList(p->contact->messageList);            break;        }    case WM_PAINT:        hdc = BeginPaint(hWnd, &ps);        {            //p->contact->nUnread=0;            RECT rc = {0, 0, 200, tabHeight};            SetBkMode(hdc, TRANSPARENT);            SetTextColor(hdc, p->contact->getColor());            p->contact->draw(hdc, rc);            int iconwidth= skin->getElementWidth();            skin->drawElement(hdc, icons::ICON_CLOSE, p->width-2-iconwidth, 0);            skin->drawElement(hdc, icons::ICON_TRASHCAN_INDEX, p->width-2-iconwidth*2, 0);            /*SetBkMode(hdc, TRANSPARENT);            LPCTSTR t=p->title.c_str();            DrawText(hdc, t, -1, &rc, DT_CALCRECT | DT_LEFT | DT_TOP);            DrawText(hdc, t, -1, &rc, DT_LEFT | DT_TOP);*/        }        EndPaint(hWnd, &ps);        break;    //case WM_KILLFOCUS:    //    p->contact->nUnread=0;    //    break;    case WM_SIZE:         {             HDWP hdwp;             RECT rc;             int height=GET_Y_LPARAM(lParam);            p->width=GET_X_LPARAM(lParam);            int ySplit=height-p->editHeight;            p->calcEditHeight();            // Calculate the display rectangle, assuming the             // tab control is the size of the client area.             SetRect(&rc, 0, 0,                 GET_X_LPARAM(lParam), ySplit );             // Size the tab control to fit the client area.             hdwp = BeginDeferWindowPos(2);            /*DeferWindowPos(hdwp, dropdownWnd, HWND_TOP, 0, 0,             GET_X_LPARAM(lParam), 20,             SWP_NOZORDER             ); */            DeferWindowPos(hdwp, p->msgList->getHWnd(), HWND_TOP, 0, tabHeight,                 GET_X_LPARAM(lParam), ySplit-tabHeight,                 SWP_NOZORDER                 );            /*DeferWindowPos(hdwp, rosterWnd, HWND_TOP, 0, tabHeight,             GET_X_LPARAM(lParam), height-tabHeight,             SWP_NOZORDER             );*/            DeferWindowPos(hdwp, p->editWnd, NULL, 0, ySplit+1,                 GET_X_LPARAM(lParam), height-ySplit-1,                 SWP_NOZORDER                 );             EndDeferWindowPos(hdwp);             break;         }     case WM_COMMAND:         {            if (wParam==IDS_SEND) {                p->sendJabberMessage();//.........这里部分代码省略.........
开发者ID:evgs,项目名称:bombus-ng,代码行数:101,


示例11: WndProc

LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM uParam,LPARAM lParam) { TEXTMETRIC tm; PAINTSTRUCT ps; HDC hdc; int i,j,k,t; static int cxChar,cyChar; static int outRow,outCol; CHAR c; CHAR lnBuffer[128]; CHAR *lnPtr; int lnLen; int outColFlag; switch (message) { case WM_CREATE:    hdc = GetDC(hwnd);    SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));    GetTextMetrics(hdc,&tm);    cxChar = tm.tmAveCharWidth;    cyChar = tm.tmHeight;    ReleaseDC(hwnd,hdc);    outRow = 0;    outCol = 0;    break; case WM_SIZE:    break; case WM_SETFOCUS:    CreateCaret(hwnd,(HBITMAP)1,cxChar,cyChar);    ShowCaret(hwnd);    break; case WM_KILLFOCUS:    HideCaret(hwnd);    DestroyCaret();    break; case WM_PAINT:    hdc = BeginPaint(hwnd,&ps);    SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));    outRow=0;    outCol=0;    outColFlag = 0;    lnPtr = lnBuffer;    lnLen = 0;    for (i=1; i <= gCurrStr; i++) {       k = strlen(&gPutStr[i][0]);       for (j=0; j < k; j++) {          c = gPutStr[i][j];          switch (c) {          case '/n':             if (lnLen) TextOut(hdc,(outCol*cxChar),(outRow*cyChar),lnBuffer,lnLen);             lnPtr = lnBuffer;             lnLen = 0;             outCol = 0;             outRow++;             break;          case '/r':             outColFlag = 1;             break;          case '/x0C':  // form-feed (rest of gPutStr[] line ignored)             // cls             gCurrStr=0;             InvalidateRect(gHwnd,NULL,TRUE);             break;          default:             if (c >= 32) {                *lnPtr++ = c;                lnLen++;             }          }       }       if (lnLen) {          TextOut(hdc,(outCol*cxChar),(outRow*cyChar),lnBuffer,lnLen);          outCol = outCol + lnLen;          lnPtr = lnBuffer;          lnLen = 0;       }       if (outColFlag) {          outCol = 0;          outColFlag = 0;       }    }    SetCaretPos(outCol*cxChar,outRow*cyChar);    EndPaint(hwnd,&ps);    break; case WM_CHAR:    HideCaret(hwnd);    for (i=0; i < (int)LOWORD(lParam); i++) {       switch(LOWORD(uParam)) {//.........这里部分代码省略.........
开发者ID:OS2World,项目名称:DEV-REXX-Bullet-REXX,代码行数:101,


示例12: WinProc

LRESULT CALLBACK WinProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam){    LONG    lRet = 0;     PAINTSTRUCT    ps;    switch (uMsg)	{     case WM_SIZE:										// If the window is resized		if(!g_bFullScreen)								// Do this only if we are NOT in full screen		{			SizeOpenGLScreen(LOWORD(lParam),HIWORD(lParam));// LoWord=Width, HiWord=Height			GetClientRect(hWnd, &g_rRect);				// Get the window rectangle		}        break;  	case WM_PAINT:										// If we need to repaint the scene		BeginPaint(hWnd, &ps);							// Init the paint struct				EndPaint(hWnd, &ps);							// EndPaint, Clean up		break;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *	// Below we check what the user types in.  If they use the arrow keys	// then we want to move the sphere around (LEFT RIGHT UP and DOWN keys, plus F3/F4)	// To rotate the camera around the line segment, use the F1 and F2 keys.	case WM_KEYDOWN:		switch(wParam) 		{			case VK_ESCAPE:								// Check if we hit the ESCAPE key.				PostQuitMessage(0);						// Tell windows we want to quit				break;			case VK_UP:									// Check if we hit the UP ARROW key.				g_vPosition.y += 0.01f;					// Move the sphere up				break;			case VK_DOWN:								// Check if we hit the DOWN ARROW key.				g_vPosition.y -= 0.01f;					// Move the sphere down				break;			case VK_LEFT:								// Check if we hit the LEFT ARROW key.				g_vPosition.x -= 0.01f;					// Move the sphere left along it's plane				break;			case VK_RIGHT:								// Check if we hit the RIGHT ARROW key.				g_vPosition.x += 0.01f;					// Move the sphere right along it's plane				break;			case VK_F3:									// Check if we hit F3				g_vPosition.z -= 0.01f;					// Move the sphere in front of the line				break;			case VK_F4:									// Check if we hit F4				g_vPosition.z += 0.01f;					// Move the sphere in front of the line				break;			case VK_F1:									// Check if we hit F1				g_rotateY -= 2;							// Rotate the camera left				break;			case VK_F2:									// Check if we hit F2				g_rotateY += 2;							// Rotate the camera right				break;		}/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *		break;    case WM_CLOSE:										// If the window is closed        PostQuitMessage(0);								// Tell windows we want to quit        break;          default:											// Return by default        lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);         break;     }      return lRet;										// Return by default}
开发者ID:twinklingstar20,项目名称:Programming-Tutorials,代码行数:83,


示例13: MainWndProc

//.........这里部分代码省略.........               break;            case IDM_MSG_TO_SERVER:               if ( hConv != NULL )               {                  iClientCount ++;                  sprintf ( tbuf, "%3d.", iClientCount );                  strncpy ( &szDDEString[36], tbuf, 5 );                  hData = DdeCreateDataHandle ( idInst, &szDDEString,                           sizeof ( szDDEString ), 0L, hszItem, wFmt, 0 );                  if ( hData != NULL )            		  hData = DdeClientTransaction ( (LPBYTE)hData, -1, hConv,                               hszItem, wFmt, XTYP_POKE, 1000, &dwResult );                  else                     HandleOutput ( "Could not create data handle." );               }               else                  HandleOutput ( "A connection to a DDE Server has not been established." );               break;            case IDM_MSG_FROM_SERVER:               if ( hConv != NULL )               {                  hData = DdeClientTransaction ( NULL, 0, hConv,                               hszItem, wFmt, XTYP_REQUEST, 1000, &dwResult );                  if ( dwResult == DDE_FNOTPROCESSED )                     HandleOutput ( "Data not available from server." );                  else                  {                     DdeGetData ( hData, (LPBYTE) szDDEData, 80L, 0L );                     if ( szDDEData != NULL )                        HandleOutput ( szDDEData );                     else                        HandleOutput ( "Message from server is null." );                  }               }               else                  HandleOutput ( "A connection to a DDE Server has not been established." );               break;            case IDM_ABOUT:               dlgProcAbout = (DLGPROC) MakeProcInstance ( (FARPROC)About, hInst );               DialogBox ( hInst, "AboutBox", hWnd, dlgProcAbout );               FreeProcInstance ( (FARPROC) dlgProcAbout );               break;            default:               return ( DefWindowProc ( hWnd, message, wParam, lParam ) );         }         break;      case WM_PAINT:         hDC = BeginPaint ( hWnd, &ps );         y = 0;         for ( i = 0; i < cTotalLines; i ++ )         {            if ( cTotalLines == 8 )               j = ( (cCurrentLine + 1 + i) % 9 );            else               j = i;         // can't do this if we clear window and start in middle of array            TextOut ( hDC, 0, y, (LPSTR)(szScreenText[j]),                                 lstrlen ( szScreenText[j] ) );            y = y + cyChar;         }         EndPaint ( hWnd, &ps );         break;      case WM_DESTROY:         if ( hConv != NULL )         {            DdeDisconnect ( hConv );            hConv = NULL;         }         DdeFreeStringHandle ( idInst, hszService );         DdeFreeStringHandle ( idInst, hszTopic );         DdeFreeStringHandle ( idInst, hszItem );         FreeProcInstance ( lpDdeProc );         PostQuitMessage ( 0 );         break;      default:         return ( DefWindowProc ( hWnd, message, wParam, lParam ) );   }   return ( FALSE );}
开发者ID:nicolaemariuta,项目名称:bachelorHomeworkAndStudy,代码行数:101,


示例14: WndProc

//.........这里部分代码省略.........                }            }        }        // Parse the menu selections:        switch (wmId)        {        case IDM_ABOUT:           DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);           break;        case IDM_EXIT:           DestroyWindow(hWnd);           break;        case IDM_FILE_CLEARDISPLAY:            SetWindowText(hDisplayWnd, TEXT(""));            break;        case IDM_FILE_CONNECT:            if (bConnected)            {                MessageBox(hWnd, TEXT("You are already connected!"), TEXT("Error"), MB_OK|MB_ICONSTOP);            }            else            {                if (DialogBox(hInst, (LPCTSTR)IDD_CONNECTION, hWnd, (DLGPROC)ConnectionDialogProc) == IDOK)                {                    bConnected = TRUE;                    EnableFileMenuItemByID(IDM_FILE_DISCONNECT, TRUE);                    EnableFileMenuItemByID(IDM_FILE_CONNECT, FALSE);                    _beginthread(Rs232Thread, 0, NULL);                }            }            break;        case IDM_FILE_DISCONNECT:            if (bConnected)            {                bConnected = FALSE;                EnableFileMenuItemByID(IDM_FILE_DISCONNECT, FALSE);                EnableFileMenuItemByID(IDM_FILE_CONNECT, TRUE);            }            else            {                MessageBox(hWnd, TEXT("You are not currently connected!"), TEXT("Error"), MB_OK|MB_ICONSTOP);            }            break;        case IDM_FILE_STARTCAPTURE:            if (DialogBox(hInst, (LPCTSTR)IDD_CAPTURE, hWnd, (DLGPROC)CaptureDialogProc) == IDOK)            {                bCapturing = TRUE;                EnableFileMenuItemByID(IDM_FILE_STOPCAPTURE, TRUE);                EnableFileMenuItemByID(IDM_FILE_STARTCAPTURE, FALSE);                hCaptureFile = CreateFile(strCaptureFileName, FILE_APPEND_DATA, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);            }            break;        case IDM_FILE_STOPCAPTURE:            if (bCapturing)            {                bCapturing = FALSE;                EnableFileMenuItemByID(IDM_FILE_STOPCAPTURE, FALSE);                EnableFileMenuItemByID(IDM_FILE_STARTCAPTURE, TRUE);                CloseHandle(hCaptureFile);                hCaptureFile = NULL;            }            break;        case IDM_FILE_LOCALECHO:            if (bLocalEcho)            {                bLocalEcho = FALSE;                CheckLocalEchoMenuItem(bLocalEcho);            }            else            {                bLocalEcho = TRUE;                CheckLocalEchoMenuItem(bLocalEcho);            }            break;        default:           return DefWindowProc(hWnd, message, wParam, lParam);        }        break;    case WM_PAINT:        hdc = BeginPaint(hWnd, &ps);        (void)hdc; // FIXME        EndPaint(hWnd, &ps);        break;    case WM_SIZE:        GetClientRect(hWnd, &rc);        MoveWindow(hDisplayWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top - 20, TRUE);        MoveWindow(hEditWnd, rc.left, rc.bottom - 20, rc.right - rc.left, 20, TRUE);        break;    case WM_DESTROY:        PostQuitMessage(0);        break;    default:        return DefWindowProc(hWnd, message, wParam, lParam);   }   return 0;}
开发者ID:Strongc,项目名称:reactos,代码行数:101,


示例15: InternalWndProc

//.........这里部分代码省略.........            }            else                // Else, hide the overlay... just in case we can't do                // destination color keying, this will pull the overlay                // off of the screen for the user.                if (g_pDDSOverlay && g_pDDSPrimary)                    g_pDDSOverlay->UpdateOverlay(NULL, g_pDDSPrimary, NULL, DDOVER_HIDE, NULL);            // Check to make sure our window exists before we tell it to            // repaint. This will fail the first time (while the window is being created).            if (hwnd)            {                InvalidateRect(hwnd, NULL, FALSE);                UpdateWindow(hwnd);            }            return 0L;        case WM_SIZE:            // Another check for the minimization action.  This check is            // quicker though...            if (wParam != SIZE_MINIMIZED)            {                GetClientRect(hwnd, &g_rcDst);                ClientToScreen(hwnd, &p);                g_rcDst.left = p.x;                g_rcDst.top = p.y;                g_rcDst.bottom += p.y;                g_rcDst.right += p.x;                g_rcSrc.left = 0;                g_rcSrc.right = g_sizex;                g_rcSrc.top = 0;                g_rcSrc.bottom = g_sizey;                // Here we multiply by 1000 to preserve 3 decimal places in the                // division opperation (we picked 1000 to be on the same order                // of magnitude as the stretch factor for easier comparisons)                g_dwXRatio = (g_rcDst.right - g_rcDst.left) * 1000 /                             (g_rcSrc.right - g_rcSrc.left);                g_dwYRatio = (g_rcDst.bottom - g_rcDst.top) * 1000 /                             (g_rcSrc.bottom - g_rcSrc.top);                CheckBoundries();            }            return 0L;        case WM_PAINT:            BeginPaint(hwnd, &ps);            // Check the primary surface to see if it's lost - if so you can            // pretty much bet that the other surfaces are also lost - thus            // restore EVERYTHING!  If we got our surfaces stolen by a full            // screen app - then we'll destroy our primary - and won't be able            // to initialize it again. When we get our next paint message (the            // full screen app closed for example) we'll want to try to reinit            // the surfaces again - that's why there is a check for            // g_pDDSPrimary == NULL.  The other option, is that our program            // went through this process, could init the primary again, but it            // couldn't init the overlay, that's why there's a third check for            // g_pDDSOverlay == NULL.  Make sure that the check for            // !g_pDDSPrimary is BEFORE the IsLost call - that way if the            // pointer is NULL (ie. !g_pDDSPrimary is TRUE) - the compiler            // won't try to evaluate the IsLost function (which, since the            // g_pDDSPrimary surface is NULL, would be bad...).            if (!g_pDDSPrimary || (g_pDDSPrimary->IsLost() != DD_OK) ||                (g_pDDSOverlay == NULL))            {                DestroyOverlay();                DestroyPrimary();                if (DDPrimaryInit())                    if (DDOverlayInit())                        if (!DrawOverlay())                            DestroyOverlay();            }            // UpdateOverlay is how we put the overlay on the screen.            if (g_pDDSOverlay && g_pDDSPrimary && g_video->updating)            {                hRet = g_pDDSOverlay->UpdateOverlay(&g_rcSrc, g_pDDSPrimary,                                                    &g_rcDst, g_OverlayFlags,                                                    &g_OverlayFX);#ifdef _DEBUG                if(hRet != DD_OK) DisplayError("Can't update overlay", hRet);#endif            }            EndPaint(hwnd, &ps);            return 0L;        // process mouse and keyboard events        case WM_LBUTTONDOWN:    mouse(1, lParam); break;        case WM_LBUTTONUP:      mouse(-1, lParam); break;        case WM_RBUTTONDOWN:    mouse(2, lParam); break;        case WM_RBUTTONUP:      mouse(-2, lParam); break;        case WM_MBUTTONDOWN:    mouse(3, lParam); break;        case WM_MBUTTONUP:      mouse(-3, lParam); break;        case WM_CHAR:           g_video->on_key(wParam); break;        case WM_DISPLAYCHANGE:  return 0L;        case WM_DESTROY:            // Now, shut down the window...            PostQuitMessage(0);            return 0L;    }    return g_pUserProc? g_pUserProc(hwnd, iMsg, wParam, lParam) : DefWindowProc(hwnd, iMsg, wParam, lParam);}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:101,


示例16: WndProcTrayNotify

/*------------------------------------------------   subclass procedure of TrayNotifyWnd--------------------------------------------------*/LRESULT CALLBACK WndProcTrayNotify(HWND hwnd, UINT message,	WPARAM wParam, LPARAM lParam){	switch(message)	{		case WM_ERASEBKGND:		{			RECT rc;			if(bNoClock) break;			GetClientRect(hwnd, &rc);			FillClock(hwnd, (HDC)wParam, &rc, 0);			return 1;		}		case WM_PAINT:		{			PAINTSTRUCT ps;			HDC hdc;			RECT rc;			if(bNoClock) break;			hdc = BeginPaint(hwnd, &ps);			GetClientRect(hwnd, &rc);			FillClock(hwnd, hdc, &rc, 0);#ifdef TEST_505			Rectangle(hdc, 1, 1, rc.right, rc.bottom);#endif //TEST_505			EndPaint(hwnd, &ps);			return 0;		}#ifdef TEST_505		case WM_MOVE:			return 0;		case WM_SIZE:			if(bNoClock) break;			SendMessage(s_hwndClock, WM_SIZE, 0, 0);//			return 0;			break;#else //TEST_505		case WM_SIZE:			if(bNoClock) break;			SendMessage(s_hwndClock, WM_SIZE, 0, 0);			break;#endif //TEST_505		case WM_NOTIFY:		{			LPNMHDR pnmh;			if(bNoClock) break;			pnmh = (LPNMHDR)lParam;			if (pnmh->code == NM_CUSTOMDRAW && pnmh->idFrom == 0)			{				LPNMCUSTOMDRAW pnmcd;				pnmcd = (LPNMCUSTOMDRAW)lParam;				if (pnmcd->dwDrawStage  == CDDS_ITEMPREPAINT					&& hdcClock != NULL)				{					POINT ptTray, ptToolbar;					int x, y;					ptTray.x = ptTray.y = 0;					ClientToScreen(hwnd, &ptTray);					ptToolbar.x = ptToolbar.y = 0;					ClientToScreen(pnmh->hwndFrom, &ptToolbar);					x = ptToolbar.x - ptTray.x;					y = ptToolbar.y - ptTray.y;					BitBlt(pnmcd->hdc, pnmcd->rc.left, pnmcd->rc.top,						pnmcd->rc.right - pnmcd->rc.left,						pnmcd->rc.bottom - pnmcd->rc.top,						hdcClock, x + pnmcd->rc.left, y + pnmcd->rc.top,						SRCCOPY);				}			}			break;		}	}	return CallWindowProc(oldWndProcTrayNotify, hwnd, message, wParam, lParam);}
开发者ID:h16o2u9u,项目名称:rtoss,代码行数:77,


示例17: ViewportWndProc

//.........这里部分代码省略.........            AppendMenu (hSysMenu, MF_SEPARATOR, 0, NULL);            AppendMenu (hSysMenu, MF_STRING, IDM_CLEARVP, "C&lear");            break;            }        case WM_SIZE:            // Reset the WinY client-area variable to the new size            //---------------------------------------------------------------            SetWindowLong (hwnd, GWW_WINDOWY, (DWORD)HIWORD(lParam));            break;        case WM_GETMINMAXINFO:            {            POINT   FAR *rgpt = (LPPOINT)lParam;            TEXTMETRIC tm;            HDC     hDC;            RECT    r;            HFONT   hOldFont;            INT     maxx, maxy, t;            // This is where we tell windows how large/small the window can            // be grown/shrunk/maximized, etc.            //---------------------------------------------------------------            hDC = GetDC (hwnd);            hOldFont = SelectObject (hDC, GetStockObject (ANSI_FIXED_FONT));            GetTextMetrics (hDC, &tm);            SelectObject (hDC, hOldFont);            ReleaseDC (hwnd, hDC);            GetWindowRect (hwnd, &r);            maxx = MAXLINELEN * (tm.tmMaxCharWidth);            maxy = MAXLINES * (tm.tmHeight + tm.tmExternalLeading);            rgpt[1].x = min((GetSystemMetrics(SM_CXFRAME)*2) + maxx,                            rgpt[1].x);            rgpt[1].y = min((GetSystemMetrics(SM_CYFRAME)*2) +                            GetSystemMetrics(SM_CYCAPTION) + maxy,                            rgpt[1].y);            rgpt[2].x = min(r.left, GetSystemMetrics(SM_CXSCREEN)-rgpt[1].x);            t = -GetSystemMetrics(SM_CXFRAME);            if (rgpt[2].x < t)                rgpt[2].x = t;            rgpt[2].y = min(r.top, GetSystemMetrics(SM_CYSCREEN)-rgpt[1].y);            t = -GetSystemMetrics(SM_CYFRAME);            if (rgpt[2].y < t)                rgpt[2].y = t;            rgpt[4] = rgpt[1];            break;            }        case WM_CLOSE:            ShowWindow (hwnd, SW_HIDE);            break;        case WM_SYSCOMMAND:            // Closing the viewport by the system menu is actually a "hide"            //---------------------------------------------------------------            if (wParam == SC_CLOSE)                ShowWindow (hwnd, SW_HIDE);            else if (wParam == IDM_CLEARVP)                ClearViewport (hwnd);            else                return (DefWindowProc (hwnd, msg, wParam, lParam));            break;        case WM_DESTROY:            // Deallocate the screen memory before we die!            //---------------------------------------------------------------            GlobalFree ((HANDLE)GetWindowLong (hwnd, GWW_MEMHANDLE));            break;        case WM_PAINT:            {            HFONT   hOldFont;            // Refresh the client area ONLY IF not minimized            //---------------------------------------------------------------            if (IsIconic(hwnd))                break;            BeginPaint (hwnd, &ps);            hOldFont = SelectObject(ps.hdc, GetStockObject(ANSI_FIXED_FONT));            if (GetWindowLong (hwnd, GWW_WINDOWY) == CW_USEDEFAULT)                {                RECT    r;                GetClientRect (hwnd, &r);                SetWindowLong (hwnd, GWW_WINDOWY, (UINT)r.bottom);                }            PaintViewport (hwnd, &ps);            SelectObject (ps.hdc, hOldFont);            EndPaint (hwnd, &ps);            break;            }        default:            return (DefWindowProc (hwnd, msg, wParam, lParam));        }    return FALSE;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:101,


示例18: WndProc

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){     static HPALETTE hPalette ;     static int      cxClient, cyClient ;     HBRUSH          hBrush ;     HDC             hdc ;     int             i ;     LOGPALETTE    * plp ;     PAINTSTRUCT     ps ;     RECT            rect ;          switch (message)     {     case WM_CREATE:               // Set up a LOGPALETTE structure and create a palette          plp = malloc (sizeof (LOGPALETTE) + 64 * sizeof (PALETTEENTRY)) ;          plp->palVersion    = 0x0300 ;          plp->palNumEntries = 65 ;          for (i = 0 ; i < 65 ; i++)          {               plp->palPalEntry[i].peRed   = (BYTE) min (255, 4 * i) ;               plp->palPalEntry[i].peGreen = (BYTE) min (255, 4 * i) ;               plp->palPalEntry[i].peBlue  = (BYTE) min (255, 4 * i) ;               plp->palPalEntry[i].peFlags = 0 ;          }          hPalette = CreatePalette (plp) ;          free (plp) ;          return 0 ;     case WM_SIZE:          cxClient = LOWORD (lParam) ;          cyClient = HIWORD (lParam) ;          return 0 ;               case WM_PAINT:          hdc = BeginPaint (hwnd, &ps) ;               // Select and realize the palette in the device context          SelectPalette (hdc, hPalette, FALSE) ;          RealizePalette (hdc) ;               // Draw the fountain of grays          for (i = 0 ; i < 65 ; i++)          {               rect.left   = i * cxClient / 64 ;               rect.top    = 0 ;               rect.right  = (i + 1) * cxClient / 64 ;               rect.bottom = cyClient ;               hBrush = CreateSolidBrush (PALETTERGB (min (255, 4 * i),                                                       min (255, 4 * i),                                                       min (255, 4 * i))) ;               FillRect (hdc, &rect, hBrush) ;               DeleteObject (hBrush) ;          }          EndPaint (hwnd, &ps) ;          return 0 ;     case WM_QUERYNEWPALETTE:          if (!hPalette)               return FALSE ;          hdc = GetDC (hwnd) ;          SelectPalette (hdc, hPalette, FALSE) ;          RealizePalette (hdc) ;          InvalidateRect (hwnd, NULL, TRUE) ;          ReleaseDC (hwnd, hdc) ;          return TRUE ;     case WM_PALETTECHANGED:          if (!hPalette || (HWND) wParam == hwnd)               break ;          hdc = GetDC (hwnd) ;          SelectPalette (hdc, hPalette, FALSE) ;          RealizePalette (hdc) ;          UpdateColors (hdc) ;          ReleaseDC (hwnd, hdc) ;          break ;     case WM_DESTROY:          DeleteObject (hPalette) ;          PostQuitMessage (0) ;          return 0 ;     }     return DefWindowProc (hwnd, message, wParam, lParam) ;}
开发者ID:Jeanhwea,项目名称:petzold-pw5e,代码行数:94,


示例19: CardImageWndProc

LRESULT CALLBACKCardImageWndProc(HWND hwnd,                 UINT msg,                 WPARAM wParam,                 LPARAM lParam){    PCARDBACK pCardBack = (PCARDBACK)GetWindowLongPtr(hwnd,                                                      GWL_USERDATA);    static WNDPROC hOldProc = NULL;    if (!hOldProc && pCardBack)        hOldProc = pCardBack->hOldProc;    switch (msg)    {    case WM_PAINT:    {        HDC hdc;        PAINTSTRUCT ps;        HPEN hPen, hOldPen;        HBRUSH hBrush, hOldBrush;        RECT rc;        hdc = BeginPaint(hwnd, &ps);        if (pCardBack->bSelected)        {            hPen = CreatePen(PS_SOLID, 2, RGB(0,0,0));        }        else        {            DWORD Face = GetSysColor(COLOR_3DFACE);            hPen = CreatePen(PS_SOLID, 2, Face);        }        GetClientRect(hwnd, &rc);        hBrush = (HBRUSH)GetStockObject(NULL_BRUSH);        hOldPen = (HPEN)SelectObject(hdc, hPen);        hOldBrush = (HBRUSH)SelectObject(hdc, hBrush);        Rectangle(hdc,                  rc.left+1,                  rc.top+1,                  rc.right,                  rc.bottom);        StretchBlt(hdc,                   2,                   2,                   CARDBACK_OPTIONS_WIDTH,                   CARDBACK_OPTIONS_HEIGHT,                   __hdcCardBitmaps,                   pCardBack->hdcNum * __cardwidth,                   0,                   __cardwidth,                   __cardheight,                   SRCCOPY);        SelectObject(hdc, hOldPen);        SelectObject(hdc, hOldBrush);        EndPaint(hwnd, &ps);        break;    }    case WM_LBUTTONDOWN:        pCardBack->bSelected = pCardBack->bSelected ? FALSE : TRUE;        break;    }    return CallWindowProc(hOldProc,                          hwnd,                          msg,                          wParam,                          lParam);}
开发者ID:GYGit,项目名称:reactos,代码行数:77,


示例20: WindowProcedure

//.........这里部分代码省略.........                    PlaySound("goofy.wav", NULL, SND_ASYNC);                    if(coeficient == 1)                    PlaySound("Wolf.wav", NULL, SND_ASYNC);                    DrawEdge(hdc, &diff[i], BDR_RAISEDOUTER | BDR_SUNKENINNER, BF_RECT);                    CheckDlgButton(hwnd, IDs[i], BST_CHECKED);                    nr_differences ++;                    CheckDlgButton(hwnd, IDs[i - + (random * 10)], BST_CHECKED);                   // MessageBoxA(NULL,"You found it! Good Job", "Congrats", MB_OK | MB_ICONINFORMATION);                        if (nr_differences == 10)                        {                            PlaySound("Level.wav", NULL, SND_ASYNC);                            MessageBoxA(NULL,"You won! Go to File->New game", "Congrats", MB_OK | MB_ICONINFORMATION);                        }                    notFound = false;                }            }            if(notFound)                PlaySound("FailSound.wav", NULL, SND_ASYNC);            notFound = true;        }    break;    case WM_LBUTTONDBLCLK:        {                     char str [256];                    POINT pt;                    pt.x = LOWORD(lParam);                    pt.y = HIWORD(lParam);                     wsprintf(str, "Co-ordinates are /nX=%i and Y=%i", pt.x, pt.y);                    MessageBoxA(NULL,str, "Message", MB_OK | MB_ICONINFORMATION);        }    break;    case WM_PAINT:        {            BeginPaint(hwnd, &Ps);            hdcCat1 = CreateCompatibleDC(hdc);            SelectObject(hdcCat1, hbmpImg1);            BitBlt(hdc, 37, 80, bitmapCat1.bmWidth, bitmapCat1.bmHeight, hdcCat1, 0, 0, SRCCOPY);            DeleteObject(hdcCat1);            hdcCat2 = CreateCompatibleDC(hdc);            SelectObject(hdcCat2, hbmpImg2);            BitBlt(hdc, 400, 80, bitmapCat2.bmWidth, bitmapCat2.bmHeight, hdcCat2, 0, 0, SRCCOPY);            DeleteObject(hdcCat2);            // create the title            font_forte   = CreateFont(30, 27.5, 0, 0, FW_DONTCARE, false, false, false,                              DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,                              DEFAULT_QUALITY, FF_DONTCARE, "Forte");            font_forte1  = CreateFont(0, 0, 0, 0, FW_DONTCARE, false, false, false,                              DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,                              DEFAULT_QUALITY, FF_DONTCARE, "Forte");            text_font  = (HFONT)SelectObject(hdc, font_forte);   // setting new font for text            SetTextColor(hdc, TITLE_COLOR);                     // setting new text color            TextOut( hdc, 115, 20,  "Find the difference", 19);            text_font1  = (HFONT)SelectObject(hdc, font_forte1);            TextOut(hdc, 45, 501, current_story, 42);            TextOut(hdc, 45, 520, "And have changed, it needs your ", 32);            TextOut(hdc, 45, 539, "help to find differences!", 25);            DeleteObject(font_forte);            DeleteObject(text_font);            DeleteObject(font_forte1);            DeleteObject(text_font1);            EndPaint(hwnd, &Ps);        }    break;    case WM_CTLCOLORSTATIC:        {            SetBkMode((HDC)wParam,TRANSPARENT);                                // transparent background            hbrush=(HBRUSH)GetStockObject(NULL_BRUSH);                         // handle to brush, no background color            return(LRESULT) hbrush;        }    break;    case WM_DESTROY:        {            DeleteFont(font_forte);            DeleteFont(text_font);            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */        }    break;   // InvalidateRect(hwnd, &all_area, FALSE);        default:                      /* for messages that we don't deal with */            return DefWindowProc (hwnd, message, wParam, lParam);    }    return 0;}
开发者ID:IuraGaitur,项目名称:FindDifference,代码行数:101,


示例21: VolumeControlProc

LRESULT CALLBACK VolumeControlProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){    VolumeControlData *control;    switch(message)    {        case WM_NCCREATE:            {                CREATESTRUCT *pCreateData = (CREATESTRUCT*)lParam;                control = (VolumeControlData*)malloc(sizeof(VolumeControlData));                zero(control, sizeof(VolumeControlData));                SetWindowLongPtr(hwnd, 0, (LONG_PTR)control);                control->curVolume = 1.0f;                control->bDisabled = ((pCreateData->style & WS_DISABLED) != 0);                control->cx = pCreateData->cx;                control->cy = pCreateData->cy;                return TRUE;            }        case WM_DESTROY:            {                control = GetVolumeControlData(hwnd);                if(control)                    free(control);                break;            }        case WM_PAINT:            {                control = GetVolumeControlData(hwnd);                PAINTSTRUCT ps;                HDC hDC = BeginPaint(hwnd, &ps);                control->DrawVolumeControl(hDC);                EndPaint(hwnd, &ps);                break;            }        case WM_LBUTTONDOWN:        case WM_LBUTTONUP:            {                control = GetVolumeControlData(hwnd);                short x = short(LOWORD(lParam));                short y = short(HIWORD(lParam));                UINT id = (UINT)GetWindowLongPtr(hwnd, GWLP_ID);                if(message == WM_LBUTTONDOWN && !control->bDisabled)                {                    if(control->cy == 32 && x >= (control->cx-32))                    {                        if(control->curVolume < 0.05f)                        {                            if(control->lastUnmutedVol < 0.05f)                                control->lastUnmutedVol = 1.0f;                            control->curVolume = control->lastUnmutedVol;                        }                        else                        {                            control->lastUnmutedVol = control->curVolume;                            control->curVolume = 0.0f;                        }                        SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(id, VOLN_FINALVALUE), (LPARAM)hwnd);                    }                    else                    {                        SetCapture(hwnd);                        control->bHasCapture = true;                        if(control->curVolume > 0.05f)                            control->lastUnmutedVol = control->curVolume;                        int cxAdjust = control->cx;                        if(control->bDrawIcon) cxAdjust -= 32;                        control->curVolume = float(x) / cxAdjust;                        SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(id, VOLN_ADJUSTING), (LPARAM)hwnd);                    }                    HDC hDC = GetDC(hwnd);                    control->DrawVolumeControl(hDC);                    ReleaseDC(hwnd, hDC);                }                else if(control->bHasCapture)                {                    UINT id = (UINT)GetWindowLongPtr(hwnd, GWLP_ID);                    SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(id, VOLN_FINALVALUE), (LPARAM)hwnd);                    ReleaseCapture();                    control->bHasCapture = false;                }//.........这里部分代码省略.........
开发者ID:AndrewHolder,项目名称:OBS,代码行数:101,


示例22: DlgProc

//.........这里部分代码省略.........                               0,                               0,                               pInfo->headerbitmap.bmWidth,                               pInfo->headerbitmap.bmHeight,                               SRCCOPY);                    SelectObject(hdcMem, hBmpOld);                    txtRc.left = bmpRc.right / 4;                    txtRc.top = 10;                    txtRc.right = bmpRc.right * 3 / 4;                    txtRc.bottom = pInfo->headerbitmap.bmHeight / 2;                    ZeroMemory(&lf, sizeof(LOGFONTW));                    if (LoadStringW(hInst,                                    IDS_HEADERTEXT1,                                    szBuffer,                                    sizeof(szBuffer) / sizeof(WCHAR)))                    {                        lf.lfHeight = 24;                        lf.lfCharSet = OEM_CHARSET;                        lf.lfQuality = DEFAULT_QUALITY;                        lf.lfWeight = FW_MEDIUM;                        wcscpy(lf.lfFaceName, L"Tahoma");                        hFont = CreateFontIndirectW(&lf);                        if (hFont)                        {                            hFontOld = SelectObject(hdc, hFont);                            DPtoLP(hdc, (PPOINT)&txtRc, 2);                            SetTextColor(hdc, RGB(255,255,255));                            SetBkMode(hdc, TRANSPARENT);                            DrawTextW(hdc,                                      szBuffer,                                      -1,                                      &txtRc,                                      DT_BOTTOM | DT_SINGLELINE | DT_NOCLIP);                            SelectObject(hdc, hFontOld);                            DeleteObject(hFont);                        }                    }                    txtRc.left = bmpRc.right / 4;                    txtRc.top = txtRc.bottom - 5;                    txtRc.right = bmpRc.right * 3 / 4;                    txtRc.bottom = pInfo->headerbitmap.bmHeight * 9 / 10;                    if (LoadStringW(hInst,                                    IDS_HEADERTEXT2,                                    szBuffer,                                    sizeof(szBuffer) / sizeof(WCHAR)))                    {                        lf.lfHeight = 30;                        lf.lfCharSet = OEM_CHARSET;                        lf.lfQuality = DEFAULT_QUALITY;                        lf.lfWeight = FW_EXTRABOLD;                        wcscpy(lf.lfFaceName, L"Tahoma");                        hFont = CreateFontIndirectW(&lf);                        if (hFont)                        {                            hFontOld = SelectObject(hdc, hFont);                            DPtoLP(hdc, (PPOINT)&txtRc, 2);                            SetTextColor(hdc, RGB(255,255,255));                            SetBkMode(hdc, TRANSPARENT);                            DrawTextW(hdc,                                      szBuffer,                                      -1,                                      &txtRc,                                      DT_TOP | DT_SINGLELINE);                            SelectObject(hdc, hFontOld);                            DeleteObject(hFont);                        }                    }                    DeleteDC(hdcMem);                }                EndPaint(hDlg, &ps);            }            break;        }        case WM_CLOSE:        {            Cleanup(pInfo);            EndDialog(hDlg, 0);        }        break;HandleDefaultMessage:        default:            return FALSE;    }    return FALSE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:101,


示例23: WndProc

////  函数: WndProc(HWND, UINT, WPARAM, LPARAM)////  目的: 处理主窗口的消息。////  WM_COMMAND	- 处理应用程序菜单//  WM_PAINT	- 绘制主窗口//  WM_DESTROY	- 发送退出消息并返回////LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	int wmId, wmEvent;	PAINTSTRUCT ps;	HDC hdc;	static HWND hwndNextViewer; 	HGLOBAL hGlobal;	PTSTR pGlobal;	RECT rect;	switch (message)	{	case WM_CREATE:		hwndNextViewer = SetClipboardViewer(hWnd);		break;	case WM_CHANGECBCHAIN:		if((HWND)wParam == hwndNextViewer)			hwndNextViewer = (HWND)lParam;		else if(hwndNextViewer)			SendMessage(hwndNextViewer, message, wParam, lParam);		//return 0;		break;	case WM_DRAWCLIPBOARD:		if(hwndNextViewer)			SendMessage(hwndNextViewer, message, wParam, lParam);		InvalidateRect(hWnd, NULL, TRUE);		//return 0;		break;	case WM_COMMAND:		wmId    = LOWORD(wParam);		wmEvent = HIWORD(wParam);		// 分析菜单选择:		switch (wmId)		{		case IDM_ABOUT:			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);			break;		case IDM_EXIT:			DestroyWindow(hWnd);			break;		default:			return DefWindowProc(hWnd, message, wParam, lParam);		}		break;	case WM_PAINT:		hdc = BeginPaint(hWnd, &ps);		// TODO: 在此添加任意绘图代码...		// OpenClipboard, GetClipboardData, CloseClipboard		GetClientRect(hWnd, &rect);		OpenClipboard(hWnd);#ifdef UNICODE		hGlobal = GetClipboardData(CF_UNICODETEXT);#else 		hGlobal = GetClipboardData(CF_TEXT);#endif		if(hGlobal != NULL)		{			pGlobal = (PTSTR)GlobalLock(hGlobal);			DrawText(hdc, pGlobal, -1, &rect, DT_EXPANDTABS);			GlobalUnlock(hGlobal);		}		CloseClipboard();		EndPaint(hWnd, &ps);		break;	case WM_DESTROY:		ChangeClipboardChain(hWnd, hwndNextViewer);		PostQuitMessage(0);		//return 0;		break;	default:		return DefWindowProc(hWnd, message, wParam, lParam);	}	return 0;}
开发者ID:e232e,项目名称:ClipboardMonitor,代码行数:86,


示例24: ContactListControlWndProc

//.........这里部分代码省略.........					break;				}			}			else {				contact->xStatus = cfg::getByte(hContact, szProto, "XStatusId", 0);				p = contact->pExtra;			}			if (szProto == NULL)				break;			if (contact) {				if (ProtoServiceExists(szProto, PS_GETADVANCEDSTATUSICON)) {					int iconId = ProtoCallService(szProto, PS_GETADVANCEDSTATUSICON, hContact, 0);					if (iconId != -1)						contact->xStatusIcon = iconId >> 16;				}			}			GetCachedStatusMsg(p, szProto);			PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));		}		goto LBL_Def;	case WM_PAINT:		{			PAINTSTRUCT ps;			HDC hdc = BeginPaint(hwnd, &ps);			if (IsWindowVisible(hwnd) && !during_sizing && !cfg::shutDown) {				PaintClc(hwnd, dat, hdc, &ps.rcPaint);				dat->bNeedPaint = FALSE;				dat->lastRepaint = GetTickCount();			}			EndPaint(hwnd, &ps);			if (dat->selection != dat->oldSelection && !dat->bisEmbedded && g_ButtonItems != NULL) {				SetDBButtonStates(0);				dat->oldSelection = dat->selection;			}		}		goto LBL_Def;	case WM_MOUSEWHEEL:		dat->forceScroll = TRUE;		break;	case WM_TIMER:		if (wParam == TIMERID_PAINT) {			KillTimer(hwnd, TIMERID_PAINT);			InvalidateRect(hwnd, NULL, FALSE);			goto LBL_Def;		}		if (wParam == TIMERID_REFRESH) {			InvalidateRect(hwnd, NULL, FALSE);			goto LBL_Def;		}		break;	case WM_LBUTTONDBLCLK:		ReleaseCapture();		dat->iHotTrack = -1;		pcli->pfnHideInfoTip(hwnd, dat);		KillTimer(hwnd, TIMERID_RENAME);		KillTimer(hwnd, TIMERID_INFOTIP);		dat->szQuickSearch[0] = 0;		{
开发者ID:biddyweb,项目名称:miranda-ng,代码行数:67,


示例25: WndProc

////  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)////  PURPOSE:  Processes messages for the main window.////  WM_COMMAND	- process the application menu//  WM_PAINT	- Paint the main window//  WM_DESTROY	- post a quit message and return////LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	int wmId, wmEvent;	PAINTSTRUCT ps;	HDC hdc;    static RECT rcce = { 0 };    static RECT rcst = { 0 };    static RECT rcsd = { 200, 200, 200, 200 };    switch (message)	{	    case WM_COMMAND:		    wmId    = LOWORD(wParam);		    wmEvent = HIWORD(wParam);		    // Parse the menu selections:		    switch (wmId)		    {		    case IDM_ABOUT:			    DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);			    break;		    case IDM_EXIT:			    DestroyWindow(hWnd);			    break;		    default:			    return DefWindowProc(hWnd, message, wParam, lParam);		    }		    break;	    case WM_PAINT:		    hdc = BeginPaint(hWnd, &ps);		    // TODO: Add any drawing code here...		    EndPaint(hWnd, &ps);		    break;	    case WM_DESTROY:		    PostQuitMessage(0);		    break;        case WM_NCLBUTTONDOWN:            {                POINT pt = { 0 };                pt.x = GET_X_LPARAM(lParam);                pt.y = GET_Y_LPARAM(lParam);                RECT rc = { 0 };                ::GetWindowRect(hWnd, &rc);                // Cursor to edge                rcce.left = rc.left - pt.x;                rcce.top = rc.top - pt.y;                rcce.right = rc.right - pt.x;                rcce.bottom = rc.bottom - pt.y;                return DefWindowProc(hWnd, message, wParam, lParam);            }            break;        case WM_ENTERSIZEMOVE:            {                // Snap zone = Work area                ::SystemParametersInfo(SPI_GETWORKAREA, 0, &rcst, 0);            }            break;        case WM_EXITSIZEMOVE:            break;        case WM_MOVING:            {                LPRECT lprc = (LPRECT)lParam;                POINT pt = { 0 };                ::GetCursorPos(&pt);                ::SnapUnsnapRect(lprc, &pt, &rcce, &rcst, &rcsd);            }            break;        case WM_SIZING:            {                PRECT prc = (PRECT)lParam;                switch (wParam)                {                    case WMSZ_LEFT:                        if (prc->left < rcst.left + rcsd.left)                            prc->left = rcst.left;                        break;                    case WMSZ_RIGHT:                        if (prc->right > rcst.right - rcsd.right)                            prc->right = rcst.right;                        break;                    case WMSZ_TOP:                        if (prc->top < rcst.top + rcsd.top)//.........这里部分代码省略.........
开发者ID:dranger003,项目名称:Win32Project3,代码行数:101,


示例26: WndProc

//.........这里部分代码省略.........					TextOut(hdc, 20,200,s, s.GetLength());					SetFocus(hWnd);				}			}			else if (state == Animate)			{				step = STEP;				SetTimer(hWnd, ID_TIMER, 10 , NULL); //update every 10 milliseconds			}		}		InvalidateRect (hWnd, NULL, TRUE) ;		break;	case WM_PAINT:		hdc = BeginPaint(hWnd, &ps);		// TODO: Add any drawing code here...		//create the pen & brush inside "case" and delete before leave!		hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); // black		pieceBrush[0] = CreateSolidBrush(RGB(255, 255, 255)); // white		pieceBrush[1] = CreateSolidBrush(RGB(0, 0, 0)); // black		boardBrush[0] = CreateSolidBrush(RGB(255, 255, 255)); // white		boardBrush[1] = CreateSolidBrush(RGB(200, 200, 200)); // gray		boardBrush[2] = CreateSolidBrush(RGB(0, 200, 0)); // green		// Select our green pen into the device context and remember previous pen		oldPen = (HPEN)SelectObject(hdc, hPen);		oldBrush = (HBRUSH)SelectObject(hdc, pieceBrush[0]);		// draw back ground board		for (int i = 0 ; i < 8 ; i++)		for (int j = 0 ; j < 8 ; j++)		{			rect.top = i * LENGTH; 			rect.bottom = (i + 1) * LENGTH; 			rect.left = j * LENGTH; 			rect.right = (j + 1) * LENGTH;			FillRect(hdc, &rect, boardBrush[(i+j)%2]);		}				// draw pick board		if (state == MoveDrop || state == JumpDrop || state == MultiJump || state == Animate){			rect.top = rc.x_pick * LENGTH; 			rect.bottom = (rc.x_pick + 1) * LENGTH; 			rect.left = rc.y_pick * LENGTH; 			rect.right = (rc.y_pick + 1) * LENGTH;			FillRect(hdc, &rect, boardBrush[2]);		}				// draw piece		for (int i = 0 ; i < 8 ; i++)		for (int j = 0 ; j < 8 ; j++)		{			if(board[i][j] != 0) // i & j is transpost in board			{				SelectObject(hdc, pieceBrush[(board[i][j]+1)%2]); // WHITE % 2 = 1, BLACK % 2 = 0;				Ellipse (hdc, j * LENGTH + 10, i * LENGTH + 10, (j+1) * LENGTH - 10, (i+1) * LENGTH - 10) ;								SelectObject(hdc, pieceBrush[board[i][j]%2]);				Ellipse (hdc, j * LENGTH + 30, i * LENGTH + 30, (j+1) * LENGTH - 30, (i+1) * LENGTH - 30) ;			}		}		// draw moving piece		if (state == Animate){			int xCurrent = (STEP - step) * (rc.x_drop * LENGTH - rc.x_pick * LENGTH)/STEP + rc.x_pick * LENGTH;			int yCurrent = (STEP - step) * (rc.y_drop * LENGTH - rc.y_pick * LENGTH)/STEP + rc.y_pick * LENGTH;			SelectObject(hdc, pieceBrush[(role+1)%2]);			Ellipse (hdc, yCurrent + 10, xCurrent + 10, yCurrent + LENGTH - 10, xCurrent + LENGTH - 10) ;			SelectObject(hdc, pieceBrush[role%2]);			Ellipse (hdc, yCurrent + 30, xCurrent + 30, yCurrent + LENGTH - 30, xCurrent + LENGTH - 30) ;		}		// Do not forget to clean up.		// Select the old pen back into the device context		SelectObject(hdc, oldPen);		DeleteObject(hPen);		SelectObject(hdc, oldBrush);		DeleteObject(pieceBrush[0]);		DeleteObject(pieceBrush[1]);		DeleteObject(boardBrush[0]);		DeleteObject(boardBrush[1]);		DeleteObject(boardBrush[2]);		EndPaint(hWnd, &ps);		break;	case WM_DESTROY:		PostQuitMessage(0);		break;	default:		return DefWindowProc(hWnd, message, wParam, lParam);	}	return 0;}
开发者ID:benyl,项目名称:Checkers,代码行数:101,


示例27: WndProc

//.........这里部分代码省略.........          GetScrollInfo (hwnd, SB_HORZ, &si) ;                         // If the position has changed, scroll the window           if (si.nPos != iHorzPos)          {               ScrollWindow (hwnd, cxChar * (iHorzPos - si.nPos), 0,                              NULL, NULL) ;          }          return 0 ;     case WM_KEYDOWN:          switch (wParam)          {          case VK_HOME:               SendMessage (hwnd, WM_VSCROLL, SB_TOP, 0) ;               break ;                         case VK_END:               SendMessage (hwnd, WM_VSCROLL, SB_BOTTOM, 0) ;               break ;                         case VK_PRIOR:               SendMessage (hwnd, WM_VSCROLL, SB_PAGEUP, 0) ;               break ;                         case VK_NEXT:               SendMessage (hwnd, WM_VSCROLL, SB_PAGEDOWN, 0) ;               break ;                         case VK_UP:               SendMessage (hwnd, WM_VSCROLL, SB_LINEUP, 0) ;               break ;                         case VK_DOWN:               SendMessage (hwnd, WM_VSCROLL, SB_LINEDOWN, 0) ;               break ;                         case VK_LEFT:               SendMessage (hwnd, WM_HSCROLL, SB_PAGEUP, 0) ;               break ;                         case VK_RIGHT:               SendMessage (hwnd, WM_HSCROLL, SB_PAGEDOWN, 0) ;               break ;          }          return 0 ;     case WM_PAINT:          hdc = BeginPaint (hwnd, &ps) ;               // Get vertical scroll bar position          si.cbSize = sizeof (si) ;          si.fMask  = SIF_POS ;          GetScrollInfo (hwnd, SB_VERT, &si) ;          iVertPos = si.nPos ;               // Get horizontal scroll bar position          GetScrollInfo (hwnd, SB_HORZ, &si) ;          iHorzPos = si.nPos ;               // Find painting limits          iPaintBeg = max (0, iVertPos + ps.rcPaint.top / cyChar) ;          iPaintEnd = min (NUMLINES - 1,                           iVertPos + ps.rcPaint.bottom / cyChar) ;                    for (i = iPaintBeg ; i <= iPaintEnd ; i++)          {               x = cxChar * (1 - iHorzPos) ;               y = cyChar * (i - iVertPos) ;                              TextOut (hdc, x, y,                        sysmetrics[i].szLabel,                        lstrlen (sysmetrics[i].szLabel)) ;                              TextOut (hdc, x + 22 * cxCaps, y,                        sysmetrics[i].szDesc,                        lstrlen (sysmetrics[i].szDesc)) ;                              SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;                              TextOut (hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer,                        wsprintf (szBuffer, TEXT ("%5d"),                             GetSystemMetrics (sysmetrics[i].iIndex))) ;                              SetTextAlign (hdc, TA_LEFT | TA_TOP) ;          }          EndPaint (hwnd, &ps) ;          return 0 ;               case WM_DESTROY:          PostQuitMessage (0) ;          return 0 ;     }     return DefWindowProc (hwnd, message, wParam, lParam) ;}
开发者ID:Jeanhwea,项目名称:petzold-pw5e,代码行数:101,


示例28: Listview_WindowProc

//.........这里部分代码省略.........			{				int preflen = sizeof(DBF_CONTROL) / sizeof(TCHAR) - 1, chr = 0;				while(chr <= preflen && pszClassName[chr] == DBF_CONTROL[chr] )					chr++;				if ( chr == preflen )				{					WNDCLASS wc = { 0 };					if ( GetClassInfo( (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), &pszClassName[chr], &wc ) )					{						SetWindowLong(hwnd, 12, (LONG) wc.lpfnWndProc);						lv->pfnWndProc = wc.lpfnWndProc;						lv->fIsListView = FALSE;						pwndProc = wc.lpfnWndProc;					}					else						return FALSE;				}				else					return FALSE;			}			SetRect(&lv->rc,						LPCREATESTRUCT(lParam)->x,						LPCREATESTRUCT(lParam)->y,						LPCREATESTRUCT(lParam)->cx,						LPCREATESTRUCT(lParam)->cy						);			lv->hHeader = NULL;			break;		}	case WM_ERASEBKGND:		{			if ( lv->fIsListView )			{				if ( !lv->hHeader ) lv->hHeader = (HWND) lv->pfnWndProc(hwnd, LVM_GETHEADER, 0, 0);				GetClientRect(lv->hHeader, &lv->header_rc);				return CallWindowProc(lv->pfnWndProc, hwnd, uMsg, WPARAM(lv->hDC), lParam);			}			else				return pwndProc(hwnd, uMsg, WPARAM(lv->hDC), lParam);			break;		}	case WM_SIZING:	case WM_SIZE:		{			GetClientRect(hwnd, &lv->rc);			if ( lv->fIsListView )			{				if ( !lv->hHeader ) lv->hHeader = (HWND) lv->pfnWndProc(hwnd, LVM_GETHEADER, 0, 0);				GetClientRect(lv->hHeader, &lv->header_rc);			}			break;		}	case WM_PRINT:		{			WNDPROC pwnd = ( lv->fIsListView ? lv->pfnWndProc : pwndProc );//			pwnd(hwnd, WM_ERASEBKGND, (WPARAM) lv->hDC, 0);//			pwnd(hwnd, WM_PAINT, (WPARAM) lv->hDC, 0);			pwnd(hwnd, WM_PRINT, (WPARAM) lv->hDC, lParam);			if ( !PBYTE(lv->pvBits)[0] )				FillRect((HDC) wParam, &lv->rc, GetSysColorBrush(COLOR_WINDOW));			else				BitBlt((HDC) wParam, 0, 0, lv->rc.right, lv->rc.bottom, lv->hDC, 0, 0, SRCCOPY);			return 0;		}	case WM_PAINT:		{			PAINTSTRUCT ps = { 0 };			HDC hdc = BeginPaint(hwnd, &ps);			if ( lv->fIsListView )				CallWindowProc(lv->pfnWndProc, hwnd, uMsg, WPARAM(lv->hDC), lParam);			else				pwndProc(hwnd, uMsg, WPARAM(lv->hDC), lParam);						if ( lv->fIsListView )				BitBlt(hdc, 0, lv->header_rc.bottom, lv->rc.right, lv->rc.bottom - lv->header_rc.bottom, lv->hDC, 0, lv->header_rc.bottom, SRCCOPY);			else				BitBlt(hdc, 0, 0, lv->rc.right, lv->rc.bottom, lv->hDC, 0, 0, SRCCOPY);			EndPaint(hwnd, &ps);			return 0;		}	case WM_NCDESTROY:		{			LRESULT ret = ( lv->fIsListView ? lv->pfnWndProc(hwnd, uMsg, wParam, lParam) : pwndProc(hwnd, uMsg, wParam, lParam) );			UninitializeListViewInstance(hwnd);			return ret;		}	}	if ( lv->fIsListView && lv->pfnWndProc )		return lv->pfnWndProc(hwnd, uMsg, wParam, lParam);	else if ( !lv->fIsListView && pwndProc )		return pwndProc(hwnd, uMsg, wParam, lParam);	return DefWindowProc(hwnd, uMsg, wParam, lParam);}
开发者ID:loginsinex,项目名称:smb2,代码行数:101,


示例29: PluginWndProc

LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam){    NPP instance = (NPP)GetWindowLongPtr(hWnd, GWLP_USERDATA);        if (uiMsg == WM_PAINT)    {        InstanceData *data = (InstanceData *)instance->pdata;                PAINTSTRUCT ps;        HDC hDC = BeginPaint(hWnd, &ps);        HBRUSH brushBg = CreateSolidBrush(COL_WINDOW_BG);        HFONT hFont = GetSimpleFont(hDC, L"MS Shell Dlg", 14);        bool isRtL = IsLanguageRtL(gTranslationIdx);                // set up double buffering        RectI rcClient = ClientRect(hWnd);        DoubleBuffer buffer(hWnd, rcClient);        HDC hDCBuffer = buffer.GetDC();                // display message centered in the window        FillRect(hDCBuffer, &rcClient.ToRECT(), brushBg);        hFont = (HFONT)SelectObject(hDCBuffer, hFont);        SetTextColor(hDCBuffer, RGB(0, 0, 0));        SetBkMode(hDCBuffer, TRANSPARENT);        DrawCenteredText(hDCBuffer, rcClient, data->message, isRtL);                // draw a progress bar, if a download is in progress        if (0 < data->progress && data->progress <= 1)        {            SIZE msgSize;            RectI rcProgress = rcClient;                        HBRUSH brushProgress = CreateSolidBrush(RGB(0x80, 0x80, 0xff));            GetTextExtentPoint32(hDCBuffer, data->message, (int)str::Len(data->message), &msgSize);            rcProgress.Inflate(-(rcProgress.dx - msgSize.cx) / 2, -(rcProgress.dy - msgSize.cy) / 2 + 2);            rcProgress.Offset(0, msgSize.cy + 4 + 2);            FillRect(hDCBuffer, &rcProgress.ToRECT(), GetStockBrush(WHITE_BRUSH));            RectI rcProgressAll = rcProgress;            rcProgress.dx = (int)(data->progress * rcProgress.dx);            FillRect(hDCBuffer, &rcProgress.ToRECT(), brushProgress);            DeleteObject(brushProgress);                        ScopedMem<WCHAR> currSize(FormatSizeSuccint(data->currSize));            if (0 == data->totalSize || data->currSize > data->totalSize)            {                // total size unknown or bogus => show just the current size                DrawCenteredText(hDCBuffer, rcProgressAll, currSize, isRtL);            }            else            {                ScopedMem<WCHAR> totalSize(FormatSizeSuccint(data->totalSize));                ScopedMem<WCHAR> s(str::Format(_TR("%s of %s"), currSize, totalSize));                DrawCenteredText(hDCBuffer, rcProgressAll, s, isRtL);            }        }                // draw the buffer on screen        buffer.Flush(hDC);                DeleteObject(SelectObject(hDCBuffer, hFont));        DeleteObject(brushBg);        EndPaint(hWnd, &ps);                HWND hChild = FindWindowEx(hWnd, NULL, NULL, NULL);        if (hChild)            InvalidateRect(hChild, NULL, FALSE);    }    else if (uiMsg == WM_SIZE)    {        HWND hChild = FindWindowEx(hWnd, NULL, NULL, NULL);        if (hChild)        {            ClientRect rcClient(hWnd);            MoveWindow(hChild, rcClient.x, rcClient.y, rcClient.dx, rcClient.dy, FALSE);        }    }    else if (uiMsg == WM_COPYDATA)    {        COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam;        if (cds && 0x4C5255 /* URL */ == cds->dwData)        {            plogf("sp: NPN_GetURL %s", cds->dwData, (const char *)cds->lpData);            gNPNFuncs.geturl(instance, (const char *)cds->lpData, "_blank");            return TRUE;        }    }        return DefWindowProc(hWnd, uiMsg, wParam, lParam);}
开发者ID:kindleStudy,项目名称:sumatrapdf,代码行数:89,



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


C++ EndPath函数代码示例
C++ EndPage函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。