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

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

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

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

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

示例1: GetWindowText

bool CFloatEdit::GetFloat(float& f){	CString s;	GetWindowText(s);	return(_stscanf(s, _T("%f"), &f) == 1);}
开发者ID:banduladh,项目名称:meplayer,代码行数:6,


示例2: dialog_settings_proc

LRESULT WINAPIdialog_settings_proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){    switch (message)    {        case WM_INITDIALOG:        {            CHAR port_tmp[16];            SetWindowText(GetDlgItem(hDlg, IDC_ADDRESS), options.proxy_address);            SetWindowText(GetDlgItem(hDlg, IDC_USERNAME), options.proxy_auth_user);            SetWindowText(GetDlgItem(hDlg, IDC_PASSWORD), options.proxy_auth_password);            SendMessage(GetDlgItem(hDlg, IDC_PROXY), BM_SETCHECK,                options.proxy_enabled ? BST_CHECKED : BST_UNCHECKED, 0);            SendMessage(GetDlgItem(hDlg, IDC_AUTH), BM_SETCHECK,                options.proxy_auth_required ? BST_CHECKED : BST_UNCHECKED, 0);            _itoa_s(options.proxy_port, port_tmp, sizeof(port_tmp), 10);            SetWindowText(GetDlgItem(hDlg, IDC_PORT), port_tmp);            // actualize enabled/disabled controls state            dialog_settings_proc(hDlg, WM_COMMAND, IDC_PROXY, 0);        }        break;        case WM_COMMAND:        {            if (LOWORD(wParam) == IDOK)             {                CHAR port_tmp[16];                LRESULT proxy = SendMessage(GetDlgItem(hDlg, IDC_PROXY), BM_GETCHECK, 0, 0),                    auth = SendMessage(GetDlgItem(hDlg, IDC_AUTH), BM_GETCHECK, 0, 0);                options.proxy_enabled = (proxy == BST_CHECKED);                options.proxy_auth_required = (auth == BST_CHECKED);                GetWindowText(GetDlgItem(hDlg, IDC_ADDRESS), options.proxy_address,                    sizeof(options.proxy_address));                GetWindowText(GetDlgItem(hDlg, IDC_USERNAME), options.proxy_auth_user,                    sizeof(options.proxy_auth_user));                GetWindowText(GetDlgItem(hDlg, IDC_PASSWORD), options.proxy_auth_password,                    sizeof(options.proxy_auth_password));                GetWindowText(GetDlgItem(hDlg, IDC_PORT), port_tmp, sizeof(port_tmp));                options.proxy_port = atoi(port_tmp);                options_save();                EndDialog(hDlg, LOWORD(wParam));                return TRUE;            }            else if (LOWORD(wParam) == IDCANCEL)            {                EndDialog(hDlg, LOWORD(wParam));                return TRUE;            }            else if (LOWORD(wParam) == IDC_PROXY ||                     LOWORD(wParam) == IDC_AUTH)            {                LRESULT proxy = SendMessage(GetDlgItem(hDlg, IDC_PROXY), BM_GETCHECK, 0, 0),                    auth = SendMessage(GetDlgItem(hDlg, IDC_AUTH), BM_GETCHECK, 0, 0);                EnableWindow(GetDlgItem(hDlg, IDC_ADDRESS), (proxy == BST_CHECKED));                EnableWindow(GetDlgItem(hDlg, IDC_PORT), (proxy == BST_CHECKED));                EnableWindow(GetDlgItem(hDlg, IDC_AUTH), (proxy == BST_CHECKED));                EnableWindow(GetDlgItem(hDlg, IDC_USERNAME), (proxy == BST_CHECKED && auth == BST_CHECKED));                EnableWindow(GetDlgItem(hDlg, IDC_PASSWORD), (proxy == BST_CHECKED && auth == BST_CHECKED));            }        }        break;    }    return FALSE;}
开发者ID:luza,项目名称:tehpatcher,代码行数:77,


示例3: Proc

BOOL CALLBACK Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){	switch(msg) {	case WM_INITDIALOG: {		Rect wr;		SystemParametersInfo(SPI_GETWORKAREA, 0, wr, 0);		Rect dr;		GetWindowRect(hwnd, dr);		Point p = wr.CenterPos(dr.Size());		SetWindowPos(hwnd, 0, p.x, p.y, dr.Width(), dr.Height(),		             SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOZORDER);		SetWindowText(GetDlgItem(hwnd, 101), "C://upp");		SendDlgItemMessage(hwnd, 101, EM_SETSEL, (WPARAM) 0, (LPARAM) -1);		SetWindowText(hwnd, GetExeTitle()); 		break;	}	case WM_COMMAND:		switch(LOWORD(wParam)) {		case IDOK: {			char h[2048];			GetWindowText(GetDlgItem(hwnd, 101), h, 2048);			String exe = AppendFileName(h, "theide.exe");			if(FileExists(exe)) {				MessageBox(::GetActiveWindow(),				           "Please uninstall previous version before installing the new one.",			               "Ultimate++", MB_ICONSTOP | MB_OK | MB_APPLMODAL);				WinExec(exe + " -uninstall", SW_SHOWNORMAL);				break;			}			ProgressMeter pi;			pi.SetText("Installing files");			HRSRC hrsrc = FindResource(NULL, LPCTSTR(1112), RT_RCDATA);			if(!hrsrc) Error();			outdir = h;			LZMAExtract((const char *)LockResource(LoadResource(NULL, hrsrc)), SizeofResource(NULL, hrsrc),			            h, pi);			if (BST_CHECKED == SendDlgItemMessage(hwnd, 10 /*IDC_ASSOC*/, BM_GETCHECK, 0, 0)) {				SetWinRegString(exe, "", "SOFTWARE//Microsoft//Windows//CurrentVersion//App Paths//theide.exe//");				SetWinRegString(h, "Path", "SOFTWARE//Microsoft//Windows//CurrentVersion//App Paths//theide.exe//");				SetWinRegString("TheIDE.upp", "", ".upp//", HKEY_CLASSES_ROOT);				SetWinRegString("open", "", "TheIDE.upp//shell//", HKEY_CLASSES_ROOT);				SetWinRegString("/"" + exe + "/" /"%1/"", "", "TheIDE.upp//shell//open//command//", HKEY_CLASSES_ROOT);			}			pi.Destroy();			FileMove(AppendFileName(h, IsWow64() ? "theide64.exe" : "theide32.exe"), exe);			EndDialog(hwnd, 0);			WinExec(exe, SW_SHOWNORMAL);			break;		}		case 999: {		    BOOL retVal;			char Folder[256] = "C://";			char FolderName[17] = "Select Directory";			if(BrowseFolder( 0, Folder, FolderName)) {				strcat(Folder, "//upp");				SetWindowText(GetDlgItem(hwnd, 101), Folder);			}			break;		}		case IDCANCEL:			EndDialog(hwnd, 0);			break;		}	}	return 0;}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:67,


示例4: GetWindowText

bool BButton::GetString(CString* str){	GetWindowText(*str);	return true;}
开发者ID:berendeanicolae,项目名称:gml,代码行数:5,


示例5: InputLineWndProc

LONG WINAPI InputLineWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {	int key, cursor;	switch ( uMsg ) {	case WM_KILLFOCUS:		if ( ( HWND ) wParam == s_wcd.hWnd || ( HWND ) wParam == s_wcd.hwndErrorBox ) {			SetFocus( hWnd );			return 0;		}		break;	case WM_KEYDOWN:		key = Win_MapKey( lParam );		// command history		if ( ( key == K_UPARROW ) || ( key == K_KP_UPARROW ) ) {			if ( s_wcd.nextHistoryLine - s_wcd.historyLine < COMMAND_HISTORY && s_wcd.historyLine > 0 ) {				s_wcd.historyLine--;			}			s_wcd.consoleField = s_wcd.historyEditLines[ s_wcd.historyLine % COMMAND_HISTORY ];			SetWindowText( s_wcd.hwndInputLine, s_wcd.consoleField.GetBuffer() );			SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.consoleField.GetCursor(), s_wcd.consoleField.GetCursor() );			return 0;		}		if ( ( key == K_DOWNARROW ) || ( key == K_KP_DOWNARROW ) ) {			if ( s_wcd.historyLine == s_wcd.nextHistoryLine ) {				return 0;			}			s_wcd.historyLine++;			s_wcd.consoleField = s_wcd.historyEditLines[ s_wcd.historyLine % COMMAND_HISTORY ];			SetWindowText( s_wcd.hwndInputLine, s_wcd.consoleField.GetBuffer() );			SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.consoleField.GetCursor(), s_wcd.consoleField.GetCursor() );			return 0;		}		break;	case WM_CHAR:		key = Win_MapKey( lParam );		GetWindowText( s_wcd.hwndInputLine, s_wcd.consoleField.GetBuffer(), MAX_EDIT_LINE );		SendMessage( s_wcd.hwndInputLine, EM_GETSEL, (WPARAM) NULL, (LPARAM) &cursor );		s_wcd.consoleField.SetCursor( cursor );		// enter the line		if ( key == K_ENTER || key == K_KP_ENTER ) {			strncat( s_wcd.consoleText, s_wcd.consoleField.GetBuffer(), sizeof( s_wcd.consoleText ) - strlen( s_wcd.consoleText ) - 5 );			strcat( s_wcd.consoleText, "/n" );			SetWindowText( s_wcd.hwndInputLine, "" );			Sys_Printf( "]%s/n", s_wcd.consoleField.GetBuffer() );			// copy line to history buffer			s_wcd.historyEditLines[s_wcd.nextHistoryLine % COMMAND_HISTORY] = s_wcd.consoleField;			s_wcd.nextHistoryLine++;			s_wcd.historyLine = s_wcd.nextHistoryLine;			s_wcd.consoleField.Clear();			return 0;		}		// command completion		if ( key == K_TAB ) {			s_wcd.consoleField.AutoComplete();			SetWindowText( s_wcd.hwndInputLine, s_wcd.consoleField.GetBuffer() );			//s_wcd.consoleField.SetWidthInChars( strlen( s_wcd.consoleField.GetBuffer() ) );			SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.consoleField.GetCursor(), s_wcd.consoleField.GetCursor() );			return 0;		}		// clear autocompletion buffer on normal key input		if ( ( key >= K_SPACE && key <= K_BACKSPACE ) ||			( key >= K_KP_SLASH && key <= K_KP_PLUS ) || ( key >= K_KP_STAR && key <= K_KP_EQUALS ) ) {			s_wcd.consoleField.ClearAutoComplete();		}		break;	}	return CallWindowProc( (WNDPROC)s_wcd.SysInputLineWndProc, hWnd, uMsg, wParam, lParam );}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:84,


示例6: WndText

wchar_t* WndText(HWND hWnd){	static WCHAR title[200];	GetWindowText(hWnd, title, 200);	return title;}
开发者ID:gurrhack,项目名称:RestoreWindows,代码行数:6,


示例7: HelpdlgWndProc

static LONG APIENTRY HelpdlgWndProc(HWND hWnd,UINT uMsg,				    UINT wParam,				    LONG lParam){  PAINTSTRUCT ps;  HDC hdc;  switch (uMsg)    {    case WM_CREATE:      helpdlg_win=hWnd;      return 0;    case WM_DESTROY:      helpdlg_win=NULL;      break;    case WM_GETMINMAXINFO:          break;    case WM_SIZE:      break;    case WM_CLOSE:      DestroyWindow(hWnd);      break;    case WM_PAINT:      hdc=BeginPaint(hWnd,(LPPAINTSTRUCT)&ps);      if (drawn_unit_type)	help_draw_unit(hdc, drawn_unit_type);      EndPaint(hWnd,(LPPAINTSTRUCT)&ps);      break;    case WM_COMMAND:      switch (LOWORD(wParam))	{	case IDCANCEL:	  DestroyWindow(hWnd);	  break;	case ID_HELP_TECH_LINK:	case ID_HELP_UNIT_LINK:	case ID_HELP_WONDER_LINK:	case ID_HELP_IMPROVEMENT_LINK:	  {	    char s[128];	    GetWindowText((HWND)lParam,s,sizeof(s));	    if (strcmp(s, _("(Never)")) != 0 && strcmp(s, _("None")) != 0		&& strcmp(s, advance_name_translation(advance_by_number(A_NONE))) != 0)	      select_help_item_string(s,page_type_from_id(LOWORD(wParam)));	    	  }	  break;	case ID_HELP_LIST:	  {	    if (HIWORD(wParam)==LBN_SELCHANGE)	      {		int row;		const struct help_item *p = NULL;				row=ListBox_GetCurSel(helpdlg_list);		help_items_iterate(pitem) {		  if ((row--)==0)		    {		      p=pitem;		      break;		    }		}		help_items_iterate_end;				if (p)		  help_update_dialog(p);	      }	  }	  break;	}      break;    default:      return DefWindowProc(hWnd,uMsg,wParam,lParam);          }
开发者ID:4nakin,项目名称:freeciv-android,代码行数:75,


示例8: ASSERT

void CBigIcon::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ){    CDC * pDC = CDC::FromHandle ( lpDrawItemStruct->hDC ) ;    ASSERT ( pDC != NULL ) ;    CRect rect ;    GetClientRect ( rect ) ;    int cxClient = rect.Width ( ) ;    int cyClient = rect.Height ( ) ;    // load icon    CString sName ;    GetWindowText ( sName ) ;    HICON hicon = AfxGetApp ()->LoadIcon ( sName ) ;    ASSERT ( NULL != hicon ) ;    if ( hicon == NULL )    {        return ;    }    // draw icon into off-screen bitmap    int cxIcon =::GetSystemMetrics ( SM_CXICON ) ;    int cyIcon =::GetSystemMetrics ( SM_CYICON ) ;    CBitmap bitmap ;    if ( !bitmap.CreateCompatibleBitmap ( pDC , cxIcon , cyIcon ) )    {        return ;    }    CDC dcMem ;    if ( !dcMem.CreateCompatibleDC ( pDC ) )    {        return ;    }    CBitmap * pBitmapOld = dcMem.SelectObject ( &bitmap ) ;    if ( pBitmapOld == NULL )    {        return ;    }    // blt the bits already on the window onto the off-screen bitmap    dcMem.StretchBlt ( 0 , 0 , cxIcon , cyIcon , pDC ,        2 , 2 , cxClient - CX_SHADOW - 4 , cyClient - CY_SHADOW - 4 ,        SRCCOPY ) ;    // draw the icon on the background    dcMem.DrawIcon ( 0 , 0 , hicon ) ;    // draw border around icon    CPen pen ;    pen.CreateStockObject ( BLACK_PEN ) ;    CPen * pPenOld = pDC->SelectObject ( &pen ) ;    pDC->Rectangle ( 0 , 0 , cxClient - CX_SHADOW , cyClient-CY_SHADOW);    if ( pPenOld )    {        pDC->SelectObject ( pPenOld ) ;    }    // draw shadows around icon    CBrush br ;    br.CreateStockObject ( DKGRAY_BRUSH ) ;    rect.SetRect ( cxClient - CX_SHADOW , CY_SHADOW ,cxClient,cyClient);    pDC->FillRect ( rect , &br ) ;    rect.SetRect ( CX_SHADOW , cyClient - CY_SHADOW ,cxClient,cyClient);    pDC->FillRect ( rect , &br ) ;    // draw the icon contents    pDC->StretchBlt ( 2 , 2 , cxClient - CX_SHADOW - 4 , cyClient -                      CY_SHADOW - 4 , &dcMem , 0 , 0 , cxIcon ,                      cyIcon , SRCCOPY ) ;}
开发者ID:tornadocean,项目名称:DM,代码行数:71,


示例9: password_thread

static DWORD WINAPI password_thread(void *data){    tcn_pass_cb_t *cb = (tcn_pass_cb_t *)data;    MSG     msg;    HWINSTA hwss;    HWINSTA hwsu;    HDESK   hwds;    HDESK   hwdu;    HWND    hwnd;    /* Ensure connection to service window station and desktop, and     * save their handles.     */    GetDesktopWindow();    hwss = GetProcessWindowStation();    hwds = GetThreadDesktop(GetCurrentThreadId());    /* Impersonate the client and connect to the User's     * window station and desktop.     */    hwsu = OpenWindowStation("WinSta0", FALSE, MAXIMUM_ALLOWED);    if (hwsu == NULL) {        ExitThread(1);        return 1;    }    SetProcessWindowStation(hwsu);    hwdu = OpenDesktop("Default", 0, FALSE, MAXIMUM_ALLOWED);    if (hwdu == NULL) {        SetProcessWindowStation(hwss);        CloseWindowStation(hwsu);        ExitThread(1);        return 1;    }    SetThreadDesktop(hwdu);    hwnd = CreateDialog(dll_instance, MAKEINTRESOURCE(1001), NULL, NULL);    if (hwnd != NULL)        ShowWindow(hwnd, SW_SHOW);    else  {        ExitThread(1);        return 1;    }    while (1) {        if (PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE)) {            if (msg.message == WM_KEYUP) {                int nVirtKey = (int)msg.wParam;                if (nVirtKey == VK_ESCAPE) {                    DestroyWindow(hwnd);                    break;                }                else if (nVirtKey == VK_RETURN) {                    HWND he = GetDlgItem(hwnd, 1002);                    if (he) {                        int n = GetWindowText(he, cb->password, SSL_MAX_PASSWORD_LEN - 1);                        cb->password[n] = '/0';                    }                    DestroyWindow(hwnd);                    break;                }            }            TranslateMessage(&msg);            DispatchMessage(&msg);        }        else            Sleep(100);    }    /* Restore window station and desktop.     */    SetThreadDesktop(hwds);    SetProcessWindowStation(hwss);    CloseDesktop(hwdu);    CloseWindowStation(hwsu);    ExitThread(0);    return 0;}
开发者ID:fakechris,项目名称:TomCatUdp,代码行数:76,


示例10: GetWindowLongPtr

BOOL CAttachDlg::AttachDlgEnumWin(HWND hFind, LPARAM lParam){	if (IsWindowVisible(hFind))	{		CAttachDlg* pDlg = (CAttachDlg*)lParam;		// Условия?		DWORD_PTR nStyle = GetWindowLongPtr(hFind, GWL_STYLE);		DWORD_PTR nStyleEx = GetWindowLongPtr(hFind, GWL_EXSTYLE);		DWORD nPID;		if (!GetWindowThreadProcessId(hFind, &nPID))			nPID = 0;		bool lbCan = ((nStyle & (WS_VISIBLE/*|WS_CAPTION|WS_MAXIMIZEBOX*/)) == (WS_VISIBLE/*|WS_CAPTION|WS_MAXIMIZEBOX*/));		if (lbCan)		{			// Более тщательно стили проверить			lbCan = ((nStyle & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX) || ((nStyle & WS_THICKFRAME) == WS_THICKFRAME);		}		if (lbCan && nPID == GetCurrentProcessId())			lbCan = false;		if (lbCan && nPID == pDlg->mn_ExplorerPID)			lbCan = false;		if (lbCan && (nStyle & WS_CHILD))			lbCan = false;		if (lbCan && (nStyleEx & WS_EX_TOOLWINDOW))			lbCan = false;		if (lbCan && gpConEmu->isOurConsoleWindow(hFind))			lbCan = false;		if (lbCan && gpConEmu->mp_Inside && (hFind == gpConEmu->mp_Inside->mh_InsideParentRoot))			lbCan = false;		wchar_t szClass[MAX_PATH], szTitle[MAX_PATH];		GetClassName(hFind, szClass, countof(szClass));		GetWindowText(hFind, szTitle, countof(szTitle));		if (gpSetCls->isAdvLogging)		{			wchar_t szLogInfo[MAX_PATH*3];			_wsprintf(szLogInfo, SKIPLEN(countof(szLogInfo)) L"Attach:%s x%08X/x%08X/x%08X {%s} /"%s/"", (DWORD)hFind, nStyle, nStyleEx, szClass, szTitle);			CVConGroup::LogString(szLogInfo);		}		if (lbCan)		{			wchar_t szPid[32], szHwnd[32], szType[16]; szPid[0] = szHwnd[0] = szType[0] = 0;			wchar_t szExeName[MAX_PATH], szExePathName[MAX_PATH*4]; szExeName[0] = szExePathName[0] = 0;			#ifndef ALLOW_GUI_ATTACH			if (!isConsoleClass(szClass))				return TRUE;			#endif			HWND hList = pDlg->mh_List;			if (nPID)			{				_wsprintf(szPid, SKIPLEN(countof(szPid)) L"%u", nPID);			}			else			{				#ifdef _DEBUG					wcscpy_c(szPid, L"????");				#else					return TRUE;				#endif			}			HANDLE h;			bool lbExeFound = false;			int nImageBits = 32;			#if 0			// Так можно получить только имя файла процесса, а интересен еще и путь			PROCESSENTRY32 pi = {sizeof(pi)};			h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);			if (h && h != INVALID_HANDLE_VALUE)			{				if (Process32First(h, &pi))				{					while (pi.th32ProcessID != nPID)					{						if (!Process32Next(h, &pi))							pi.th32ProcessID = 0;					}				}			}			#endif			if (pDlg->mp_ProcessData)			{				lbExeFound = pDlg->mp_ProcessData->GetProcessName(nPID, szExeName, countof(szExeName), szExePathName, countof(szExePathName), &nImageBits);				if (lbExeFound)				{					//ListView_SetItemText(hList, nItem, alc_File, szExeName);					//ListView_SetItemText(hList, nItem, alc_Path, szExePathName);					if (pDlg->mb_IsWin64)					{						wcscat_c(szPid, (nImageBits == 64) ? L" *64" : L" *32");					}				}//.........这里部分代码省略.........
开发者ID:flyfishtome,项目名称:ConEmu,代码行数:101,


示例11: ASSERT

void CxSkinButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {    ASSERT (lpDrawItemStruct);    //TRACE("* Captured: %08X/n", ::GetCapture());    //Check if the button state in not in inconsistent mode...    POINT mouse_position;    if ((m_button_down) && (::GetCapture() == m_hWnd) && (::GetCursorPos(&mouse_position))){		if (::WindowFromPoint(mouse_position) == m_hWnd){			if ((GetState() & BST_PUSHED) != BST_PUSHED) {				//TRACE("* Inconsistency up detected! Fixing./n");				SetState(TRUE);				return;			}		} else {			if ((GetState() & BST_PUSHED) == BST_PUSHED) {				//TRACE("* Inconsistency up detected! Fixing./n");				SetState(FALSE);				return;			}		}	}	    //TRACE("* Drawing: %08x/n", lpDrawItemStruct->itemState);	CString sCaption;	CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);	// get device context	RECT r=lpDrawItemStruct->rcItem;					// context rectangle	int cx = r.right  - r.left ;						// get width	int cy = r.bottom - r.top  ;						// get height	// get text box position	RECT tr={r.left+m_FocusRectMargin+2,r.top,r.right-m_FocusRectMargin-2,r.bottom};	GetWindowText(sCaption);							// get button text	pDC->SetBkMode(TRANSPARENT);	// Select the correct skin 	if (lpDrawItemStruct->itemState & ODS_DISABLED){	// DISABLED BUTTON		if(m_bDisabled.m_hObject==NULL)			 // no skin selected for disabled state -> standard button			pDC->FillSolidRect(&r,GetSysColor(COLOR_BTNFACE));		else // paint the skin			DrawBitmap(pDC,(HBITMAP)m_bDisabled,r,m_DrawMode);		// if needed, draw the standard 3D rectangular border		if (m_Border) pDC->DrawEdge(&r,EDGE_RAISED,BF_RECT);		// paint the etched button text//		pDC->SetTextColor(GetSysColor(COLOR_3DHILIGHT));//		pDC->DrawText(sCaption,&tr,DT_SINGLELINE|DT_VCENTER|DT_CENTER);		pDC->SetTextColor(m_TextColor);		if(m_TextRect.bottom!=m_TextRect.top)			pDC->DrawText(sCaption,&m_TextRect,DT_SINGLELINE|DT_VCENTER|DT_CENTER);		else			pDC->DrawText(sCaption,&tr,DT_SINGLELINE|DT_VCENTER|DT_CENTER);//		pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));//		OffsetRect(&tr,-1,-1);//		pDC->DrawText(sCaption,&tr,DT_SINGLELINE|DT_VCENTER|DT_CENTER);	} else {										// SELECTED (DOWN) BUTTON		if ((lpDrawItemStruct->itemState & ODS_SELECTED)||m_Checked){			if(m_bDown.m_hObject==NULL)				 // no skin selected for selected state -> standard button				pDC->FillSolidRect(&r,GetSysColor(COLOR_BTNFACE));            else { // paint the skin				DrawBitmap(pDC,(HBITMAP)m_bDown,r,m_DrawMode);            }			OffsetRect(&tr,1,1);  //shift text			// if needed, draw the standard 3D rectangular border			if (m_Border) pDC->DrawEdge(&r,EDGE_SUNKEN,BF_RECT);		} else {											// DEFAULT BUTTON			if(m_bNormal.m_hObject==NULL)				 // no skin selected for normal state -> standard button				pDC->FillSolidRect(&r,GetSysColor(COLOR_BTNFACE));			else // paint the skin                if ((m_tracking)&&(m_bOver.m_hObject!=NULL)){					DrawBitmap(pDC,(HBITMAP)m_bOver,r,m_DrawMode);				} else {					if ((lpDrawItemStruct->itemState & ODS_FOCUS)&&(m_bFocus.m_hObject!=NULL)){						DrawBitmap(pDC,(HBITMAP)m_bFocus,r,m_DrawMode);					} else {						DrawBitmap(pDC,(HBITMAP)m_bNormal,r,m_DrawMode);					}				}			// if needed, draw the standard 3D rectangular border			if (m_Border) pDC->DrawEdge(&r,EDGE_RAISED,BF_RECT);		}		// paint the focus rect/*		if ((lpDrawItemStruct->itemState & ODS_FOCUS)&&(m_FocusRectMargin>0)){			r.left   += m_FocusRectMargin ;			r.top    += m_FocusRectMargin ;			r.right  -= m_FocusRectMargin ;			r.bottom -= m_FocusRectMargin ;			DrawFocusRect (lpDrawItemStruct->hDC, &r) ;		}*/		// paint the enabled button text		pDC->SetTextColor(m_TextColor);		if(m_TextRect.bottom!=m_TextRect.top)			pDC->DrawText(sCaption,&m_TextRect,DT_SINGLELINE|DT_VCENTER|DT_CENTER);		else			pDC->DrawText(sCaption,&tr,DT_SINGLELINE|DT_VCENTER|DT_CENTER);//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:101,


示例12: winamp

static intwinamp(char *word[], char *word_eol[], void *userdata){char current_play[2048], *p;char p_esc[2048];char cur_esc[2048];char truc[2048];HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);    if (hwndWinamp)	{	    {	        if (!stricmp("PAUSE", word[2]))			{			   if (SendMessage(hwndWinamp,WM_USER, 0, 104))				{			   	   SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);						       if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)			   	       xchat_printf(ph, "Winamp: playing");			       else                       xchat_printf(ph, "Winamp: paused");				}            }			else		        if (!stricmp("STOP", word[2]))			    {			       SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);			       xchat_printf(ph, "Winamp: stopped");			    }			else			    if (!stricmp("PLAY", word[2]))			    {			         SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);			         xchat_printf(ph, "Winamp: playing");			    }        	else			    if (!stricmp("NEXT", word[2]))			    {			         SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);			         xchat_printf(ph, "Winamp: next playlist entry");			    }			else                if (!stricmp("PREV", word[2]))			    {			         SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);			         xchat_printf(ph, "Winamp: previous playlist entry");			    }		    else                if (!stricmp("START", word[2]))			    {			         SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);			         xchat_printf(ph, "Winamp: playlist start");			    }		    else                if (!word_eol[2][0])			    {					GetWindowText(hwndWinamp, current_play, sizeof(current_play));					if (strchr(current_play, '-'))					{						p = current_play + strlen(current_play) - 8;					while (p >= current_play)					{						if (!strnicmp(p, "- Winamp", 8)) break;							p--;					}					if (p >= current_play) p--;						while (p >= current_play && *p == ' ') p--;						*++p=0;							p = strchr(current_play, '.') + 1; 					song_strcpy(p_esc, p); 					song_strcpy(cur_esc, current_play);						if (p)					{						sprintf(truc, "me is now playing:%s", p_esc);					}					else					{						sprintf(truc, "me is now playing:%s", cur_esc);					}		   				xchat_commandf(ph, truc);					}				else xchat_print(ph, "Winamp: Nothing being played.");			}//.........这里部分代码省略.........
开发者ID:JordanKinsley,项目名称:hexchat,代码行数:101,


示例13: GetClientRect

void CMyButton::DrawButton(HDC hDestDC){	CRect rc;  	GetClientRect(rc);  	int nWindth=rc.Width();  	int nHeight=rc.Height();  	HDC hDC=CreateCompatibleDC(hDestDC);	HDC hMaskDC=CreateCompatibleDC(hDestDC);  	HBITMAP hBitmap=CreateCompatibleBitmap(hDestDC,nWindth,nHeight);  	HBITMAP hMaskBitmap=CreateCompatibleBitmap(hDestDC,nWindth,nHeight);  	HBITMAP hOldBitmap=(HBITMAP)SelectObject(hDC,hBitmap);  	HBITMAP hOldMaskBitmap=(HBITMAP)SelectObject(hMaskDC,hMaskBitmap);  	SetBkMode(hDC,TRANSPARENT);  	CSyncDir* pParent=(CSyncDir*)GetParent();  	CPoint pt(0,0);  	MapWindowPoints(pParent,&pt,1);  	pParent->m_bkImage.BitBlt(hDC,rc,pt,SRCCOPY);  	int nAlpha=100;	int nOffset=0;  	HBRUSH hbr=CreateSolidBrush(m_bkColor);  	FillRect(hMaskDC,&rc,hbr);  	DeleteObject(hbr);  	if(m_bDisable){  		nAlpha=100;  	}else if(m_bDown){  		nAlpha=180;  		nOffset=1;  	}else if(m_bOver){  		nAlpha=150;  	}else{  		nAlpha=100;  	}  	BLENDFUNCTION blend;  	memset( &blend, 0, sizeof( blend) );  	blend.BlendOp= AC_SRC_OVER;  	blend.SourceConstantAlpha= nAlpha; 	HRGN hRgn=CreateRoundRectRgn(0,0,nWindth,nHeight,3,3);  	SelectClipRgn (hDC,hRgn);  	AlphaBlend (hDC,0,0,nWindth,nHeight,hMaskDC, 0,0,nWindth,nHeight,blend);  	CString strText;  	GetWindowText(strText);  	if(strText!=_T("")){  		rc.InflateRect(-2,-2);  		rc.OffsetRect(nOffset,nOffset);  		HFONT hFont=(HFONT)SendMessage(WM_GETFONT);  		if(!hFont)hFont=(HFONT)GetStockObject(DEFAULT_GUI_FONT);  		HFONT hOldFont=(HFONT)SelectObject(hDC,hFont);  		::SetTextColor(hDC,m_textColor);  		::DrawText(hDC,strText,-1,&rc,DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_WORD_ELLIPSIS);  		::SelectObject(hDC,hOldFont);  	}  	SelectClipRgn (hDC,NULL);  	DeleteObject(hRgn);  	BitBlt(hDestDC,0,0,nWindth,nHeight,hDC,0,0,SRCCOPY);  	SelectObject(hDC,hOldBitmap);  	DeleteObject(hBitmap);  	DeleteDC(hDC);  	SelectObject(hMaskDC,hOldMaskBitmap);  	DeleteObject(hMaskBitmap);  	DeleteDC(hMaskDC);  }
开发者ID:xiaoyiqingz,项目名称:DocumentView,代码行数:71,


示例14: DragQueryFile

//.........这里部分代码省略.........    {        if(m_bUseTab)        {            m_bUseTab = 0;        }        else        {            m_bUseTab = 1;        }    }    // Retieve all the vim instances    EnumWindows(EnumWindowsProc, (LPARAM)this);    if (cbFiles > 1)    {	InsertMenu(hMenu,		indexMenu++,		MF_STRING|MF_BYPOSITION,		idCmd++,		_("Edit with &multiple Vims"));        if(m_bUseTab)        {            InsertMenu(hMenu,                    indexMenu++,                    MF_STRING|MF_BYPOSITION,                    idCmd++,                    _("Edit with single &Vim using tabs"));        }        else        {            InsertMenu(hMenu,                    indexMenu++,                    MF_STRING|MF_BYPOSITION,                    idCmd++,                    _("Edit with single &Vim"));        }	if (cbFiles <= 4)	{	    // Can edit up to 4 files in diff mode	    InsertMenu(hMenu,		    indexMenu++,		    MF_STRING|MF_BYPOSITION,		    idCmd++,		    _("Diff with Vim"));	    m_edit_existing_off = 3;	}	else	    m_edit_existing_off = 2;    }    else    {	InsertMenu(hMenu,		indexMenu++,		MF_STRING|MF_BYPOSITION,		idCmd++,		_("Edit with &Vim"));	m_edit_existing_off = 1;    }    // Now display all the vim instances    for (int i = 0; i < m_cntOfHWnd; i++)    {	char title[BUFSIZE];	char temp[BUFSIZE];	// Obtain window title, continue if can not	if (GetWindowText(m_hWnd[i], title, BUFSIZE - 1) == 0)	    continue;	// Truncate the title before the path, keep the file name	char *pos = strchr(title, '(');	if (pos != NULL)	{	    if (pos > title && pos[-1] == ' ')		--pos;	    *pos = 0;	}	// Now concatenate        if(m_bUseTab)        {	    strncpy(temp, _("Edit with existing Vim using tabs - "), BUFSIZE - 1);        }        else        {	    strncpy(temp, _("Edit with existing Vim - "), BUFSIZE - 1);        }	strncat(temp, title, BUFSIZE - 1);	InsertMenu(hMenu,		indexMenu++,		MF_STRING|MF_BYPOSITION,		idCmd++,		temp);    }    // InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);    // Must return number of menu items we added.    return ResultFromShort(idCmd-idCmdFirst);}
开发者ID:vim-scripts,项目名称:gvimext.dll--support-tabs-under-VIM-7,代码行数:101,


示例15: WndProc

//Функция окнаLRESULT CALLBACK WndProc(HWND hWnd, UINT messg,	WPARAM wParam, LPARAM lParam){	//HDC hdc; //создаём контекст устройства	PAINTSTRUCT ps; //создаём экземпляр структуры графического вывода	LOGFONT lf;	HFONT hFont;	//RECT r;	HBRUSH hBrush;	HPEN hPen;	bool brushChosen = false;	//Цикл обработки сообщений	switch (messg)	{					//сообщение выхода - разрушение окна	case WM_DESTROY:		PostQuitMessage(0); //Посылаем сообщение выхода с кодом 0 - нормальное завершение		//DeleteObject(hPen);		//DeleteObject(hBrush);		break;	case WM_LBUTTONDOWN:				if (IsDlgButtonChecked(hWnd, 10001)){						isPainting = true;		}		else		if (IsDlgButtonChecked(hWnd, 10003)){			hdc = GetDC(hWnd);			GetCursorPos(&pt);			ScreenToClient(hWnd, &pt);			MoveToEx(hdc, pt.x, pt.y, NULL);		}				break;	case WM_LBUTTONUP:		isPainting = false;		if (IsDlgButtonChecked(hWnd, 10003)){			//MessageBox(NULL, (LPCSTR)L"lol", (LPCSTR)L"Ok!", MB_OK);						GetCursorPos(&pt);			ScreenToClient(hWnd, &pt);			char brushWidth[3];			GetWindowText(hWndEditText, brushWidth, 3);			hPen = CreatePen(PS_SOLID, atoi(brushWidth), RGB(rValue, gValue, bValue));			SelectObject(hdc, hPen);			LineTo(hdc, pt.x, pt.y);			DeleteObject(hPen);			GetStockObject(DC_PEN);			ReleaseDC(hWnd, hdc);		}		break;	case WM_MOUSEMOVE:		if (isPainting){						PaintBrushLine();		}		break;	case WM_COMMAND:				if (10001 == LOWORD(wParam) | 10003 == LOWORD(wParam)){			if (IsDlgButtonChecked(hWnd, 10001) | IsDlgButtonChecked(hWnd,10003)){				CHOOSECOLOR ch_color = { 0 };				ch_color.lStructSize = sizeof(CHOOSECOLOR);				ch_color.hwndOwner = hWnd;				COLORREF cust_colors[16] = { 0 };				ch_color.lpCustColors = cust_colors;				if (ChooseColor(&ch_color))				{					rValue = GetRValue(ch_color.rgbResult);					gValue = GetGValue(ch_color.rgbResult);					bValue = GetBValue(ch_color.rgbResult);				}			}		}		/*if (10001 == LOWORD(wParam) && IsDlgButtonChecked(hWnd, 10003))			CheckDlgButton(hWndButton, 10001, BST_UNCHECKED);		else		if (10003 == LOWORD(wParam) && IsDlgButtonChecked(hWnd, 10001))			CheckDlgButton(hWndLine, 10003, BST_UNCHECKED);*/		break;	default:		return(DefWindowProc(hWnd, messg, wParam, lParam)); //освобождаем очередь приложения от нераспознаных	}	return 0;}
开发者ID:F1xik,项目名称:osisp_lab1_final,代码行数:90,


示例16: switch

//.........这里部分代码省略.........					HWND box = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); 					int funcnum = symbolMap.GetSymbolNum(ListBox_GetItemData(box,ListBox_GetCurSel(box)));					if (funcnum!=-1)						symbolMap.FillListBoxBLinks(box,funcnum);					break;				}			case IDC_ALLFUNCTIONS:				{					symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);					break;				}			default:				return FALSE;			}			return TRUE;		}	case WM_DEB_MAPLOADED:		NotifyMapLoaded();		break;	case WM_DEB_GOTOWPARAM:	{		CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));		ptr->gotoAddr(wParam);		SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW));		break;	}	case WM_DEB_GOTOADDRESSEDIT:		{			wchar_t szBuffer[256];			CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));			GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256);			u32 addr;			if (parseExpression(ConvertWStringToUTF8(szBuffer).c_str(),cpu,addr) == false)			{				displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS));			} else {				ptr->gotoAddr(addr);				SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));			}			UpdateDialog();		}		break;	case WM_DEB_SETDEBUGLPARAM:		SetDebugMode(lParam != 0);		return TRUE;	case WM_DEB_UPDATE:		Update();		return TRUE;	case WM_DEB_TABPRESSED:		changeSubWindow(SUBWIN_NEXT);		break;	case WM_DEB_SETSTATUSBARTEXT:		if (!keepStatusBarText)			SendMessage(statusBarWnd,WM_SETTEXT,0,(LPARAM)ConvertUTF8ToWString((const char *)lParam).c_str());		break;	case WM_DEB_GOTOHEXEDIT:		{			CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW));			memory->gotoAddr(wParam);
开发者ID:Bulkman,项目名称:ppsspp,代码行数:67,


示例17: ExtendFrameIntoClientArea

BOOL CSwitchDlg::OnInitDialog(){	CResizableStandAloneDialog::OnInitDialog();	ExtendFrameIntoClientArea(IDC_REVGROUP);	m_aeroControls.SubclassOkCancelHelp(this);	CTSVNPath svnPath(m_path);	SetDlgItemText(IDC_SWITCHPATH, m_path);	m_bFolder = svnPath.IsDirectory();	SVN svn;	CString sUUID;	m_repoRoot = svn.GetRepositoryRootAndUUID(svnPath, true, sUUID);	m_repoRoot.TrimRight('/');	CString url = svn.GetURLFromPath(svnPath);	m_URLCombo.LoadHistory(_T("Software//TortoiseSVN//History//repoPaths//")+sUUID, _T("url"));	m_URLCombo.SetCurSel(0);	if (!url.IsEmpty())	{		CString relPath = url.Mid(m_repoRoot.GetLength());		CTSVNPath r = CTSVNPath(relPath);		relPath = r.GetUIPathString();		relPath.Replace('//', '/');		m_URLCombo.AddString(relPath, 0);		m_URLCombo.SelectString(-1, relPath);		m_URL = url;		SetDlgItemText(IDC_DESTURL, CPathUtils::CombineUrls(m_repoRoot, relPath));	}	if (m_sTitle.IsEmpty())		GetWindowText(m_sTitle);	SetWindowText(m_sTitle);	if (m_sLabel.IsEmpty())		GetDlgItemText(IDC_URLLABEL, m_sLabel);	SetDlgItemText(IDC_URLLABEL, m_sLabel);	// set head revision as default revision	SetRevision(SVNRev::REV_HEAD);	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_WORKING)));	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_INFINITE)));	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_IMMEDIATE)));	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_FILES)));	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_EMPTY)));	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_EXCLUDE)));	m_depthCombo.SetCurSel(0);	RECT rect;	GetWindowRect(&rect);	m_height = rect.bottom - rect.top;	AddAnchor(IDC_SWITCHLABEL, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_SWITCHPATH, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_URLLABEL, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_BROWSE, TOP_RIGHT);	AddAnchor(IDC_DESTLABEL, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_DESTURL, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_REVGROUP, TOP_LEFT);	AddAnchor(IDC_REVISION_HEAD, TOP_LEFT);	AddAnchor(IDC_REVISION_N, TOP_LEFT);	AddAnchor(IDC_REVISION_NUM, TOP_LEFT);	AddAnchor(IDC_LOG, TOP_LEFT);	AddAnchor(IDC_GROUPMIDDLE, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_DEPTH, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_NOEXTERNALS, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDOK, BOTTOM_RIGHT);	AddAnchor(IDCANCEL, BOTTOM_RIGHT);	AddAnchor(IDHELP, BOTTOM_RIGHT);	if ((m_pParentWnd==NULL)&&(hWndExplorer))		CenterWindow(CWnd::FromHandle(hWndExplorer));	EnableSaveRestore(_T("SwitchDlg"));	return TRUE;}
开发者ID:fatterbetter,项目名称:ZTools,代码行数:76,


示例18: MenuDialogProc

//-----------------------------------------------------------------------------// Call back function for the menu's dialog.//-----------------------------------------------------------------------------int CALLBACK MenuDialogProc( HWND window, UINT msg, WPARAM wparam, LPARAM lparam ){	// These are used to keep the text in the edit boxes between state changes.	static char name[MAX_PATH] = "Unknown Player";	static char character[MAX_PATH] = "Marine.txt";	static char map[MAX_PATH] = "Arena.txt";	static char game[MAX_PATH] = "Deathmatch";	switch( msg )	{		case WM_INITDIALOG:		{			// Show the player's name, selected character, and selected map.			SetWindowText( GetDlgItem( window, IDC_NAME ), name );			SetWindowText( GetDlgItem( window, IDC_CHARACTER ), character );			SetWindowText( GetDlgItem( window, IDC_MAP ), map );			SetWindowText( GetDlgItem( window, IDC_GAME ), game );			// Allow the sessions list to update.			UpdateSessionsList( window );			return true;		}		case WM_COMMAND:		{			switch( LOWORD( wparam ) )			{				case IDC_HOST:				{					// Get the character and map.					PlayerData data;					GetWindowText( GetDlgItem( window, IDC_CHARACTER ), character, MAX_PATH );					GetWindowText( GetDlgItem( window, IDC_MAP ), map, MAX_PATH );					GetWindowText( GetDlgItem( window, IDC_GAME ), game, MAX_PATH );					strcpy_s( data.character, character );					strcpy_s( data.map, map );					strcpy_s( data.game, game );					// Get the player's name.					GetWindowText( GetDlgItem( window, IDC_NAME ), name, MAX_PATH );					// Create a session name using the player's name.					char session[MAX_PATH];					sprintf_s( session, "%s's Session", name );					// Host a new session then switch to the game state.					if( g_engine->GetNetwork()->Host( name, session, 8, &data, sizeof( data ) ) )					{						g_engine->ChangeState( STATE_GAME );						EndDialog( window, true );					}					return true;				}				case IDC_SESSIONS:				{					// Check if the user double clicked on the session list.					if( HIWORD( wparam ) != LBN_DBLCLK )						return true;				} // If so, then fall through to IDC_JOIN.				case IDC_JOIN:				{					// Get the character.					PlayerData data;					GetWindowText( GetDlgItem( window, IDC_CHARACTER ), character, MAX_PATH );					strcpy( data.character, character );					// Get the player's name.					GetWindowText( GetDlgItem( window, IDC_NAME ), name, MAX_PATH );					// Get the selected session.					int session = (int)SendMessage( GetDlgItem( window, IDC_SESSIONS ), LB_GETCURSEL, 0, 0 );					// Join the selected session then switch to the game state.					if( g_engine->GetNetwork()->Join( name, session, &data, sizeof( data ) ) )					{						g_engine->ChangeState( STATE_GAME );						EndDialog( window, true );					}					else					{						// If the join failed, it may be because the session						// doesn't exist any more, so refresh the session list.						UpdateSessionsList( window );					}					return true;				}				case IDC_REFRESH:				{					// Refresh the session list.//.........这里部分代码省略.........
开发者ID:asutermo,项目名称:Wolf-Operatives,代码行数:101,


示例19: PaintWorker

//.........这里部分代码省略.........				if (ctl->stateId==PBS_HOT||ctl->focus) {					if (ctl->pbState)						DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT);					else DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT);				}				else if (ctl->stateId==PBS_PRESSED)					DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER,BF_RECT|BF_SOFT);			}		}		else {			// Draw background/border			if (ctl->hThemeButton) {				int state = IsWindowEnabled(ctl->hwnd)?(ctl->stateId==PBS_NORMAL&&ctl->defbutton?PBS_DEFAULTED:ctl->stateId):PBS_DISABLED;				if (isThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) {					drawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient);				}				drawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient);			}			else {				UINT uState = DFCS_BUTTONPUSH|((ctl->stateId==PBS_HOT)?DFCS_HOT:0)|((ctl->stateId == PBS_PRESSED)?DFCS_PUSHED:0);				if (ctl->defbutton&&ctl->stateId==PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON;				DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState);			}			// Draw focus rectangle if button has focus			if (ctl->focus) {				RECT focusRect = rcClient;				InflateRect(&focusRect, -3, -3);				DrawFocusRect(hdcMem, &focusRect);			}		}		// If we have an icon or a bitmap, ignore text and only draw the image on the button		if (ctl->hIcon) {			int ix = (rcClient.right-rcClient.left)/2 - (GetSystemMetrics(SM_CXSMICON)/2);			int iy = (rcClient.bottom-rcClient.top)/2 - (GetSystemMetrics(SM_CYSMICON)/2);			if (ctl->stateId == PBS_PRESSED) {				ix++;				iy++;			}			{				HIMAGELIST hImageList;				HICON hIconNew;				hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);				ImageList_AddIcon(hImageList, ctl->hIcon);				hIconNew = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);				DrawState(hdcMem,NULL,NULL,(LPARAM)hIconNew,0,ix,iy,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWindowEnabled(ctl->hwnd)?DST_ICON|DSS_NORMAL:DST_ICON|DSS_DISABLED);				ImageList_RemoveAll(hImageList);				ImageList_Destroy(hImageList);				DestroyIcon(hIconNew);			}		}		else if (ctl->hBitmap) {			BITMAP bminfo;			int ix,iy;			GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo);			ix = (rcClient.right-rcClient.left)/2 - (bminfo.bmWidth/2);			iy = (rcClient.bottom-rcClient.top)/2 - (bminfo.bmHeight/2);			if (ctl->stateId == PBS_PRESSED) {				ix++;				iy++;			}			DrawState(hdcMem,NULL,NULL,(LPARAM)ctl->hBitmap,0,ix,iy,bminfo.bmWidth,bminfo.bmHeight,IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED);		}		else if (GetWindowTextLength(ctl->hwnd)) {			// Draw the text and optinally the arrow			TCHAR szText[MAX_PATH];			SIZE sz;			RECT rcText;			HFONT hOldFont;			CopyRect(&rcText, &rcClient);			GetWindowText(ctl->hwnd, szText, SIZEOF(szText));			SetBkMode(hdcMem, TRANSPARENT);			hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);			// XP w/themes doesn't used the glossy disabled text.  Is it always using COLOR_GRAYTEXT?  Seems so.			SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd)||!ctl->hThemeButton?GetSysColor(COLOR_BTNTEXT):GetSysColor(COLOR_GRAYTEXT));			GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);			if (ctl->cHot) {				SIZE szHot;				GetTextExtentPoint32 (hdcMem, _T("&"), 1, &szHot);				sz.cx -= szHot.cx;			}			if (ctl->arrow) {				DrawState(hdcMem,NULL,NULL,(LPARAM)ctl->arrow,0,rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+(!ctl->hThemeButton&&ctl->stateId==PBS_PRESSED?1:0),(rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+(!ctl->hThemeButton&&ctl->stateId==PBS_PRESSED?1:0),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED);			}			SelectObject(hdcMem, ctl->hFont);			DrawState(hdcMem,NULL,NULL,(LPARAM)szText,0,(rcText.right-rcText.left-sz.cx)/2+(!ctl->hThemeButton&&ctl->stateId==PBS_PRESSED?1:0),ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId==PBS_PRESSED?0:1),sz.cx,sz.cy,IsWindowEnabled(ctl->hwnd)||ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED);			SelectObject(hdcMem, hOldFont);		}		BitBlt(hdcPaint, 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, hdcMem, 0, 0, SRCCOPY);		SelectObject(hdcMem, hOld);		DeleteObject(hbmMem);		DeleteDC(hdcMem);	}}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:101,


示例20: InputLineWndProc

static LRESULT CALLBACK InputLineWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ){	switch ( uMsg )	{	case WM_KILLFOCUS:		if ( ( HWND ) wParam == s_wcd.hWnd ||			 ( HWND ) wParam == s_wcd.hwndErrorBox )		{			SetFocus( hWnd );			return 0;		}		break;	case WM_CHAR:		GetWindowText( s_wcd.hwndInputLine, s_wcd.g_consoleField.buffer, sizeof( s_wcd.g_consoleField.buffer ) );		SendMessage( s_wcd.hwndInputLine, EM_GETSEL, (WPARAM) NULL, (LPARAM) &s_wcd.g_consoleField.cursor );		if ( wParam == VK_RETURN )		{			strncat( s_wcd.consoleText, s_wcd.g_consoleField.buffer, sizeof( s_wcd.consoleText ) - strlen( s_wcd.consoleText ) - 5 );			strcat( s_wcd.consoleText, "/n" );			SetWindowText( s_wcd.hwndInputLine, "" );			Sys_Print( va( "%c%s/n", CONSOLE_PROMPT_CHAR, s_wcd.g_consoleField.buffer ) );			// empty lines just scroll the console without adding to history			if ( !s_wcd.g_consoleField.buffer[0] )				return 0;			// copy line to history buffer			s_wcd.historyEditLines[s_wcd.nextHistoryLine % COMMAND_HISTORY] = s_wcd.g_consoleField;			s_wcd.nextHistoryLine++;			s_wcd.historyLine = s_wcd.nextHistoryLine;			Field_Clear( &s_wcd.g_consoleField );			s_wcd.g_consoleField.widthInChars = g_console_field_width;			return 0;		}		if ( wParam == VK_TAB )		{			Field_AutoComplete( &s_wcd.g_consoleField );			SetWindowText( s_wcd.hwndInputLine, s_wcd.g_consoleField.buffer );			SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.g_consoleField.cursor, s_wcd.g_consoleField.cursor );			return 0;		}		break;	case WM_KEYDOWN:		// history scrolling		if ( wParam == VK_UP )		{// scroll up: arrow-up			if ( s_wcd.nextHistoryLine - s_wcd.historyLine < COMMAND_HISTORY && s_wcd.historyLine > 0 ) 				s_wcd.historyLine--;			s_wcd.g_consoleField = s_wcd.historyEditLines[s_wcd.historyLine % COMMAND_HISTORY];			SetWindowText( s_wcd.hwndInputLine, s_wcd.g_consoleField.buffer );			SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.g_consoleField.cursor, s_wcd.g_consoleField.cursor );			return 0;		}		if ( wParam == VK_DOWN )		{// scroll down: arrow-down			s_wcd.historyLine++;			if (s_wcd.historyLine >= s_wcd.nextHistoryLine) {				s_wcd.historyLine = s_wcd.nextHistoryLine;				Field_Clear( &s_wcd.g_consoleField );				s_wcd.g_consoleField.widthInChars = g_console_field_width;				SetWindowText( s_wcd.hwndInputLine, s_wcd.g_consoleField.buffer );				SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.g_consoleField.cursor, s_wcd.g_consoleField.cursor );				return 0;			}			s_wcd.g_consoleField = s_wcd.historyEditLines[s_wcd.historyLine % COMMAND_HISTORY];			SetWindowText( s_wcd.hwndInputLine, s_wcd.g_consoleField.buffer );			SendMessage( s_wcd.hwndInputLine, EM_SETSEL, s_wcd.g_consoleField.cursor, s_wcd.g_consoleField.cursor );			return 0;		}		break;	}	return CallWindowProc( s_wcd.SysInputLineWndProc, hWnd, uMsg, wParam, lParam );}
开发者ID:Razish,项目名称:OpenJK-Speed,代码行数:82,


示例21: sttEnterStringDlgProc

//.........这里部分代码省略.........			EnableWindow(GetParent(hwndDlg), TRUE);			break;		case 1001:			TCHAR buf[128];			mir_sntprintf(buf, SIZEOF(buf), TranslateT("OK (%d)"), --params->timeout);			SetDlgItemText(hwndDlg, IDOK, buf);			if (params->timeout < 0) {				KillTimer(hwndDlg, 1001);				UIEmulateBtnClick(hwndDlg, IDOK);			}		}		return TRUE;	case WM_SIZE:		{			UTILRESIZEDIALOG urd = { 0 };			urd.cbSize = sizeof(urd);			urd.hInstance = hInst;			urd.hwndDlg = hwndDlg;			urd.lpTemplate = MAKEINTRESOURCEA(IDD_ENTER_STRING);			urd.pfnResizer = sttEnterStringResizer;			CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);		}		break;	case WM_GETMINMAXINFO:		{			LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;			if (params && params->height)				lpmmi->ptMaxSize.y = lpmmi->ptMaxTrackSize.y = params->height;		}		break;	case WM_NOTIFY:		{			ENLINK *param = (ENLINK *)lParam;			if (param->nmhdr.idFrom != IDC_TXT_RICHEDIT) break;			if (param->nmhdr.code != EN_LINK) break;			if (param->msg != WM_LBUTTONUP) break;			CHARRANGE sel;			SendMessage(param->nmhdr.hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);			if (sel.cpMin != sel.cpMax) break; // allow link selection			TEXTRANGE tr;			tr.chrg = param->chrg;			tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));			SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)& tr);			char *tmp = mir_t2a(tr.lpstrText);			CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)tmp);			mir_free(tmp);			mir_free(tr.lpstrText);		}		return TRUE;	case WM_COMMAND:		switch (LOWORD(wParam)) {		case IDC_TXT_MULTILINE:		case IDC_TXT_RICHEDIT:			if ((HIWORD(wParam) != EN_SETFOCUS) && (HIWORD(wParam) != EN_KILLFOCUS)) {				SetDlgItemText(hwndDlg, IDOK, TranslateT("OK"));				KillTimer(hwndDlg, 1001);			}			break;		case IDC_TXT_COMBO:			if ((HIWORD(wParam) != CBN_SETFOCUS) && (HIWORD(wParam) != CBN_KILLFOCUS)) {				SetDlgItemText(hwndDlg, IDOK, TranslateT("OK"));				KillTimer(hwndDlg, 1001);			}			break;		case IDCANCEL:			if (params->szDataPrefix)				Utils_SaveWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);			EndDialog(hwndDlg, 0);			break;		case IDOK:			HWND hWnd = GetDlgItem(hwndDlg, params->idcControl);			int len = GetWindowTextLength(hWnd)+1;			params->ptszResult = (LPTSTR)mir_alloc(sizeof(TCHAR)*len);			GetWindowText(hWnd, params->ptszResult, len);			if ((params->type == ESF_COMBO) && params->szDataPrefix && params->recentCount)				ComboAddRecentString(hwndDlg, params);			if (params->szDataPrefix)				Utils_SaveWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);			EndDialog(hwndDlg, 1);			break;		}	}	return FALSE;}
开发者ID:martok,项目名称:miranda-ng,代码行数:101,


示例22: SAMPDlgProc

LRESULT CALLBACK SAMPDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){	HWND hwndEditBox = GetDlgItem(hwnd, IDE_INPUTEDIT);	HWND hwndListBox = GetDlgItem(hwnd, IDL_LISTBOX);	WORD wSelection;	char szResponse[257];	switch(msg)	{	case WM_CREATE:		{			HINSTANCE hInst = GetModuleHandle(NULL);			switch(sampDialog.bDialogStyle)			{				case DIALOG_STYLE_MSGBOX:					if(sampDialog.bButton1Len == 0 && sampDialog.bButton2Len == 0)					{						// no butans, no badi cana cross it					}					if(sampDialog.bButton1Len != 0 && sampDialog.bButton2Len == 0) // a butan					{						CreateWindowEx(NULL, "BUTTON", sampDialog.szButton1, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							150, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON1, hInst, NULL);					}					else if(sampDialog.bButton1Len != 0 && sampDialog.bButton2Len != 0) // tu butans					{						CreateWindowEx(NULL, "BUTTON", sampDialog.szButton1, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							100, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON1, hInst, NULL);						CreateWindowEx(NULL, "BUTTON", sampDialog.szButton2, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							210, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON2, hInst, NULL);					}					break;				case DIALOG_STYLE_INPUT:				case DIALOG_STYLE_PASSWORD:					{						CreateWindowEx(NULL, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_BORDER,							50, 200, 300, 24, hwnd, (HMENU)IDE_INPUTEDIT, hInst, NULL);						CreateWindowEx(NULL, "BUTTON", sampDialog.szButton1, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							100, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON1, hInst, NULL);						CreateWindowEx(NULL, "BUTTON", sampDialog.szButton2, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							210, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON2, hInst, NULL);					}					break;				case DIALOG_STYLE_LIST:					{						hwndListBox = CreateWindowEx(NULL, "LISTBOX", "",							WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_VSCROLL | WS_BORDER | LBS_HASSTRINGS,							10, 10, 375, 225, hwnd, (HMENU)IDL_LISTBOX, hInst, NULL);						char *szInfoTemp = strtok(sampDialog.szInfo, "/n");						while(szInfoTemp != NULL)						{							int id = SendMessage(hwndListBox, LB_ADDSTRING, 0, (LPARAM)szInfoTemp);							SendMessage(hwndListBox, LB_SETITEMDATA, id, (LPARAM)id);							szInfoTemp = strtok(NULL, "/n");						}												CreateWindowEx(NULL, "BUTTON", sampDialog.szButton1, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							100, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON1, hInst, NULL);						CreateWindowEx(NULL, "BUTTON", sampDialog.szButton2, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,							210, 230, 100, 24, hwnd, (HMENU)IDB_BUTTON2, hInst, NULL);					}					break;			}		}		break;	case WM_COMMAND:		{			switch(LOWORD(wParam))			{				case IDB_BUTTON1:					if(sampDialog.bDialogStyle == DIALOG_STYLE_LIST)					{						wSelection = (WORD)SendMessage(hwndListBox, LB_GETCURSEL, 0, 0);						if(wSelection != (WORD)-1)						{							SendMessage(hwndListBox, LB_GETTEXT, wSelection, (LPARAM)szResponse);							sendDialogResponse(sampDialog.wDialogID, 1, 0, szResponse);							PostQuitMessage(0);						}						break;					}					GetWindowText(hwndEditBox, szResponse, 257);					sendDialogResponse(sampDialog.wDialogID, 1, 0, szResponse);					PostQuitMessage(0);					break;//.........这里部分代码省略.........
开发者ID:BinL3R,项目名称:RakSAMP,代码行数:101,


示例23: GetDlgItemInt

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 设置格式BOOL CChildWnd::OnChangeFormat(){	TCHAR tzText[16];	INT i = GetDlgItemInt(m_hStatusBar, IDC_EditBox, NULL, TRUE);	CRawImage riFormat = *this;	switch (m_uEditBox)	{	case SBI_ColorSpace:		GetWindowText(m_hEditBox, tzText, _NumOf(tzText));		riFormat.m_csColorSpace = CS_ALL;		for (i = 0; i < _NumOf(c_tzColorSpace); i++)		{			if (lstrcmpi(tzText, c_tzColorSpace[i]) == 0)			{				riFormat.m_csColorSpace = (COLORSPACE) (i % CS_ALL);				break;			}		}		if (riFormat.m_csColorSpace == CS_ALL)		{			return FALSE;		}		else if (riFormat.m_csColorSpace == m_csColorSpace)		{			return TRUE;		}		break;	case SBI_Width:		i = (i + 1) & ~1;				_ReturnValIf(riFormat.m_uWidth == (UINT) i, TRUE);		riFormat.m_uWidth = i;		break;	case SBI_Height:		i = (i + 1) & ~1;		_ReturnValIf(riFormat.m_iHeight == i, TRUE);		riFormat.m_iHeight = i;		break;	case SBI_FrameRate:		_ReturnValIf(riFormat.m_uFrameRate == (UINT) i, TRUE);		riFormat.m_uFrameRate = i;		break;	case SBI_FrameStep:		riFormat.m_iFrameStep = GetDlgItemInt(m_hStatusBar, IDC_EditBox, NULL, TRUE);		_ReturnValIf(riFormat.m_iFrameStep == m_iFrameStep, TRUE);		break;	case SBI_CurFrame:		if ((i > 0) && (i <= (INT) m_uTotalFrame))		{			Stop();			Seek(i - 1);			return TRUE;		}			default:		return FALSE;	}	_ExIf(CClientWnd::IsScrabble(), CClientWnd::OnPlayScrabble());	Open(m_tzFileName, &riFormat);	EnableDDraw();	Draw();	// 记录历史格式	CIni::SetStruct(INI_HistroyFormat, m_tzFileName, &riFormat, sizeof(RAWIMAGE));	return TRUE;}
开发者ID:Yonsm,项目名称:RawPlayer,代码行数:77,


示例24: MainDlgProc

//.........这里部分代码省略.........	SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEYSIZE, FALSE);	/*	 * Initially, hide the progress bar and the key display,	 * and show the no-key display. Also disable the Save	 * buttons, because with no key we obviously can't save	 * anything.	 */	ui_set_state(hwnd, state, 0);	/*	 * Load a key file if one was provided on the command line.	 */	if (cmdline_keyfile)	    load_key_file(hwnd, state, filename_from_str(cmdline_keyfile), 0);	return 1;      case WM_MOUSEMOVE:	state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);	if (state->collecting_entropy &&	    state->entropy && state->entropy_got < state->entropy_required) {	    state->entropy[state->entropy_got++] = lParam;	    state->entropy[state->entropy_got++] = GetMessageTime();	    SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS,			       state->entropy_got, 0);	    if (state->entropy_got >= state->entropy_required) {		struct rsa_key_thread_params *params;		DWORD threadid;		/*		 * Seed the entropy pool		 */		random_add_heavynoise(state->entropy, state->entropy_size);		memset(state->entropy, 0, state->entropy_size);		sfree(state->entropy);		state->collecting_entropy = FALSE;		SetDlgItemText(hwnd, IDC_GENERATING, generating_msg);		SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETRANGE, 0,				   MAKELPARAM(0, PROGRESSRANGE));		SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS, 0, 0);		params = snew(struct rsa_key_thread_params);		params->progressbar = GetDlgItem(hwnd, IDC_PROGRESS);		params->dialog = hwnd;		params->keysize = state->keysize;		params->is_dsa = state->is_dsa;		params->key = &state->key;		params->dsskey = &state->dsskey;		if (!CreateThread(NULL, 0, generate_rsa_key_thread,				  params, 0, &threadid)) {		    MessageBox(hwnd, "Out of thread resources",			       "Key generation error",			       MB_OK | MB_ICONERROR);		    sfree(params);		} else {		    state->generation_thread_exists = TRUE;		}	    }	}	break;      case WM_COMMAND:	switch (LOWORD(wParam)) {	  case IDC_KEYSSH1:	  case IDC_KEYSSH2RSA:	  case IDC_KEYSSH2DSA:	    {		state = (struct MainDlgState *)		    GetWindowLongPtr(hwnd, GWLP_USERDATA);		if (!IsDlgButtonChecked(hwnd, LOWORD(wParam)))		    CheckRadioButton(hwnd, IDC_KEYSSH1, IDC_KEYSSH2DSA,				     LOWORD(wParam));		CheckMenuRadioItem(state->keymenu, IDC_KEYSSH1, IDC_KEYSSH2DSA,				   LOWORD(wParam), MF_BYCOMMAND);	    }	    break;	  case IDC_QUIT:	    PostMessage(hwnd, WM_CLOSE, 0, 0);	    break;	  case IDC_COMMENTEDIT:	    if (HIWORD(wParam) == EN_CHANGE) {		state = (struct MainDlgState *)		    GetWindowLongPtr(hwnd, GWLP_USERDATA);		if (state->key_exists) {		    HWND editctl = GetDlgItem(hwnd, IDC_COMMENTEDIT);		    int len = GetWindowTextLength(editctl);		    if (*state->commentptr)			sfree(*state->commentptr);		    *state->commentptr = snewn(len + 1, char);		    GetWindowText(editctl, *state->commentptr, len + 1);		    if (state->ssh2) {			setupbigedit2(hwnd, IDC_KEYDISPLAY, IDC_PKSTATIC,				      &state->ssh2key);		    } else {			setupbigedit1(hwnd, IDC_KEYDISPLAY, IDC_PKSTATIC,				      &state->key);		    }		}	    }
开发者ID:rlugojr,项目名称:portaputty,代码行数:101,


示例25: duressparawinproc

static int duressparawinproc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam){    HDC hdc;    int id,nc;    char sstr[10];    int tmpvalue;    static char keyupFlag=0;    switch (message)    {    case MSG_CREATE:        //if (LoadBitmap(HDC_SCREEN,&gpmngbk1,GetBmpPath("submenubg.jpg")))        //        return 0;        InitWindow(hWnd);		//add controls        InitWindowText(hWnd);        UpdateWindow(hWnd,TRUE);        actindex=0;        SetFocusChild(EdDAM[actindex]);        break;    case MSG_ERASEBKGND:    {        HDC hdc = (HDC)wParam;        const RECT* clip = (const RECT*)lParam;        BOOL fGetDC = FALSE;        RECT rcTemp;        if(hdc == 0)        {            hdc = GetClientDC(hWnd);            fGetDC = TRUE;        }        if(clip)        {            rcTemp = *clip;            ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);            ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);            IncludeClipRect(hdc, &rcTemp);        }        FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, gOptions.LCDHeight, get_submenubg_jgp());        if(fGetDC) ReleaseDC (hdc);        return 0;    }    case MSG_PAINT:        hdc=BeginPaint(hWnd);        EndPaint(hWnd,hdc);        return 0;    case MSG_KEYUP:        if(3 == gOptions.TFTKeyLayout)        {            keyupFlag=1;        }        break;    case MSG_KEYDOWN:        SetMenuTimeOut(time(NULL));        if(3 == gOptions.TFTKeyLayout)        {            if(1==keyupFlag)                keyupFlag=0;            else                break;        }        if (gOptions.KeyPadBeep)            ExKeyBeep();        if ((LOWORD(wParam)==SCANCODE_ESCAPE))        {            PostMessage(hWnd, MSG_COMMAND, ID_EXIT, 0L);        }        if(LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)        {            if(actindex==4)            {                memset(sstr,0,10);                GetWindowText(EdDAM[actindex],sstr,3);                if(strlen(sstr)==0)                    return 0;            }            if(++actindex > 6) actindex = 0;            //Liaozz 20081008 fix bug third 6            if (gOptions.IsOnlyRFMachine) {                if (actindex == 1 || actindex == 2)                    actindex = 3;            }            //Liaozz end            SetFocusChild(EdDAM[actindex]);            return 0;        }        if( LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)        {            if(actindex==4)            {                memset(sstr,0,10);                GetWindowText(EdDAM[actindex],sstr,3);                if(strlen(sstr)==0)//.........这里部分代码省略.........
开发者ID:beealone,项目名称:fp-firmware,代码行数:101,


示例26: GetWindowText

BOOL CFileDiffDlg::OnInitDialog(){	CResizableStandAloneDialog::OnInitDialog();	CString temp;	CString sWindowTitle;	GetWindowText(sWindowTitle);	CString pathText = g_Git.m_CurrentDir;	if (!m_path1.IsEmpty())		pathText = g_Git.CombinePath(m_path1);	CAppUtils::SetWindowTitle(m_hWnd, pathText, sWindowTitle);	this->m_ctrRev1Edit.Init();	this->m_ctrRev2Edit.Init();	m_tooltips.AddTool(IDC_SWITCHLEFTRIGHT, IDS_FILEDIFF_SWITCHLEFTRIGHT_TT);	m_cFileList.SetRedraw(false);	m_cFileList.DeleteAllItems();	DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_INFOTIP;	m_cFileList.SetExtendedStyle(exStyle);	m_nIconFolder = SYS_IMAGE_LIST().GetDirIconIndex();	m_cFileList.SetImageList(&SYS_IMAGE_LIST(), LVSIL_SMALL);	m_SwitchButton.SetImage((HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_SWITCHLEFTRIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR));	m_SwitchButton.Invalidate();	m_cFilter.SetCancelBitmaps(IDI_CANCELNORMAL, IDI_CANCELPRESSED);	m_cFilter.SetInfoIcon(IDI_FILTEREDIT);	temp.LoadString(IDS_FILEDIFF_FILTERCUE);	temp = _T("   ")+temp;	m_cFilter.SetCueBanner(temp);	if (!m_sFilter.IsEmpty())		m_cFilter.SetWindowText(m_sFilter);	int c = ((CHeaderCtrl*)(m_cFileList.GetDlgItem(0)))->GetItemCount()-1;	while (c>=0)		m_cFileList.DeleteColumn(c--);	temp.LoadString(IDS_FILEDIFF_FILE);	m_cFileList.InsertColumn(0, temp);	temp.LoadString(IDS_FILEDIFF_EXT);	m_cFileList.InsertColumn(1, temp);	temp.LoadString(IDS_FILEDIFF_ACTION);	m_cFileList.InsertColumn(2, temp);	temp.LoadString(IDS_FILEDIFF_STATADD);	m_cFileList.InsertColumn(3, temp);	temp.LoadString(IDS_FILEDIFF_STATDEL);	m_cFileList.InsertColumn(4, temp);	int mincol = 0;	int maxcol = ((CHeaderCtrl*)(m_cFileList.GetDlgItem(0)))->GetItemCount()-1;	int col;	for (col = mincol; col <= maxcol; col++)	{		m_cFileList.SetColumnWidth(col,LVSCW_AUTOSIZE_USEHEADER);	}	m_cFileList.SetRedraw(true);	AddAnchor(IDC_DIFFSTATIC1, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_SWITCHLEFTRIGHT, TOP_RIGHT);	AddAnchor(IDC_FIRSTURL, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_REV1BTN, TOP_RIGHT);	//AddAnchor(IDC_DIFFSTATIC2, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_SECONDURL, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_REV2BTN, TOP_RIGHT);	AddAnchor(IDC_FILTER, TOP_LEFT, TOP_RIGHT);	AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT);	AddAnchor(IDC_REV1GROUP,TOP_LEFT,TOP_RIGHT);	AddAnchor(IDC_REV2GROUP,TOP_LEFT,TOP_RIGHT);	AddAnchor(IDC_REV1EDIT,TOP_LEFT);	AddAnchor(IDC_REV2EDIT,TOP_LEFT);	AddAnchor(IDC_DIFFOPTION, TOP_RIGHT);	AddAnchor(IDC_LOG, TOP_RIGHT);	EnableSaveRestore(_T("FileDiffDlg"));	m_bIsBare = GitAdminDir::IsBareRepo(g_Git.m_CurrentDir);	if(this->m_strRev1.IsEmpty())		this->m_ctrRev1Edit.SetWindowText(this->m_rev1.m_CommitHash.ToString());	else	{		if (m_rev1.GetCommit(m_strRev1))		{			CString msg;			msg.Format(IDS_PROC_REFINVALID, (LPCTSTR)m_strRev1);			m_cFileList.ShowText(msg + _T("/n") + m_rev1.GetLastErr());		}		this->m_ctrRev1Edit.SetWindowText(m_strRev1);	}	if(this->m_strRev2.IsEmpty())		this->m_ctrRev2Edit.SetWindowText(this->m_rev2.m_CommitHash.ToString());	else	{//.........这里部分代码省略.........
开发者ID:ricardotheodoro,项目名称:TortoiseGit,代码行数:101,


示例27: rect

void CLinkButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {	// 获取一个CDC指针	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);	//定义按钮区域并初始化	CRect rect(lpDrawItemStruct->rcItem);	//设置背景模式	COLORREF oc=RGB(30,123,255);		//oc = pDC->GetTextColor();int iObk = pDC->SetBkMode(TRANSPARENT);	//初始化按钮状态	UINT state = lpDrawItemStruct->itemState;	CFont * pOldFont = NULL;	int iYOffset = 0, iXOffset = 0;	CString strText;	GetWindowText(strText);	rect.top  += iYOffset;	rect.left += iXOffset;	if (state & ODS_DISABLED)	{				//按钮置灰(DISABLED)		CBrush grayBrush;		grayBrush.CreateSolidBrush (GetSysColor (COLOR_GRAYTEXT));		CSize sz = pDC->GetTextExtent(strText);		int x = rect.left + (rect.Width() - sz.cx)/2;		int y = rect.top + (rect.Height() - sz.cy)/2;		rect.top  += 2;		rect.left += 2;		pDC->SetTextColor(GetSysColor(COLOR_3DHIGHLIGHT));		pDC->DrawText(strText, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);		rect.top  -= 2;		rect.left -= 2;		pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));		pDC->DrawText(strText, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	}	else	{		if (bHighlight)//光标在按钮上		{			if (state & ODS_SELECTED)			{				//按下按钮				pDC->Draw3dRect(rect,RGB(0,0,255), RGB(0,0,255));			}			else			{				//未按下按钮				pDC->Draw3dRect(rect,RGB(255,0,0),RGB(255,0,0));			}			//字体颜色			pDC->SetTextColor(RGB(0,0,255));			//加下画线(也可以用其他字体)			if (fUnderline.GetSafeHandle() == NULL)			{				CFont * pFont = GetFont();				ASSERT(pFont);				LOGFONT lf;				pFont->GetLogFont(&lf);				lf.lfUnderline = TRUE;				fUnderline.CreateFontIndirect(&lf);					}			pOldFont = pDC->SelectObject(&fUnderline);		}		else 		{			pDC->SetTextColor(RGB(255,123,30));			pDC->Draw3dRect(rect,RGB(255,0,0),RGB(255,0,0));	}		pDC->DrawText(strText, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);		if (pOldFont) pDC->SelectObject(pOldFont);	}}
开发者ID:ecnumjc,项目名称:Pet,代码行数:82,


示例28: ExtendFrameIntoClientArea

BOOL CCopyDlg::OnInitDialog(){    CResizableStandAloneDialog::OnInitDialog();    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);    ExtendFrameIntoClientArea(IDC_EXTGROUP);    m_aeroControls.SubclassControl(this, IDC_DOSWITCH);    m_aeroControls.SubclassControl(this, IDC_MAKEPARENTS);    m_aeroControls.SubclassOkCancelHelp(this);    m_bCancelled = false;    DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_CHECKBOXES;    m_ExtList.SetExtendedStyle(exStyle);    SetWindowTheme(m_ExtList.GetSafeHwnd(), L"Explorer", NULL);    m_ExtList.ShowText(CString(MAKEINTRESOURCE(IDS_COPY_WAITFOREXTERNALS)));    AdjustControlSize(IDC_COPYHEAD);    AdjustControlSize(IDC_COPYREV);    AdjustControlSize(IDC_COPYWC);    AdjustControlSize(IDC_DOSWITCH);    AdjustControlSize(IDC_MAKEPARENTS);    CTSVNPath path(m_path);    CString sWindowTitle;    GetWindowText(sWindowTitle);    CAppUtils::SetWindowTitle(m_hWnd, path.GetUIPathString(), sWindowTitle);    m_History.SetMaxHistoryItems((LONG)CRegDWORD(L"Software//TortoiseSVN//MaxHistoryItems", 25));    SetRevision(m_CopyRev);    m_tooltips.AddTool(IDC_HISTORY, IDS_COMMITDLG_HISTORY_TT);    if (SVN::PathIsURL(path))    {        DialogEnableWindow(IDC_COPYWC, FALSE);        DialogEnableWindow(IDC_DOSWITCH, FALSE);        SetDlgItemText(IDC_COPYSTARTLABEL, CString(MAKEINTRESOURCE(IDS_COPYDLG_FROMURL)));    }    SVN svn;    CString sUUID;    m_repoRoot = svn.GetRepositoryRootAndUUID(path, true, sUUID);    m_repoRoot.TrimRight('/');    m_wcURL = svn.GetURLFromPath(path);    if (m_wcURL.IsEmpty() || (!path.IsUrl() && !path.Exists()))    {        CString Wrong_URL=path.GetSVNPathString();        CString temp;        temp.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)Wrong_URL);        ::MessageBox(this->m_hWnd, temp, L"TortoiseSVN", MB_ICONERROR);        this->EndDialog(IDCANCEL);      //exit    }    m_URLCombo.LoadHistory(L"Software//TortoiseSVN//History//repoPaths//"+sUUID, L"url");    m_URLCombo.SetCurSel(0);    CString relPath = m_wcURL.Mid(m_repoRoot.GetLength());    if (!m_URL.IsEmpty())    {        // allow the use of urls relative to the repo root        if (m_URL[0] != '^')            relPath = m_URL.Mid(m_repoRoot.GetLength());        else            relPath = m_URL.Mid(1);    }    CTSVNPath r = CTSVNPath(relPath);    relPath = r.GetUIPathString();    relPath.Replace('//', '/');    m_URLCombo.AddString(relPath, 0);    m_URLCombo.SelectString(-1, relPath);    m_URL = m_wcURL;    SetDlgItemText(IDC_DESTURL, CPathUtils::CombineUrls(m_repoRoot, relPath));    SetDlgItemText(IDC_FROMURL, m_wcURL);    CString reg;    reg.Format(L"Software//TortoiseSVN//History//commit%s", (LPCTSTR)sUUID);    m_History.Load(reg, L"logmsgs");    m_ProjectProperties.ReadProps(m_path);    if (CRegDWORD(L"Software//TortoiseSVN//AlwaysWarnIfNoIssue", FALSE))        m_ProjectProperties.bWarnIfNoIssue = TRUE;    m_cLogMessage.Init(m_ProjectProperties);    m_cLogMessage.SetFont((CString)CRegString(L"Software//TortoiseSVN//LogFontName", L"Courier New"), (DWORD)CRegDWORD(L"Software//TortoiseSVN//LogFontSize", 8));    GetDlgItem(IDC_BUGTRAQBUTTON)->ShowWindow(SW_HIDE);    GetDlgItem(IDC_BUGTRAQBUTTON)->EnableWindow(FALSE);    CBugTraqAssociations bugtraq_associations;    bugtraq_associations.Load(m_ProjectProperties.GetProviderUUID(), m_ProjectProperties.sProviderParams);    if (bugtraq_associations.FindProvider(CTSVNPathList(m_path), &m_bugtraq_association))    {        CComPtr<IBugTraqProvider> pProvider;        HRESULT hr = pProvider.CoCreateInstance(m_bugtraq_association.GetProviderClass());        if (SUCCEEDED(hr))        {            m_BugTraqProvider = pProvider;            ATL::CComBSTR temp;            ATL::CComBSTR parameters;            parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString());            hr = pProvider->GetLinkText(GetSafeHwnd(), parameters, &temp);//.........这里部分代码省略.........
开发者ID:webtronix1,项目名称:tortoisesvn,代码行数:101,



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


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