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

C++ GetWindowLong函数代码示例

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

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



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

示例1: CheckPrefs

void CheckPrefs(HWND hwnd, int iDlg)
{
	/**************************************************************************************************/
	/**************** save the preferances based on the checkmarks/options ****************************/
	/**************************************************************************************************/
	switch(iDlg)
	{
	case IDD_EVENTS:
		{
			SetOption(hwnd, CHAN_HILIGHT,		CHAN_HILIGHT);
			SetOption(hwnd, CHAN_INVITE,		CHAN_INVITE);
			SetOption(hwnd, CHAN_TOPIC_CHANGE,	CHAN_TOPIC_CHANGE);
			SetOption(hwnd, CHAN_BANNED,		CHAN_BANNED);
			SetOption(hwnd, CHAN_KICKED,		CHAN_KICKED);
			SetOption(hwnd, CTCP_GENERIC,		CTCP_GENERIC);
			SetOption(hwnd, PMSG_RECEIVE,		PMSG_RECEIVE);
			SetOption(hwnd, SERV_KILLED,		SERV_KILLED);
			SetOption(hwnd, SERV_NOTICE,		SERV_NOTICE);
			SetOption(hwnd, SERV_DISCONNECT,	SERV_DISCONNECT);
			SetOption(hwnd, CHAN_MESSAGE,		CHAN_MESSAGE);
		}
		break;
	case IDD_ALERTS:
		{
			SetOption(hwnd, PREF_AMAE,	PREF_AMAE);
			SetOption(hwnd, PREF_OSBWM,	PREF_OSBWM);
			SetOption(hwnd, PREF_UWIOB,	PREF_UWIOB);
			SetOption(hwnd, PREF_KAOI,	PREF_KAOI);
			SetOption(hwnd, PREF_BLINK,	PREF_BLINK);

			/**************************************************************************/
			/**************************************************************************/
			/**************************************************************************/
			TCHAR tTime[512];

			GetWindowText(GetDlgItem(hwnd, IDC_ALERT_TIME), tTime, 511);
			
			g_iTime = _tstoi(tTime);
			
			/**************************************************************************/
			/**************** Get our Hotkey and save it                     **********/
			/**************** then remove the old hotkey and add the new one **********/
			/**************************************************************************/
			DWORD hHotkey;
			hHotkey = SendDlgItemMessage(hwnd, IDC_ALERT_HOTKEY, HKM_GETHOTKEY, 0, 0);
			
			g_hHotKey.key = LOBYTE(hHotkey);
			g_hHotKey.mod = HotkeyfToMod(HIBYTE(hHotkey));
			
			if(IsDlgButtonChecked(hwnd, PREF_UWIOB) == BST_CHECKED)
			{
				UnregisterHotKey(g_hHotkeyWnd, 1);
				RegisterHotKey(g_hHotkeyWnd, 1, g_hHotKey.mod, g_hHotKey.key);
			}
			else
			{
				UnregisterHotKey(g_hHotkeyWnd, 1);
			}

			/*************************************************************************/
			/*********** Get and save the away msg and alert time ********************/
			/*************************************************************************/
		}
		break;
	case IDD_SETTINGS:
		{
			SetOption(hwnd, PREF_AOM, PREF_AOM);
			SetOption(hwnd, PREF_TOT, PREF_TOT);
			SetOption(hwnd, PREF_MIOC, PREF_MIOC);
			SetOption(hwnd, PREF_DNSIT, PREF_DNSIT);

			GetDlgItemText(hwnd, IDC_AWAY_MSG, g_szAway, 511);

			if(g_dwPrefs & (1<<PREF_DNSIT))
			{
				DWORD dwStyle;
				dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
				dwStyle |= (1<<WS_CHILD);
				SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
				SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, (LONG_PTR)g_hHotkeyWnd);
			}
			else
			{
				DWORD dwStyle;
				dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
				dwStyle &= ~(1<<WS_CHILD);
				SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
				SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, NULL);
			}
		}
		break;
	} 
}
开发者ID:94m3k1n9,项目名称:hexchat,代码行数:93,代码来源:utility.cpp


示例2: GetParent

BOOL player_impl::full_screen(BOOL fullscreen)
{
	HWND hparent = GetParent(m_hwnd);

	// 不支持非顶层窗口全屏操作.
	if (IsWindow(hparent))
	{
		::logger("do\'nt support full screen mode\n");
		return FALSE;
	}

	// Save the current windows placement/placement to
	// restore when fullscreen is over
	WINDOWPLACEMENT window_placement;
	window_placement.length = sizeof(WINDOWPLACEMENT);
	GetWindowPlacement(m_hwnd, &window_placement);

	if (fullscreen && !m_full_screen)
	{
		m_full_screen = true;
		m_wnd_style = GetWindowLong(m_hwnd, GWL_STYLE);
		printf("entering fullscreen mode.\n");
		SetWindowLong(m_hwnd, GWL_STYLE, WS_CLIPCHILDREN | WS_VISIBLE);

		if (IsWindow(hparent))
		{
			// Retrieve current window position so fullscreen will happen
			// on the right screen
			HMONITOR hmon = MonitorFromWindow(hparent, MONITOR_DEFAULTTONEAREST);
			MONITORINFO mi;
			mi.cbSize = sizeof(MONITORINFO);
			if (::GetMonitorInfo(hmon, &mi))
				::SetWindowPos(m_hwnd, 0,
				mi.rcMonitor.left,
				mi.rcMonitor.top,
				mi.rcMonitor.right - mi.rcMonitor.left,
				mi.rcMonitor.bottom - mi.rcMonitor.top,
				SWP_NOZORDER | SWP_FRAMECHANGED);
		}
		else
		{
			// Maximize non embedded window
			ShowWindow(m_hwnd, SW_SHOWMAXIMIZED);
		}

		if (IsWindow(hparent))
		{
			// Hide the previous window
			RECT rect;
			GetClientRect(m_hwnd, &rect);
			// SetParent(hwnd, hwnd);
			SetWindowPos(m_hwnd, 0, 0, 0,
				rect.right, rect.bottom,
				SWP_NOZORDER|SWP_FRAMECHANGED);
			HWND topLevelParent = GetAncestor(hparent, GA_ROOT);
			ShowWindow(topLevelParent, SW_HIDE);
		}
		SetForegroundWindow(m_hwnd);
		return TRUE;
	}

	if (!fullscreen && m_full_screen)
	{
		m_full_screen = FALSE;
		printf("leaving fullscreen mode.\n");
		// Change window style, no borders and no title bar
		SetWindowLong(m_hwnd, GWL_STYLE, m_wnd_style);

		if (hparent)
		{
			RECT rect;
			GetClientRect(hparent, &rect);
			// SetParent(hwnd, hparent);
			SetWindowPos(m_hwnd, 0, 0, 0,
				rect.right, rect.bottom,
				SWP_NOZORDER | SWP_FRAMECHANGED);

			HWND topLevelParent = GetAncestor(hparent, GA_ROOT);
			ShowWindow(topLevelParent, SW_SHOW);
			SetForegroundWindow(hparent);
			ShowWindow(m_hwnd, SW_HIDE);
		}
		else
		{
			// return to normal window for non embedded vout
			SetWindowPlacement(m_hwnd, &window_placement);
			ShowWindow(m_hwnd, SW_SHOWNORMAL);
		}
		return TRUE;
	}

	return FALSE;
}
开发者ID:chinshou,项目名称:avplayer,代码行数:93,代码来源:player_impl.cpp


