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

C++ GetWindowText函数代码示例

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

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



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

示例1: GetWindowText

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


示例2: dialog_settings_proc

LRESULT WINAPI
dialog_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,代码来源:dialog.c


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


示例4: GetWindowText

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


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


示例6: WndText

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


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


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


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


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


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


示例12: winamp

static int
winamp(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,代码来源:winamp.c


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


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


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


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


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


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

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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