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


C++ EndPaint函数代码示例

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


在下文中一共展示了EndPaint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:EPIC.cpp

示例2: WndPauseProc

LRESULT CALLBACK
WndPauseProc(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,代码来源:wpause.c

示例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,代码来源:Gdi.cpp

示例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,代码来源:CtrlDisAsmView.cpp

示例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,代码来源:CLCButton.cpp

示例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,代码来源:源.cpp

示例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,代码来源:PPC+Media+Server.cpp

示例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,代码来源:ob_filter.cpp

示例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,代码来源:win_wao.cpp

示例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,代码来源:ChatView.cpp

示例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,代码来源:bd_mainw.c

示例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,代码来源:Main.cpp

示例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,代码来源:DDECLNT.C

示例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,代码来源:fdebug.c

示例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,代码来源:ddvideo.cpp


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