示例3: SetIcon

BOOL CRegDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	CString str;
	sockaddr_in  sockAddr;
	memset(&sockAddr, 0, sizeof(sockAddr));
	int nSockAddrLen = sizeof(sockAddr);
	BOOL bResult = getpeername(m_pContext->m_Socket, (SOCKADDR*)&sockAddr, &nSockAddrLen);
	str.Format("\\\\%s - 注册表管理", bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "");
	SetWindowText(str);

	size[0]=120;size[1]=80;size[2]=310;
	m_list.InsertColumn(0,"名称",LVCFMT_LEFT,size[0],-1);
	m_list.InsertColumn(1,"类型",LVCFMT_LEFT,size[1],-1);
	m_list.InsertColumn(2,"数据",LVCFMT_LEFT,size[2],-1);
    m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	//////添加图标//////
	m_HeadIcon.Create(16,16,TRUE,2,2);
	m_HeadIcon.Add(AfxGetApp()->LoadIcon(IDI_STR_ICON));
	m_HeadIcon.Add(AfxGetApp()->LoadIcon(IDI_DWORD_ICON));	
	
	m_list.SetImageList(&m_HeadIcon,LVSIL_SMALL);	
	
	//树控件设置	
	HICON hIcon = NULL;
	m_ImageList_tree.Create(18, 18, ILC_COLOR16,10, 0);
	
	hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_FATHER_ICON), IMAGE_ICON, 18, 18, 0);
	m_ImageList_tree.Add(hIcon);
	hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_DIR_ICON), IMAGE_ICON, 32, 32, 0);
	m_ImageList_tree.Add(hIcon);	
	
	
	m_tree.SetImageList ( &m_ImageList_tree,TVSIL_NORMAL );
	
	DWORD	dwStyle = GetWindowLong(m_tree.m_hWnd,GWL_STYLE);
	
    dwStyle |=TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT;	
    SetWindowLong(m_tree.m_hWnd,GWL_STYLE,dwStyle);

    m_hRoot = m_tree.InsertItem("注册表管理",0,0,0,0);   
	
	HKCU=m_tree.InsertItem("HKEY_CURRENT_USER",1,1,m_hRoot,0);
	HKLM=m_tree.InsertItem("HKEY_LOCAL_MACHINE",1,1,m_hRoot,0);
	HKUS=m_tree.InsertItem("HKEY_USERS",1,1,m_hRoot,0);
	HKCC=m_tree.InsertItem("HKEY_CURRENT_CONFIG",1,1,m_hRoot,0);
	HKCR=m_tree.InsertItem("HKEY_CLASSES_ROOT",1,1,m_hRoot,0);
	
	m_tree.Expand(m_hRoot,TVE_EXPAND);	
	
	CreatStatusBar();
	CRect rect;
	GetWindowRect(&rect);
	rect.bottom+=20;
	MoveWindow(&rect,true);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:64,代码来源:RegDlg.cpp


示例4:

cNinjaProgressBar *getNinjaProgressBar(HWND hwHost)
{
	cNinjaProgressBar *cNL = (cNinjaProgressBar*)GetWindowLong(hwHost,GWL_USERDATA);
	return cNL;
}
开发者ID:ishani,项目名称:Oddity,代码行数:5,代码来源:ninjaProgress.cpp


示例5: makeWindow

void makeWindow( )
{

	WNDCLASSEX	wndClass;

	wndClass.cbSize        = sizeof(wndClass);
	wndClass.style         = CS_HREDRAW | CS_VREDRAW;
	wndClass.lpfnWndProc   = CGameGirlProc;
	wndClass.cbClsExtra    = 0;
	wndClass.cbWndExtra    = 0;
	wndClass.hInstance     = g_pWindows->m_hInstance;
	wndClass.hIcon         = LoadIcon( g_pWindows->m_hInstance , MAKEINTRESOURCE(IDI_APP));
	wndClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
	wndClass.hbrBackground = (HBRUSH)GetStockObject(DKGRAY_BRUSH);
	wndClass.lpszMenuName  = NULL;//MAKEINTRESOURCE(CGameGirl::GetInstance()->MENU_BAR);
	wndClass.lpszClassName = TEXT( NAME_APRICLASS );
	wndClass.hIconSm       = LoadIcon (NULL, _T( "MAIN" ));

	RegisterClassEx(&wndClass);

	//画面の中央にセット
	RECT		desktop;
	GetWindowRect(GetDesktopWindow(), (LPRECT)&desktop);

	/*-- フレームなどのクライアント領域以外のサイズを考慮 --*/
	Sint32 w,h;
	RECT rect = { 0, 0, SWINDOW_W, SWINDOW_H };
	AdjustWindowRect( &rect, WS_OVERLAPPEDWINDOW|WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, FALSE );

	w = rect.right - rect.left;
	h = rect.bottom - rect.top;

	Sint32 ax,ay;

	ax = (desktop.right  - desktop.left)/2 - w/2;
	ay = (desktop.bottom - desktop.top)/2  - h/2;

	if( ax < 0) ax = 0;
	if( ay < 0) ay = 0;

	g_pWindows->m_hWindow = CreateWindow(
				TEXT( NAME_APRICLASS ),
				TEXT( NAME_APRICATION ),
	            WS_OVERLAPPEDWINDOW|WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE,
				ax,
				ay,
				w,
				h,
				NULL,
				NULL,
				g_pWindows->m_hInstance,
			    NULL);

	g_pWindows->m_WinDC = GetDC( g_pWindows->m_hWindow );

	g_pWindows->m_AppStyle = GetWindowLong( g_pWindows->m_hWindow , GWL_STYLE);
	GetWindowRect( g_pWindows->m_hWindow , &g_pWindows->m_WinRect );

	/*-- 念のためウインドウサイズ補正 --*/
	RECT client;
	GetClientRect( g_pWindows->m_hWindow, &client );
	int diffx = (client.right - client.left) - SWINDOW_W;
	int diffy = (client.bottom - client.top) - SWINDOW_H;
	if ( diffx != 0 || diffy != 0 ) {
		rect.right -= diffx;
		rect.bottom -= diffy;

		MoveWindow( g_pWindows->m_hWindow, g_pWindows->m_WinRect.left, g_pWindows->m_WinRect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE );
	}

	// ハードがマルチタッチをサポートしているかどうか
	int  value= ~GetSystemMetrics( SM_DIGITIZER );

	if( !(value & 0xc0) )
	{
		RegisterTouchWindow( g_pWindows->m_hWindow, 0 );
	}

	QueryPerformanceFrequency((LARGE_INTEGER*)&g_pWindows->Vsyncrate);		//秒間のカウント

}
开发者ID:programmerMOT,项目名称:gxlib,代码行数:81,代码来源:Win32cmn.cpp


示例6: ShaderDlgWndProc

static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
      WPARAM wparam, LPARAM lparam)
{
   int i, pos;
   const ui_window_t *window = ui_companion_driver_get_window_ptr();

   switch (message)
   {
      case WM_CREATE:
         break;

      case WM_CLOSE:
      case WM_DESTROY:
      case WM_QUIT:
         if (window)
            window->set_visible(&g_shader_dlg.window, false);
         return 0;

      case WM_COMMAND:
         i = LOWORD(wparam);

         if (i == SHADER_DLG_CHECKBOX_ONTOP_ID)
         {
            shader_dlg_update_on_top_state();
            break;
         }

         if (i >= GFX_MAX_PARAMETERS)
            break;

         if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_CHECKBOX)
            break;

         {
            video_shader_ctx_t shader_info;
            video_shader_driver_get_current_shader(&shader_info);

            if (SendMessage(g_shader_dlg.controls[i].elems.checkbox.hwnd,
                     BM_GETCHECK, 0, 0) == BST_CHECKED)
               shader_info.data->parameters[i].current =
                  shader_info.data->parameters[i].maximum;
            else
               shader_info.data->parameters[i].current =
                  shader_info.data->parameters[i].minimum;
         }
         break;

      case WM_HSCROLL:
         {
            video_shader_ctx_t shader_info;
            video_shader_driver_get_current_shader(&shader_info);
            i = GetWindowLong((HWND)lparam, GWL_ID);

            if (i >= GFX_MAX_PARAMETERS)
               break;

            if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_TRACKBAR)
               break;

            pos = (int)SendMessage(g_shader_dlg.controls[i].elems.trackbar.hwnd, TBM_GETPOS, 0, 0);

            {

               shader_info.data->parameters[i].current =
                  shader_info.data->parameters[i].minimum + pos * shader_info.data->parameters[i].step;
            }

            if (shader_info.data)
               shader_dlg_refresh_trackbar_label(i, &shader_info);
         }
         break;

   }

   return DefWindowProc(hwnd, message, wparam, lparam);
}
开发者ID:DoctorGoat,项目名称:RetroArch_LibNX,代码行数:76,代码来源:ui_win32.c


示例7: switch

//
//  Page Layout Dialog Box
//
BOOL FAR PASCAL _export PAGE::PageDialog ( HWND hDlg, WORD message, WORD wParam, LONG lParam )
{

	PAGE *page;

	switch ( message )
	{
	case WM_INITDIALOG:
		page = (PAGE*)AObjGetRuntimeInfo((OBJECTID)lParam);
		SetWindowLong(hDlg, DWL_USER, (long)page);
		page->SetDialog(hDlg);
		page->hPen1 = CreatePen(PS_SOLID, 1, 0x00808080L);
		page->hPen2 = CreatePen(PS_SOLID, 2, 0x00808080L);

		page->InitDlgControl();
		AUtlSetTitleFont(OTYPE_PAGE, NULL, GetDlgItem(hDlg, IDD_OBJECT));
		AUtlCenterDialog(hDlg, 0);

		return TRUE;

	case WM_MOVE:
		page = (PAGE*)GetWindowLong(hDlg, DWL_USER);
		GetWindowRect(page->hLayout, &page->layoutRect);
		return 0;

	case WM_COMMAND:
		page = (PAGE*)GetWindowLong(hDlg, DWL_USER);
		switch ( wParam )
		{
		case PAGEOK:
			SetFocus(GetDlgItem(hDlg, PAGEOK));
			page->UpdateObject();
			page->DeleteListData();
			EndDialog(hDlg, 0);
			return TRUE;

		case PAGECANCEL:
			SetFocus(GetDlgItem(hDlg, PAGECANCEL));
			page->DeleteListData();
			EndDialog(hDlg, 0);
			return TRUE;

		case PAGEHELP:
//			WinHelp(hDlg, HELPFILE, HELP_CONTEXT, HELPID_OBJD_Page);
			return TRUE;

		case PAGEADD:
			page->Add();
			return TRUE;

		case PAGEGRID:
			page->snap = IsDlgButtonChecked(hDlg, PAGEGRID);
			return TRUE;

		case PAGEREMOVE:
			page->Remove();
			page->UpdateRemoveButton();
			page->UpdateEditButton();
			return TRUE;

		case PAGEEDIT:
			page->Edit();
			return TRUE;

		case PAGEAVAIL:
			if (HIWORD(lParam) == LBN_SELCHANGE)
				page->UpdateAddButton();

			if (HIWORD(lParam) == LBN_DBLCLK)
				page->Add();
			return TRUE;

		case PAGESELECT:
			if (HIWORD(lParam) == LBN_SELCHANGE)
			{
				page->MakeWindowTop();
				page->UpdateRemoveButton();
				page->UpdateEditButton();
			}

			if (HIWORD(lParam) == LBN_DBLCLK)
				page->Edit();
			return TRUE;
		}
		break;

	case WM_PAINT:
		page = (PAGE*)GetWindowLong(hDlg, DWL_USER);
		page->DrawObjectName();
   	return FALSE;
	}
	return FALSE;
}
开发者ID:benbucksch,项目名称:AppWare,代码行数:96,代码来源:PG_DIALG.CPP


示例8: return

inline CUWindow *GetThis (HWND hWnd) { return (CUWindow *)GetWindowLong(hWnd, GWL_USERDATA); }
开发者ID:Ttech,项目名称:Transcendence,代码行数:1,代码来源:CUWindow.cpp


示例9: sSplashDlgProc

static BOOL CALLBACK 
sSplashDlgProc (
		HWND	hDlg, 
		UINT	uMsg, 
		WPARAM	wParam, 
		LPARAM	lParam) 
{
	PSPLASHSTRUCT	pss;

	switch (uMsg) {

	case WM_INITDIALOG:
		{
			HWND hWndControl;

			SetWindowLong (hDlg, GWL_USERDATA, lParam);
			pss = (PSPLASHSTRUCT)lParam;

			g_hWndSplash = hDlg;
			SetWindowPos (hDlg, HWND_TOP, pss->uXpos, pss->uYpos, 
											pss->uXsize, pss->uYsize, 0);

			hWndControl = GetDlgItem (hDlg, IDOK);
			EnableWindow (hWndControl, FALSE);
			ShowWindow (hWndControl, SW_HIDE);
			hWndControl = GetDlgItem (hDlg, IDC_BUYNOW);
			EnableWindow (hWndControl, FALSE);
			ShowWindow (hWndControl, SW_HIDE);
			pss->uTimerTime = 0;
			SetTimer (hDlg, TIMER_ID, TIMER_PERIOD, NULL);
		}
		return TRUE;

	case WM_PAINT:
		{
			HDC			hDC, hMemDC;
			PAINTSTRUCT ps;
			HBITMAP		hBitmapOld;

			pss = (PSPLASHSTRUCT)GetWindowLong (hDlg, GWL_USERDATA);

			hDC = BeginPaint (hDlg, &ps);
			hMemDC = CreateCompatibleDC (hDC);
			if (pss->hPaletteSplash) {
				SelectPalette (hDC, pss->hPaletteSplash, FALSE);
				RealizePalette (hDC);
			}
			hBitmapOld = SelectObject (hMemDC, pss->hBitmapSplash);
			CLPaintUserInfo (MemMgr, hDlg, hMemDC, NULL);
			BitBlt (hDC, 0, 0, pss->uXsize, pss->uYsize, 
											hMemDC, 0, 0, SRCCOPY);
			SelectObject (hMemDC, hBitmapOld);
			DeleteDC (hMemDC);
			EndPaint (hDlg, &ps);
		}
		return FALSE;

	case WM_LBUTTONDOWN:
		if (hWndSplashParent) EndDialog (hDlg, 0);
		return TRUE;

	case WM_DESTROY:
		KillTimer (hDlg, TIMER_ID);
		return FALSE;

	case WM_TIMER:
		pss = (PSPLASHSTRUCT)GetWindowLong (hDlg, GWL_USERDATA);
		if (pss->uTimerTime < pss->uTimeOut) 
			pss->uTimerTime += TIMER_PERIOD;
		else 
			if (hWndSplashParent) EndDialog (hDlg, 0);
		return TRUE;

	case WM_CLOSE :
		EndDialog (hDlg, 0);
		break;

	case WM_COMMAND :
		switch(LOWORD (wParam)) {

		case IDOK: 
			if (hWndSplashParent) EndDialog (hDlg, 0);
			break;
		}
		return TRUE;

	default:
		return FALSE;

	}

	return FALSE;
}
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:93,代码来源:CLsplash.c


示例10: TEXT

LRESULT CALLBACK MetaTaskbar::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	vnclog.Print(1, TEXT("%s: hwnd=0x%X, iMsg=0x%X, wParam=0x%X, lParam=0x%X\n"), __FUNCTION__, hwnd, iMsg, wParam, lParam);

    MetaTaskbar *_this = (MetaTaskbar *)GetWindowLong(hwnd, GWL_USERDATA);
    ULONG id = 0;
    if (_this)
        id = _this->getId(hwnd);
    
    //vnclog.Print(1, TEXT("%s: _this=0x%X, id=0x%X\n"), __FUNCTION__, _this, id);
    if (id == 0) {
        vnclog.Print(1, TEXT("%s: id=0\n"), __FUNCTION__);
        return DefWindowProc(hwnd, iMsg, wParam, lParam);
    }

    switch (iMsg) {
    case WM_SETFOCUS:
vnclog.Print(1, TEXT("%s: WM_SETFOCUS\n"), __FUNCTION__);
        _this->m_clientconn->SendWindowControl(id, rfbWindowControlSetFocus);
        SetForegroundWindow(_this->m_clientconn->m_hwnd1);
        break;

    case WM_KILLFOCUS:
vnclog.Print(1, TEXT("%s: WM_KILLFOCUS\n"), __FUNCTION__);
        break;

    case WM_ACTIVATE:
vnclog.Print(1, TEXT("%s: WM_ACTIVATE\n"), __FUNCTION__);
        break;

    case WM_ACTIVATEAPP:
vnclog.Print(1, TEXT("%s: WM_ACTIVATEAPP\n"), __FUNCTION__);
        break;

    case WM_SYSCOMMAND:
        vnclog.Print(1, TEXT("%s: WM_SYSCOMMAND: %s\n"), __FUNCTION__,
                     wParam == SC_SIZE ? TEXT("SC_SIZE") :
                     wParam == SC_MOVE ? TEXT("SC_MOVE") :
                     wParam == SC_MINIMIZE ? TEXT("SC_MINIMIZE") :
                     wParam == SC_MAXIMIZE ? TEXT("SC_MAXIMIZE") :
                     wParam == SC_NEXTWINDOW ? TEXT("SC_NEXTWINDOW") :
                     wParam == SC_PREVWINDOW ? TEXT("SC_PREVWINDOW") :
                     wParam == SC_CLOSE ? TEXT("SC_CLOSE") :
                     wParam == SC_VSCROLL ? TEXT("SC_VSCROLL") :
                     wParam == SC_HSCROLL ? TEXT("SC_HSCROLL") :
                     wParam == SC_MOUSEMENU ? TEXT("SC_MOUSEMENU") :
                     wParam == SC_KEYMENU ? TEXT("SC_KEYMENU") :
                     wParam == SC_ARRANGE ? TEXT("SC_ARRANGE") :
                     wParam == SC_RESTORE ? TEXT("SC_RESTORE") :
                     wParam == SC_TASKLIST ? TEXT("SC_TASKLIST") :
                     wParam == SC_SCREENSAVE ? TEXT("SC_SCREENSAVE") :
                     wParam == SC_HOTKEY ? TEXT("SC_HOTKEY") :
                     wParam == SC_DEFAULT ? TEXT("SC_DEFAULT") :
                     wParam == SC_MONITORPOWER ? TEXT("SC_MONITORPOWER") :
                     wParam == SC_CONTEXTHELP ? TEXT("SC_CONTEXTHELP") :
                     wParam == SC_SEPARATOR ? TEXT("SC_SEPARATOR") :
                     TEXT("unknown"));
        {
            ULONG state = _this->getTaskSwState(id);
            switch (wParam) {
            case SC_MINIMIZE:
                if (!(state & rfbWindowStateMinimized))
                    _this->m_clientconn->SendWindowControl(id, rfbWindowControlMinimize);
                else
                    vnclog.Print(0, TEXT("MetaTaskbar : ERROR : window 0x%X is already minimized\n"), id);
                break;
            case SC_MAXIMIZE:
                if (!(state & rfbWindowStateMaximized))
                    _this->m_clientconn->SendWindowControl(id, rfbWindowControlMaximize);
                else
                    vnclog.Print(0, TEXT("MetaTaskbar : ERROR : window 0x%X is already maximized\n"), id);
                break;
            case SC_RESTORE:
                if (state & (rfbWindowStateMinimized | rfbWindowStateMaximized))
                    _this->m_clientconn->SendWindowControl(id, rfbWindowControlRestore);
                else
                    _this->m_clientconn->SendWindowControl(id, rfbWindowControlMinimize);       // the task switch is clicked
                break;
            case SC_CLOSE:
                _this->m_clientconn->SendWindowControl(id, rfbWindowControlClose);
                break;
            }
        }
        break;

    default:
        break;
    }
	return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
开发者ID:tmbx,项目名称:vnc,代码行数:90,代码来源:MetaTaskbar.cpp


示例11: DownloadFile

/* 
 * Download a file from an URL
 * Mostly taken from http://support.microsoft.com/kb/234913
 * If hProgressDialog is not NULL, this function will send INIT and EXIT messages
 * to the dialog in question, with WPARAM being set to nonzero for EXIT on success
 * and also attempt to indicate progress using an IDC_PROGRESS control
 */
BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog)
{
	HWND hProgressBar = NULL;
	BOOL r = FALSE;
	DWORD dwFlags, dwSize, dwDownloaded, dwTotalSize, dwStatus;
	FILE* fd = NULL; 
	LONG progress_style;
	unsigned char buf[DOWNLOAD_BUFFER_SIZE];
	char agent[64], hostname[64], urlpath[128];
	HINTERNET hSession = NULL, hConnection = NULL, hRequest = NULL;
	URL_COMPONENTSA UrlParts = {sizeof(URL_COMPONENTSA), NULL, 1, (INTERNET_SCHEME)0,
		hostname, sizeof(hostname), 0, NULL, 1, urlpath, sizeof(urlpath), NULL, 1};
	int i;

	if (hProgressDialog != NULL) {
		// Use the progress control provided, if any
		hProgressBar = GetDlgItem(hProgressDialog, IDC_PROGRESS);
		if (hProgressBar != NULL) {
			progress_style = GetWindowLong(hProgressBar, GWL_STYLE);
			SetWindowLong(hProgressBar, GWL_STYLE, progress_style & (~PBS_MARQUEE));
			SendMessage(hProgressBar, PBM_SETPOS, 0, 0);
		}
		SendMessage(hProgressDialog, UM_ISO_INIT, 0, 0);
	}

	PrintStatus(0, FALSE, lmprintf(MSG_240, file));
	uprintf("Downloading %s from %s\n", file, url);

	if (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts)) {
		uprintf("Unable to decode URL: %s\n", WindowsErrorString());
		goto out;
	}
	hostname[sizeof(hostname)-1] = 0;

	// Open an Internet session
	for (i=5; (i>0) && (!InternetGetConnectedState(&dwFlags, 0)); i--) {
		Sleep(1000);
	}
	if (i <= 0) {
		// http://msdn.microsoft.com/en-us/library/windows/desktop/aa384702.aspx is wrong...
		SetLastError(ERROR_INTERNET_NOT_INITIALIZED);
		uprintf("Network is unavailable: %s\n", WinInetErrorString());
		goto out;
	}
	_snprintf(agent, ARRAYSIZE(agent), APPLICATION_NAME "/%d.%d.%d.%d", rufus_version[0], rufus_version[1], rufus_version[2], rufus_version[3]);
	hSession = InternetOpenA(agent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
	if (hSession == NULL) {
		uprintf("Could not open internet session: %s\n", WinInetErrorString());
		goto out;
	}

	hConnection = InternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
	if (hConnection == NULL) {
		uprintf("Could not connect to server %s:%d: %s\n", UrlParts.lpszHostName, UrlParts.nPort, WinInetErrorString());
		goto out;
	}

	hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, (const char**)"*/*\0",
		INTERNET_FLAG_HYPERLINK|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|INTERNET_FLAG_NO_COOKIES|
		INTERNET_FLAG_NO_UI|INTERNET_FLAG_NO_CACHE_WRITE, (DWORD_PTR)NULL);
	if (hRequest == NULL) {
		uprintf("Could not open url %s: %s\n", url, WindowsErrorString());
		goto out;
	}

	if (!HttpSendRequestA(hRequest, NULL, 0, NULL, 0)) {
		uprintf("Unable to send request: %s\n", WinInetErrorString());
		goto out;
	}

	// Get the file size
	dwSize = sizeof(dwStatus);
	dwStatus = 404;
	HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwStatus, &dwSize, NULL);
	if (dwStatus != 200) {
		error_code = ERROR_INTERNET_ITEM_NOT_FOUND;
		uprintf("Unable to access file: Server status %d\n", dwStatus);
		goto out;
	}
	dwSize = sizeof(dwTotalSize);
	if (!HttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwTotalSize, &dwSize, NULL)) {
		uprintf("Unable to retrieve file length: %s\n", WinInetErrorString());
		goto out;
	}
	uprintf("File length: %d bytes\n", dwTotalSize);

	fd = fopenU(file, "wb");
	if (fd == NULL) {
		uprintf("Unable to create file '%s': %s\n", file, WinInetErrorString());
		goto out;
	}

	// Keep checking for data until there is nothing left.
//.........这里部分代码省略.........
开发者ID:MehmetaliKuran,项目名称:rufus,代码行数:101,代码来源:net.c


示例12: InitInstance

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Сохранить дескриптор экземпляра в глобальной переменной

   hWnd = CreateWindow(szWindowClass, L"Пятнашки", WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX,100, 100, 640, 490, NULL, NULL, hInstance, NULL);

   CreateWindow(L"button", L"Перемішати", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,450, 40, 150, 30, hWnd, (HMENU)10000, hInstance, NULL);

   CreateWindow(L"button", L"Зберегти", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,	450, 80, 150, 30, hWnd, (HMENU)9000, hInstance, NULL);

   CreateWindow(L"button", L"Відкрити останнє", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 450, 120, 150, 30, hWnd, (HMENU)8000, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL);
   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   InvalidateRect(hWnd, NULL,true);
   UpdateWindow(hWnd);

   return TRUE;
}
开发者ID:OlexandrSavchuk,项目名称:cpp-lessons,代码行数:24,代码来源:game.cpp


示例13: RichUtil_Proc

static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	TRichUtil *ru = 0, tru;
	int idx;

	EnterCriticalSection(&csRich);
	tru.hwnd = hwnd;
	if (li.List_GetIndex(&sListInt, &tru, &idx))
		ru = (TRichUtil*)sListInt.items[idx];
	LeaveCriticalSection(&csRich);
	switch(msg) {
		case WM_THEMECHANGED:
		case WM_STYLECHANGED:
		{
			RichUtil_ClearUglyBorder(ru);
			break;
		}
		case WM_NCPAINT:
		{
			LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
			if (ru->hasUglyBorder&&MyIsThemeActive()) {
				HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");

				if (hTheme) {
					RECT rcBorder;
					RECT rcClient;
					int nState;
					HDC hdc = GetWindowDC(ru->hwnd);

					GetWindowRect(hwnd, &rcBorder);
					rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
					rcBorder.left = rcBorder.top = 0;
					CopyRect(&rcClient, &rcBorder);
					rcClient.left += ru->rect.left;
					rcClient.top += ru->rect.top;
					rcClient.right -= ru->rect.right;
					rcClient.bottom -= ru->rect.bottom;
					ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
					if(MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
						MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
					if(!IsWindowEnabled(hwnd))
						nState = ETS_DISABLED;
					else if(SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
						nState = ETS_READONLY;
					else nState = ETS_NORMAL;
					MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
					MyCloseThemeData(hTheme);
					ReleaseDC(hwnd, hdc);
					return 0;
				}
			}
			return ret;
		}
		case WM_NCCALCSIZE:
		{
			LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
			NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;

			if (ru->hasUglyBorder&&MyIsThemeActive()) {
				HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");

				if (hTheme) {
					RECT rcClient;
					HDC hdc = GetDC(GetParent(hwnd));

					ZeroMemory(&rcClient, sizeof(RECT));
					if(MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
						ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
						ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
						ru->rect.right = ncsParam->rgrc[0].right-rcClient.right;
						ru->rect.bottom = ncsParam->rgrc[0].bottom-rcClient.bottom;
						CopyRect(&ncsParam->rgrc[0], &rcClient);
						MyCloseThemeData(hTheme);
						ReleaseDC(GetParent(hwnd), hdc);
						return WVR_REDRAW;
					}
					ReleaseDC(GetParent(hwnd), hdc);
					MyCloseThemeData(hTheme);
				}
			}
			return ret;
		}
		case WM_ENABLE:
			RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
			break;
		case WM_DESTROY:
		{
			LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);

			if(IsWindow(hwnd)) {
				if((WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC) == &RichUtil_Proc)
					SetWindowLong(hwnd, GWL_WNDPROC, (LONG)ru->origProc);
			}
			EnterCriticalSection(&csRich);
			li.List_Remove(&sListInt, idx);
			LeaveCriticalSection(&csRich);
			if (ru) mir_free(ru);
			return ret;
		}
	}
	return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:101,代码来源:richutil.c


示例14: InitializeCoolSB

//
//	Initialize the cool scrollbars for a window by subclassing it
//	and using the coolsb window procedure instead
//
BOOL WINAPI InitializeCoolSB(HWND hwnd)
{
	SCROLLWND *sw;
	SCROLLINFO *si;
	INITCOMMONCONTROLSEX ice;
	TOOLINFO ti;
	RECT rect;
	DWORD dwCurStyle;
	//BOOL fDisabled;

	if(pEnableScrollBar == 0)
		pEnableScrollBar = EnableScrollBar;

	GetClientRect(hwnd, &rect);

	//if we have already initialized Cool Scrollbars for this window,
	//then stop the user from doing it again
	if(GetScrollWndFromHwnd(hwnd) != 0)
	{
		return FALSE;
	}

	//allocate a private scrollbar structure which we 
	//will use to keep track of the scrollbar data
	sw = (SCROLLWND *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SCROLLWND));

	si = &sw->sbarHorz.scrollInfo;
	si->cbSize = sizeof(SCROLLINFO);
	si->fMask  = SIF_ALL;
	GetScrollInfo(hwnd, SB_HORZ, si);

	si = &sw->sbarVert.scrollInfo;
	si->cbSize = sizeof(SCROLLINFO);
	si->fMask  = SIF_ALL;
	GetScrollInfo(hwnd, SB_VERT, si);

	//check to see if the window has left-aligned scrollbars
	if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_LEFTSCROLLBAR)
		sw->fLeftScrollbar = TRUE;
	else
		sw->fLeftScrollbar = FALSE;

	dwCurStyle = GetWindowLong(hwnd, GWL_STYLE);

	SetProp(hwnd, szPropStr, (HANDLE)sw);

	//try to enable the scrollbar arrows - if the return value is
	//non-zero, then the scrollbars were previously disabled
	//fDisabled = pEnableScrollBar(hwnd, SB_HORZ, ESB_ENABLE_BOTH);

	//scrollbars will automatically get enabled, even if
	//they aren't to start with....sorry, but there isn't an
	//easy alternative.
	if(dwCurStyle & WS_HSCROLL)
		sw->sbarHorz.fScrollFlags = CSBS_VISIBLE;

	if(dwCurStyle & WS_VSCROLL)
		sw->sbarVert.fScrollFlags = CSBS_VISIBLE;

	//need to be able to distinguish between horizontal and vertical
	//scrollbars in some instances
	sw->sbarHorz.nBarType	     = SB_HORZ;
	sw->sbarVert.nBarType	     = SB_VERT;

	sw->sbarHorz.fFlatScrollbar  = CSBS_NORMAL;
	sw->sbarVert.fFlatScrollbar  = CSBS_NORMAL;

	//set the default arrow sizes for the scrollbars
	sw->sbarHorz.nArrowLength	 = SYSTEM_METRIC;
	sw->sbarHorz.nArrowWidth	 = SYSTEM_METRIC;
	sw->sbarVert.nArrowLength	 = SYSTEM_METRIC;
	sw->sbarVert.nArrowWidth	 = SYSTEM_METRIC;

	sw->bPreventStyleChange		 = FALSE;
	
	sw->oldproc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)CoolSBWndProc);

	CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize());

#ifdef COOLSB_TOOLTIPS
	ice.dwSize = sizeof(ice);
	ice.dwICC  = ICC_BAR_CLASSES;
	InitCommonControlsEx(&ice);

	sw->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TOOLTIPS_CLASS, _T(""),
                            WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
                            CW_USEDEFAULT, CW_USEDEFAULT,
                            CW_USEDEFAULT, CW_USEDEFAULT,
                            hwnd, NULL, GetModuleHandle(0),
                            NULL);

	ti.cbSize = sizeof(TOOLINFO);
	ti.uFlags = TTF_IDISHWND;
	ti.hwnd   = hwnd;
	ti.uId    = (UINT)hwnd;
	ti.lpszText = LPSTR_TEXTCALLBACK;
//.........这里部分代码省略.........
开发者ID:raoergsls,项目名称:miranda,代码行数:101,代码来源:coolsblib.cpp


示例15: WinMain

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
            LPSTR lpCmdLine, int nCmdShow)
{
    HWND hWnd;
    WNDCLASSEX wcex;
    MSG nMsg;
    HFONT hfHelp;

    long lStyle;
    const char* lpWndClass = "CClock";
    const char* lpTitle = "";

    lWinWidth = 450;
    lWinHeight = 135;
    lDeskWidth = GetDeviceCaps(GetDC(GetDesktopWindow()), HORZRES);
    lDeskHeight = GetDeviceCaps(GetDC(GetDesktopWindow()), VERTRES);
    crWndColor = RGB(0, 0, 0);
    srand((unsigned)time(NULL));

    // The WNDCLASSEX details
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style = CS_DROPSHADOW;
    wcex.lpfnWndProc = WndProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP));
    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = CreateSolidBrush(crWndColor);
    wcex.lpszMenuName = NULL;
    wcex.lpszClassName = lpWndClass;
    wcex.hIconSm = NULL;

    RegisterClassEx(&wcex);

    hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, lpWndClass, lpTitle,
                          WS_POPUP, (lDeskWidth - lWinWidth)/2,
                          (lDeskHeight - lWinHeight)/2, lWinWidth, lWinHeight,
                          NULL, NULL, hInstance, NULL);

    hLblHelp = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "?",
                              WS_CHILD | SS_NOTIFY, 440, -2, 25, 20,
                              hWnd, NULL, hInstance, NULL);

    hfHelp = CreateFont(0, 6, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
                        ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
                        DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma");

    SendMessage(hLblHelp, WM_SETFONT, (WPARAM)hfHelp, (LPARAM)TRUE);

    lOpacity = 255;
    lStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
    SetWindowLong(hWnd, GWL_EXSTYLE, lStyle | WS_EX_LAYERED);
    SetLayeredWindowAttributes(hWnd, crWndColor, lOpacity, LWA_ALPHA);

    ShowWindow(hWnd, SW_SHOWNORMAL);
    ShowWindow(hLblHelp, SW_SHOWNORMAL);

    UpdateWindow(hWnd);

    SetTimer(hWnd, nIDTmr, 1000, TmrProc);
    fnParseTime(hWnd);

    while(GetMessage(&nMsg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&nMsg);
        DispatchMessage(&nMsg);
    }

    DeleteObject(hfHelp);
    return nMsg.wParam;
}
开发者ID:kineticpsychology,项目名称:windows.win32.apps,代码行数:72,代码来源:clk.c


示例16: s_video_gdi_create_window

void * s_video_gdi_create_window (void *arg)
{
	MSG msg;
	RECT rect;
	HDC mainwindow;
	WNDCLASSEX wndclass;
	char *szMainWndClass = "XynthWindowingSystem";
	s_video_gdi_data_t *priv = (s_video_gdi_data_t *) xynth_server->driver->driver_data;

	memset(&wndclass, 0, sizeof(WNDCLASSEX));
	wndclass.lpszClassName = szMainWndClass;
	wndclass.cbSize = sizeof(WNDCLASSEX);
	wndclass.style = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc = MainWndProc;
	wndclass.hInstance = priv->hinst;
	wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
	wndclass.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
	RegisterClassEx(&wndclass);
	
	priv->hwndMain = CreateWindow(szMainWndClass,
	                              "Xynth Windowing system",
                                      WS_POPUP | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX | WS_CAPTION,
	                              CW_USEDEFAULT,
	                              CW_USEDEFAULT,
	                              CW_USEDEFAULT,
	                              CW_USEDEFAULT,
	                              NULL,
	                              NULL,
	                              priv->hinst,
	                              NULL);

	rect.left = 0;
	rect.right = xynth_server->window->surface->width;
	rect.top = 0;
	rect.bottom = xynth_server->window->surface->height;
        AdjustWindowRect(&rect, GetWindowLong(priv->hwndMain, GWL_STYLE), FALSE);
        SetWindowPos(priv->hwndMain, HWND_TOP, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE);

	ShowWindow(priv->hwndMain, TRUE);
	UpdateWindow(priv->hwndMain);
	
	mainwindow = GetDC(priv->hwndMain);
	if (mainwindow == NULL) {
                debugf(DSER | DFAT, "What the fuck is this?");
		return NULL;
	}
	priv->bpp_windows = GetDeviceCaps(mainwindow, BITSPIXEL);
	if (priv->bpp_windows == 24) {
                debugf(DSER | DFAT, "24 bitsperpixel modes are not supported by Xynth Windowing System. "
                                    "Try changing display mode from "
                                    "Display Properties -> Settings -> Color quality.");
        }

	while (GetMessage(&msg, NULL, 0, 0)) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (void *) msg.wParam;
}
开发者ID:jetlive,项目名称:xynth,代码行数:62,代码来源:event.c


示例17: ChangeScreenMode

void ChangeScreenMode( gxBool bFullScreen )
{
	//フルスクリーン / ウインドウモード切り替え

	RECT rc;
	DEVMODE devmode;

	EnumDisplaySettings( NULL, 0, &devmode );

	if( bFullScreen )
	{
		//フルスクリーンモード
		if( g_pWindows->m_bFullScreen ) return;

		Sint32 w,h;
		w = 640;
		h = 480;
		g_pWindows->m_AppStyle = GetWindowLong( g_pWindows->m_hWindow , GWL_STYLE);
		GetWindowRect( g_pWindows->m_hWindow , &g_pWindows->m_WinRect );

		devmode.dmSize       = sizeof(DEVMODE);
		devmode.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT;
		devmode.dmPelsWidth  = w;//SWINDOW_W;
		devmode.dmPelsHeight = h;//SWINDOW_H;

		Sint32 bw,bh;
		bw =  GetSystemMetrics(SM_CXSIZEFRAME)*2;
		bh =  GetSystemMetrics(SM_CYSIZEFRAME)*2;
		SetMenu           ( g_pWindows->m_hWindow , NULL );
		SetWindowLong     ( g_pWindows->m_hWindow , GWL_STYLE, WS_POPUP|WS_VISIBLE|WS_EX_TOPMOST );
		MoveWindow        (	g_pWindows->m_hWindow , -bw/2,-bh/2, w+bw , h+bh , true	);

		Sint32 err = ChangeDisplaySettings( &devmode, CDS_FULLSCREEN );
		if( DISP_CHANGE_SUCCESSFUL )
		{
		}

		//マルチディスプレイ時のカーソルの移動制限を行う
		g_pWindows->m_uScreenWidth  = w;
		g_pWindows->m_uScreenHeight = h;

		SetRect(&rc, 0, 0, g_pWindows->m_uScreenWidth, g_pWindows->m_uScreenHeight );
		ClipCursor( &rc );

		UpdateWindow( g_pWindows->m_hWindow );

//		::Resume();

		g_pWindows->m_bFullScreen = gxTrue;

		while( ShowCursor(FALSE)>0 );
	}
	else
	{
		//Windowモード

		if( !g_pWindows->m_bFullScreen ) return;
/*
		devmode.dmSize       = sizeof(DEVMODE);
		devmode.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT;
		devmode.dmPelsWidth  = SWINDOW_W;
		devmode.dmPelsHeight = SWINDOW_H;
*/
		Sint32 bw,bh;
#ifdef NDEBUG
		bw =  GetSystemMetrics(SM_CXSIZEFRAME)*2;
		bh =  GetSystemMetrics(SM_CYSIZEFRAME)*2+GetSystemMetrics(SM_CYCAPTION);
//		SetMenu( ggx.m_Windows.g_hWnd , NULL );
#else
		bw =  GetSystemMetrics(SM_CXFIXEDFRAME)*2;
		bh =  GetSystemMetrics(SM_CYFIXEDFRAME)*2;
		bh += GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYMENU);
//		SetMenu( ggx.m_Windows.g_hWnd , LoadMenu( ggx.m_Windows.hInst ,	MAKEINTRESOURCE(CGameGirl::GetInstance()->MENU_BAR) ) );
#endif

		//Windowの大きさを元に戻す
		SetWindowLong( g_pWindows->m_hWindow , GWL_STYLE  , g_pWindows->m_AppStyle );
		SetWindowPos ( g_pWindows->m_hWindow,
		               HWND 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetWindowLongPtr函数代码示例发布时间:2022-05-30
下一篇:
C++ GetWindowInfo函数代码示例发布时间: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