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

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

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

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

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

示例1: ProxySettingsDialogFunc

BOOL CALLBACK ProxySettingsDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM lParam){  HICON hIcon;  switch (msg) {    case WM_INITDIALOG:      hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(APP_ICON),                                                       IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);      if (hIcon) {        SendMessage(hwndDlg, WM_SETICON, (WPARAM) (ICON_SMALL), (LPARAM) (hIcon));        SendMessage(hwndDlg, WM_SETICON, (WPARAM) (ICON_BIG), (LPARAM) (hIcon));      }      /* Limit Port editboxs to 5 chars. */      SendMessage(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_PORT), EM_SETLIMITTEXT, 5, 0);      SendMessage(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_PORT), EM_SETLIMITTEXT, 5, 0);      LoadProxySettings(hwndDlg);      break;    case WM_COMMAND:      switch (LOWORD(wParam)) {        case IDOK:          if (CheckProxySettings(hwndDlg))            {              SaveProxySettings(hwndDlg);              EndDialog(hwndDlg, LOWORD(wParam));              return TRUE;            }          return FALSE;        case IDCANCEL:           EndDialog(hwndDlg, LOWORD(wParam));          return TRUE;        case RB_PROXY_USE_OPENVPN:          if (HIWORD(wParam) == BN_CLICKED)            {              EnableWindow(GetDlgItem(hwndDlg, RB_PROXY_HTTP), FALSE);              EnableWindow(GetDlgItem(hwndDlg, RB_PROXY_SOCKS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_PORT), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_PORT), FALSE);              EnableWindow(GetDlgItem(hwndDlg, CHECKB_PROXY_AUTH), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_PORT), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_PORT), FALSE);              break;            }        case RB_PROXY_USE_IE:          if (HIWORD(wParam) == BN_CLICKED)            {              EnableWindow(GetDlgItem(hwndDlg, RB_PROXY_HTTP), FALSE);              EnableWindow(GetDlgItem(hwndDlg, RB_PROXY_SOCKS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_PORT), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_PORT), FALSE);              EnableWindow(GetDlgItem(hwndDlg, CHECKB_PROXY_AUTH), TRUE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_PORT), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_ADDRESS), FALSE);              EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_PORT), FALSE);              break;            }        case RB_PROXY_USE_MANUAL:          if (HIWORD(wParam) == BN_CLICKED)            {              EnableWindow(GetDlgItem(hwndDlg, RB_PROXY_HTTP), TRUE);              EnableWindow(GetDlgItem(hwndDlg, RB_PROXY_SOCKS), TRUE);              if (IsDlgButtonChecked(hwndDlg, RB_PROXY_HTTP) == BST_CHECKED)                {                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_ADDRESS), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_PORT), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_ADDRESS), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_PORT), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, CHECKB_PROXY_AUTH), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_ADDRESS), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_PORT), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_ADDRESS), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_PORT), FALSE);                }              else                {                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_ADDRESS), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_HTTP_PORT), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_ADDRESS), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_HTTP_PORT), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, CHECKB_PROXY_AUTH), FALSE);                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_ADDRESS), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, EDIT_PROXY_SOCKS_PORT), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_ADDRESS), TRUE);                  EnableWindow(GetDlgItem(hwndDlg, TEXT_PROXY_SOCKS_PORT), TRUE);//.........这里部分代码省略.........
开发者ID:Danixu,项目名称:OpenVPN-Portable,代码行数:101,


示例2: ClearKeyBuffers

glWindow::glWindow (bool fullScreen,                    bool border,                    int width,                    int height,                    int bpp,                    bool stencil,                    std::string title,                    bool allowResizing,                    bool fitToWorkArea,                    ResetGLModeType resetGLMode) {    m_resetGLMode   = resetGLMode;    // Null default values    // If constructor is aborted, then destructor wont try to deallocate garbage handles.    m_HDC       = 0;    m_HGLRC     = 0;    m_HWnd      = 0;    m_HInstance = 0;    m_active    = false;    m_focused   = false;    m_visible   = false;    m_closing   = false;    m_bufStart  = 0;    m_bufEnd    = 0;    m_scanBufStart  = 0;    m_scanBufEnd    = 0;    m_showingCursor = true;    // Clear key buffers    ClearKeyBuffers ();    // Defaults    m_fov               = 60;    m_nearClip          = 1;    m_farClip           = 1000;    m_painting          = false;    m_dontPaint         = false;    m_pausePressed      = false;    m_mouseX            = 0;    m_mouseY            = 0;    m_mouseButton [0]   = 0;    m_mouseButton [1]   = 0;    m_mouseButton [2]   = 0;    m_mouseWheel        = 0;    m_mouseWheelDelta   = 0;    m_mouseCentred      = false;   	m_HInstance		    = GetModuleHandle(NULL);				// Grab An Instance For Our Window    // Create open GL window.    // Note:    Caller should check error state after construction. If error set,    //          then the window is probably unusable	WNDCLASS	wc;						// Windows Class Structure	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	// Redraw On Size, And Own DC For Window.	wc.lpfnWndProc		= (WNDPROC) ::WndProc;					// WndProc Handles Messages	wc.cbClsExtra		= 0;									// No Extra Window Data	wc.cbWndExtra		= 0;									// No Extra Window Data	wc.hInstance		= m_HInstance;							// Set The Instance	wc.hIcon			= LoadIcon(NULL, IDI_WINLOGO);			// Load The Default Icon	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer	wc.hbrBackground	= NULL;									// No Background Required For GL	wc.lpszMenuName		= NULL;									// We Don't Want A Menu	wc.lpszClassName	= "gbOpenGL";   						// Set The Class Name	if (!RegisterClass(&wc))									// Attempt To Register The Window Class	{		SetError ("Window class registration failed");        return;	}    RecreateWindow (fullScreen, border, width, height, bpp, stencil, title, allowResizing, fitToWorkArea);}
开发者ID:bmatthew1,项目名称:LinB4GL,代码行数:73,


示例3: m_initResources

///////////////////////////////////  Constructor and destructor ///////////////////////////////////SpoutReceiverSDK2::SpoutReceiverSDK2():CFreeFrameGLPlugin(), m_initResources(1), m_maxCoordsLocation(-1){	HMODULE module;	char path[MAX_PATH];	/*	// Debug console window so printf works	FILE* pCout;	AllocConsole();	freopen_s(&pCout, "CONOUT$", "w", stdout); 	#ifdef DX9Mode	printf("SpoutReceiver2 DX9 Vers 3.025/n");	#else	printf("SpoutReceiver2 DX11 Vers 3.025/n");	#endif	*/	// Input properties - this is a source and has no inputs	SetMinInputs(0);	SetMaxInputs(0);		//	// ======== initial values ========	//	#ifdef DX9Mode	bDX9mode          = true;   // DirectX 9 mode rather than default DirectX 11	#else	bDX9mode          = false;	#endif	bInitialized      = false;  // not initialized yet by either means	bAspect           = false;  // preserve aspect ratio of received texture in draw	bUseActive        = true;   // connect to the active sender	bStarted          = false;  // Do not allow a starting cycle	UserSenderName[0] = 0;      // User entered sender name	g_Width	          = 512;	g_Height          = 512;    // arbitrary initial image size	myTexture         = 0;      // only used for memoryshare mode	//	// Parameters	//	// Memoryshare define	// if set to true (memory share only), it connects as memory share	// and there is no user option to select a sender	// default is false (automatic)	#ifndef MemoryShareMode	SetParamInfo(FFPARAM_SharingName, "Sender Name",   FF_TYPE_TEXT, "");	SetParamInfo(FFPARAM_Update,      "Update",        FF_TYPE_EVENT, false );	SetParamInfo(FFPARAM_Select,      "Select",        FF_TYPE_EVENT, false );	bMemoryMode = false;	#else	bMemoryMode = true;	#endif	SetParamInfo(FFPARAM_Aspect,       "Aspect",       FF_TYPE_BOOLEAN, false );	// For memory mode, tell Spout to use memoryshare	if(bMemoryMode) {		receiver.SetMemoryShareMode();		// Give it an arbitrary user name for ProcessOpenGL		strcpy_s(UserSenderName, 256, "0x8e14549a"); 	}	// Set DirectX mode depending on DX9 flag	if(bDX9mode) 		receiver.SetDX9(true);	else 	    receiver.SetDX9(false);	// Find the host executable name	module = GetModuleHandle(NULL);	GetModuleFileNameA(module, path, MAX_PATH);	_splitpath_s(path, NULL, 0, NULL, 0, HostName, MAX_PATH, NULL, 0);		// Isadora and Resolume act on button down	// Isadora activates all parameters on plugin load, so allow one cycle for starting.	// Magic reacts on button-up, so when the dll loads the parameters are not activated. 	// Magic and default Windows apps act on button up so all is OK.	if(strstr(HostName, "Avenue") == 0 || strstr(HostName, "Arena") == 0 || strstr(HostName, "Isadora") == 0) {		bStarted = false;	}	else {		bStarted = true;	}}
开发者ID:demondias,项目名称:Spout2,代码行数:95,


示例4: memset

BOOL INPUTCLASS::Init(HWND hParentWnd, INPUTPROC inputProc){	if (hParentWnd == NULL) return FALSE;	if (inputProc == NULL) return FALSE;	this->hParentWnd = hParentWnd;	pDI = NULL;	pKeyboard = NULL;	pJoystick = NULL;	Feedback = FALSE;	memset(cDIBuf, 0, sizeof(cDIBuf));	memset(JoystickName, 0, sizeof(JoystickName));	if(FAILED(DirectInput8Create(GetModuleHandle(NULL),DIRECTINPUT_VERSION,IID_IDirectInput8,(void**)&pDI,NULL)))		return FALSE;	if (!FAILED(pDI->CreateDevice(GUID_SysKeyboard,&pKeyboard,NULL)))	{		if (!FAILED(pKeyboard->SetDataFormat(&c_dfDIKeyboard)))		{			if (FAILED(pKeyboard->SetCooperativeLevel(hParentWnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE)))			{				pKeyboard->Release();				pKeyboard = NULL;			}		}		else		{			pKeyboard->Release();			pKeyboard = NULL;		}	}	pJoystick = EnumDevices(pDI);	if (pJoystick)	{		if(!FAILED(pJoystick->SetDataFormat(&c_dfDIJoystick2)))		{			if(FAILED(pJoystick->SetCooperativeLevel(hParentWnd,DISCL_FOREGROUND|DISCL_EXCLUSIVE)))			{				pJoystick->Release();				pJoystick = NULL;			}			else			{				tmp_Joystick = pJoystick;				pJoystick->EnumObjects(::EnumObjects, (VOID*)hParentWnd, DIDFT_ALL);				memset(&DIJoycap,0,sizeof(DIDEVCAPS));				DIJoycap.dwSize=sizeof(DIDEVCAPS);				pJoystick->GetCapabilities(&DIJoycap);			}		}		else		{			pJoystick->Release();			pJoystick = NULL;		}	}	if (pJoystick)	{		DIPROPDWORD dipdw;		dipdw.diph.dwSize = sizeof(DIPROPDWORD);		dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);		dipdw.diph.dwObj = 0;		dipdw.diph.dwHow = DIPH_DEVICE;		dipdw.dwData = 0;		if ( !FAILED( pJoystick->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph) ) )		{			DWORD		rgdwAxes[1] = { DIJOFS_Y };			LONG		rglDirection[2] = { 0 };			DICONSTANTFORCE		cf = { 0 };			DIEFFECT	eff;			cf.lMagnitude = (DI_FFNOMINALMAX * 100);						memset(&eff, 0, sizeof(eff));			eff.dwSize = sizeof(DIEFFECT);			eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;			eff.dwDuration = INFINITE;			eff.dwSamplePeriod = 0;			eff.dwGain = DI_FFNOMINALMAX;			eff.dwTriggerButton = DIEB_NOTRIGGER;			eff.dwTriggerRepeatInterval = 0;			eff.cAxes = 1;			eff.rgdwAxes = rgdwAxes;			eff.rglDirection = rglDirection;			eff.lpEnvelope = 0;			eff.cbTypeSpecificParams = sizeof( DICONSTANTFORCE );			eff.lpvTypeSpecificParams = &cf;			eff.dwStartDelay = 0;			if( FAILED( pJoystick->CreateEffect(GUID_ConstantForce, &eff, &pEffect, NULL) ) )				Feedback = FALSE;		}		else			Feedback = FALSE;	}//.........这里部分代码省略.........
开发者ID:snowasnow,项目名称:DeSmuME,代码行数:101,


示例5: CC_BREAK_IF

bool CCEGLView::Create(){    bool bRet = false;    do    {        CC_BREAK_IF(m_hWnd);        HINSTANCE hInstance = GetModuleHandle( NULL );        WNDCLASS  wc;        // Windows Class Structure        // Redraw On Size, And Own DC For Window.        wc.style          = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;        wc.lpfnWndProc    = _WindowProc;                    // WndProc Handles Messages        wc.cbClsExtra     = 0;                              // No Extra Window Data        wc.cbWndExtra     = 0;                                // No Extra Window Data        wc.hInstance      = hInstance;                        // Set The Instance        wc.hIcon          = LoadIcon( NULL, IDI_WINLOGO );    // Load The Default Icon        wc.hCursor        = LoadCursor( NULL, IDC_ARROW );    // Load The Arrow Pointer        wc.hbrBackground  = NULL;                           // No Background Required For GL        wc.lpszMenuName   = m_menu;                         //        wc.lpszClassName  = kWindowClassName;               // Set The Class Name        CC_BREAK_IF(! RegisterClass(&wc) && 1410 != GetLastError());        // center window position        RECT rcDesktop;        GetWindowRect(GetDesktopWindow(), &rcDesktop);        WCHAR wszBuf[50] = {0};        MultiByteToWideChar(CP_UTF8, 0, m_szViewName, -1, wszBuf, sizeof(wszBuf));        // create window        m_hWnd = CreateWindowEx(            WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,    // Extended Style For The Window            kWindowClassName,                                    // Class Name            wszBuf,                                                // Window Title            WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX,        // Defined Window Style            0, 0,                                                // Window Position            //TODO: Initializing width with a large value to avoid getting a wrong client area by 'GetClientRect' function.            1000,                                               // Window Width            1000,                                               // Window Height            NULL,                                                // No Parent Window            NULL,                                                // No Menu            hInstance,                                            // Instance            NULL );        CC_BREAK_IF(! m_hWnd);        bRet = initGL();		if(!bRet) destroyGL();        CC_BREAK_IF(!bRet);        s_pMainWindow = this;        bRet = true;    } while (0);#if(_MSC_VER >= 1600)    m_bSupportTouch = CheckTouchSupport();    if(m_bSupportTouch)	{	    m_bSupportTouch = (s_pfRegisterTouchWindowFunction(m_hWnd, 0) != 0);    }#endif /* #if(_MSC_VER >= 1600) */    return bRet;}
开发者ID:lmxing1987,项目名称:CrossApp,代码行数:66,


示例6: CheckMessageBoxProc

/** * Below CheckMessageBoxProc adds everyones favorite "don't show again" checkbox to the dialog * much of the layout code (especially for XP and older windows versions) is copied with changes * from a GPL'ed project emabox at SourceForge. **/LRESULT CALLBACK CheckMessageBoxProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){	switch (uMsg)	{		case WM_COMMAND:		{			if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == 2025)			{				const LRESULT res = SendMessage((HWND)lParam, BM_GETSTATE, 0, 0);				bool bCheckedAfter = ((res & BST_CHECKED) == 0);								// Update usedata				ExMessageBox::SetUserData((void*)(bCheckedAfter ? BST_CHECKED : BST_UNCHECKED));								SendMessage((HWND)lParam, BM_SETCHECK, bCheckedAfter ? BST_CHECKED : BST_UNCHECKED, 0);			}		}		break;		case WM_ERASEBKGND:		{			// Vista+ has grey strip			if (WinUtil::getOsMajor() >= 6)			{				RECT rc = {0};				HDC dc = (HDC)wParam;								// Fill the entire dialog				GetClientRect(hWnd, &rc);				FillRect(dc, &rc, GetSysColorBrush(COLOR_WINDOW));								// Calculate strip height				RECT rcButton = {0};				GetWindowRect(FindWindowEx(hWnd, NULL, L"BUTTON", NULL), &rcButton);				int stripHeight = (rcButton.bottom - rcButton.top) + 24;								// Fill the strip				rc.top += (rc.bottom - rc.top) - stripHeight;				FillRect(dc, &rc, GetSysColorBrush(COLOR_3DFACE));								// Make a line				HGDIOBJ oldPen = SelectObject(dc, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)));				MoveToEx(dc, rc.left - 1, rc.top, (LPPOINT)NULL);				LineTo(dc, rc.right, rc.top);				DeleteObject(SelectObject(dc, oldPen));				return S_OK;			}		}		break;		case WM_CTLCOLORSTATIC:		{			// Vista+ has grey strip			if ((WinUtil::getOsMajor() >= 6) && ((HWND)lParam == GetDlgItem(hWnd, 2025)))			{				HDC hdc = (HDC)wParam;				SetBkMode(hdc, TRANSPARENT);				return (LRESULT)GetSysColorBrush(COLOR_3DFACE);			}		}		break;		case WM_INITDIALOG:		{			RECT rc = {0};			HWND current = NULL;			int iWindowWidthBefore;			int iWindowHeightBefore;			int iClientHeightBefore;			int iClientWidthBefore;						pair<LPCTSTR, UINT> checkdata = (*(pair<LPCTSTR, UINT>*)ExMessageBox::GetUserData());						GetClientRect(hWnd, &rc);			iClientHeightBefore = rc.bottom - rc.top;			iClientWidthBefore = rc.right - rc.left;						GetWindowRect(hWnd, &rc);			iWindowWidthBefore = rc.right - rc.left;			iWindowHeightBefore = rc.bottom - rc.top;						// Create checkbox (resized and moved later)			HWND check = CreateWindow(L"BUTTON", checkdata.first, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_VCENTER | BS_CHECKBOX,			                          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,			                          hWnd, (HMENU)2025, GetModuleHandle(NULL), NULL			                         );			                         			// Assume checked by default			SendMessage(check, BM_SETCHECK, checkdata.second, 0);			ExMessageBox::SetUserData((void*)checkdata.second); 						// Apply default font			const int cyMenuSize = GetSystemMetrics(SM_CYMENUSIZE);			const int cxMenuSize = GetSystemMetrics(SM_CXMENUSIZE);			const HFONT hNewFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);			HFONT hOldFont;			SIZE size;			//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:airdc-svn,代码行数:101,


示例7: GetModuleHandle

IDirect3DDevice9 *d3dwin_open( char *title, unsigned int width_, unsigned int height_, D3DFORMAT format, BOOL fullscreen_ ){	DIRECT3DCREATE9 Direct3DCreate9;	RECT rect;	WNDCLASS wc;	UINT32 style;	D3DDISPLAYMODE displaymode;	D3DPRESENT_PARAMETERS presentparameters;	D3DCAPS9 caps;	width = width_;	height = height_;	fullscreen = fullscreen_;	inst = GetModuleHandle(NULL);	library = (HMODULE) LoadLibrary("d3d9.dll");	if(!library) return NULL;	Direct3DCreate9 = (DIRECT3DCREATE9) GetProcAddress(library,"Direct3DCreate9");	if(!Direct3DCreate9) return NULL;	direct3d=Direct3DCreate9(D3D_SDK_VERSION);	if(!direct3d) return NULL;	if(!fullscreen)		style = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU;	else{		style = WS_POPUP;		ShowCursor(FALSE);	}	rect.left = 0;	rect.top = 0;	rect.right = width;	rect.bottom = height;	if(!fullscreen) AdjustWindowRect( &rect, style, FALSE );		wc.style = CS_VREDRAW|CS_HREDRAW;	wc.lpfnWndProc = window_proc;	wc.cbClsExtra = 0;	wc.cbWndExtra = 0;	wc.hInstance = 0;	wc.hIcon = LoadIcon(inst,MAKEINTRESOURCE(IDI_ICON));	wc.hCursor = LoadCursor(inst,IDC_ARROW);	wc.hbrBackground = 0;	wc.lpszMenuName = 0;	wc.lpszClassName = "d3d9";	RegisterClass(&wc);		win = CreateWindowEx(0, "d3d9", title, (style)|WS_VISIBLE, 0, 0, rect.right-rect.left, rect.bottom-rect.top, 0, 0, inst, 0);	if(!win) return NULL;	memset(&presentparameters, 0, sizeof(D3DPRESENT_PARAMETERS));	if(!fullscreen){		if(FAILED(IDirect3D9_GetAdapterDisplayMode( direct3d, D3DADAPTER_DEFAULT, &displaymode ))){			d3dwin_close();			return NULL;		}	}	if(!fullscreen) presentparameters.Windowed = TRUE;	presentparameters.SwapEffect = D3DSWAPEFFECT_DISCARD;	presentparameters.BackBufferWidth = width;	presentparameters.BackBufferHeight = height;	if( fullscreen ) presentparameters.BackBufferFormat = format;	else presentparameters.BackBufferFormat = displaymode.Format;	presentparameters.AutoDepthStencilFormat = D3DFMT_D24S8;	presentparameters.EnableAutoDepthStencil = TRUE;	IDirect3D9_GetDeviceCaps(direct3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);	if(FAILED(IDirect3D9_CreateDevice( direct3d,		D3DADAPTER_DEFAULT,		D3DDEVTYPE_HAL,		win,		(caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT) ? D3DCREATE_HARDWARE_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING,		&presentparameters,		&device))){		d3dwin_close();		return NULL;	}	IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);	IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);	return device;}
开发者ID:imclab,项目名称:Open-World-Domination,代码行数:91,


示例8: GetStockObject

void ToolsOptionsWindow::OnCreate (HWND hWnd){					// Make this window handle global	m_hwnd = hWnd;	g_hWnd = hWnd; // Need to do this otherwise the control creation wrapper functions don't work.	HFONT hfDefault = (HFONT) GetStockObject (DEFAULT_GUI_FONT);	// The status list box	m_lstcategory = CreateWindow ("listbox", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL, 10, 10, 100, 480, hWnd, (HMENU) ID_LSTOPTIONCATEGORY, GetModuleHandle (NULL), NULL);	SendMessage (m_lstcategory, WM_SETFONT, (WPARAM) hfDefault, MAKELPARAM (FALSE, 0));	SendMessage (m_lstcategory, LB_SETITEMHEIGHT, 0, 32);	CreateGeneralPanel ();	//ID_OPTWINDOWCLOSE	m_btnclose = CreateButton ("Close", 455, 440, 70, 23, ID_OPTWINDOWCLOSE);	// Add the categories to the list box	char szGeneral[SIZE_NAME];	ZeroMemory (szGeneral, SIZE_NAME);	strcpy_s (szGeneral, SIZE_NAME, "General");	SendMessage (m_lstcategory, LB_ADDSTRING, 0, (LPARAM) szGeneral);	// Read the registry settings, and set the control values	ReadRegistrySettings ();}
开发者ID:dannydraper,项目名称:CedeCryptClassic,代码行数:30,


示例9: main_skin_open

//.........这里部分代码省略.........			memset(&Skin, 0, sizeof(Skin));		GetPrivateProfileString(NULL, NULL, NULL,							buffer, sizeof(buffer), pathbuf);	                        	returnval = GetPrivateProfileSection("CoolPlayer Skin", // address of section name										 values, // address of return buffer										 32767, // size of return buffer										 pathbuf // address of initialization filename										);	                                    	if (returnval == 0)	{		char    textbuf[MAX_PATH + 50];		sprintf(textbuf, "Not a valid CoolPlayer Skin file: %s", pathbuf);		MessageBox(GetForegroundWindow(), textbuf, "error", MB_ICONERROR);		options.use_default_skin = TRUE;		return FALSE;	}		textposition = values;		while (*textposition != 0)	{			main_skin_check_ini_value(textposition, associate);		textposition = textposition + strlen(textposition) + 1;	}		path_remove_filespec(pathbuf);		strcat(pathbuf, Skin.CoolUp);	hInstance = GetModuleHandle(NULL);	DeleteObject(graphics.bmp_main_up);	graphics.bmp_main_up =		(HBITMAP) LoadImage(hInstance, pathbuf, IMAGE_BITMAP, 0, 0,							LR_LOADFROMFILE);	                        	if (!graphics.bmp_main_up)	{		strcat(errorbuf, pathbuf);		strcat(errorbuf, "/n");	}		path_remove_filespec(pathbuf);		strcat(pathbuf, Skin.CoolDown);	DeleteObject(graphics.bmp_main_down);	graphics.bmp_main_down =		(HBITMAP) LoadImage(hInstance, pathbuf, IMAGE_BITMAP, 0, 0,							LR_LOADFROMFILE);	                        	if (!graphics.bmp_main_down)	{		strcat(errorbuf, pathbuf);		strcat(errorbuf, "/n");	}		path_remove_filespec(pathbuf);		strcat(pathbuf, Skin.CoolSwitch);	DeleteObject(graphics.bmp_main_switch);	graphics.bmp_main_switch =		(HBITMAP) LoadImage(hInstance, pathbuf, IMAGE_BITMAP, 0, 0,							LR_LOADFROMFILE);
开发者ID:Runcy,项目名称:coolplayer,代码行数:67,


示例10: BeginD3DStuff

////////////////////////////////////////////////////////////// BeginD3DStuff//// Look all busy and important in case any graphic drivers are looking////////////////////////////////////////////////////////////void BeginD3DStuff( void ){    pD3D9 = Direct3DCreate9( D3D_SDK_VERSION );    if ( !pD3D9 )    {        WriteDebugEvent( "D3DStuff - Direct3DCreate9 failed" );        return;    }    WriteDebugEvent( "D3DStuff -------------------------" );    WriteDebugEvent( SString( "D3DStuff - Direct3DCreate9: 0x%08x", pD3D9 ) );    // Get info about each connected adapter    uint uiNumAdapters = pD3D9->GetAdapterCount();    WriteDebugEvent( SString( "D3DStuff - %d Adapters", uiNumAdapters ) );    for ( uint i = 0 ; i < uiNumAdapters ; i++ )    {        D3DADAPTER_IDENTIFIER9 Identifier;        D3DDISPLAYMODE DisplayMode;        D3DCAPS9 Caps9;        HRESULT hr1 = pD3D9->GetAdapterIdentifier( i, 0, &Identifier );        HRESULT hr2 = pD3D9->GetAdapterDisplayMode( i, &DisplayMode );        HRESULT hr3 = pD3D9->GetDeviceCaps( i, D3DDEVTYPE_HAL, &Caps9 );        UINT ModeCount = pD3D9->GetAdapterModeCount( i, D3DFMT_X8R8G8B8 );        HMONITOR hMonitor = pD3D9->GetAdapterMonitor( i );        if ( FAILED( hr1 ) || FAILED( hr2 ) || FAILED( hr3 ) )        {            WriteDebugEvent( SString( "D3DStuff %d Failed GetAdapterIdentifier(%x) GetAdapterDisplayMode(%x) GetDeviceCaps(%x) ", i, hr1, hr2, hr3 ) );            continue;        }        // Detect Optimus combo        if ( SStringX( Identifier.Driver ).BeginsWithI( "nv" )            && SStringX( Identifier.Description ).BeginsWithI( "Intel" )            )        {            bDetectedOptimus = true;            WriteDebugEvent( SString( "D3DStuff %d - Detected Optimus Combo", i ) );        }        if ( GetModuleHandle( "nvd3d9wrap.dll" ) != NULL )        {            bDetectedOptimus = true;            WriteDebugEvent( SString( "D3DStuff %d - Detected nvd3d9wrap", i ) );        }        WriteDebugEvent( SString( "D3DStuff %d Identifier - %s", i, *ToString( Identifier ) ) );        WriteDebugEvent( SString( "D3DStuff %d DisplayMode - %s", i, *ToString( DisplayMode ) ) );        WriteDebugEvent( SString( "D3DStuff %d  hMonitor:0x%08x  ModeCount:%d", i, hMonitor, ModeCount ) );        WriteDebugEvent( SString( "D3DStuff %d Caps9 - %s ", i, *ToString( Caps9 ) ) );    }    if ( GetApplicationSettingInt( "nvhacks", "optimus-force-detection" ) )        bDetectedOptimus = true;    SetApplicationSettingInt( "nvhacks", "optimus", bDetectedOptimus );    if ( bDetectedOptimus )    {        ShowOptimusDialog ( g_hInstance );        HideOptimusDialog ();    }    else    {        SetApplicationSettingInt( "nvhacks", "optimus-alt-startup", 0 );        SetApplicationSettingInt( "nvhacks", "optimus-rename-exe", 0 );        SetApplicationSettingInt( "nvhacks", "optimus-export-enablement", 0 );        SetApplicationSettingInt( "nvhacks", "optimus-force-windowed", 0 );    }}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:80,


示例11: CreateAppWindow

BOOL CreateAppWindow(const char* title, int width, int height, int bits, bool fullscreenflag){    windowWidth  = width;    windowHeight = height;    windowName   = title;	GLuint		PixelFormat;			// Holds The Results After Searching For A Match	WNDCLASS	wc;						// Windows Class Structure	DWORD		dwExStyle;				// Window Extended Style	DWORD		dwStyle;				// Window Style	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values	WindowRect.left=(long)0;			// Set Left Value To 0	WindowRect.right=(long)width;		// Set Right Value To Requested Width	WindowRect.top=(long)0;				// Set Top Value To 0	WindowRect.bottom=(long)height;		// Set Bottom Value To Requested Height	gFullscreen=fullscreenflag;			// Set The Global Fullscreen Flag        HICON hIcon = (HICON)LoadImage(0,IDI_WINLOGO,IMAGE_ICON,0,0,LR_SHARED);	hInstance			= GetModuleHandle(NULL);				// Grab An Instance For Our Window	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	// Redraw On Size, And Own DC For Window.	wc.lpfnWndProc		= (WNDPROC) WndProc;					// WndProc Handles Messages	wc.cbClsExtra		= 0;									// No Extra Window Data	wc.cbWndExtra		= 0;									// No Extra Window Data	wc.hInstance		= hInstance;							// Set The Instance	wc.hIcon			= 0;	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer	wc.hbrBackground	= NULL;									// No Background Required For GL	wc.lpszMenuName		= NULL;									// We Don't Want A Menu	wc.lpszClassName	= "OpenGL";								// Set The Class Name	if (!RegisterClass(&wc))									// Attempt To Register The Window Class	{		MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return FALSE;											// Return FALSE	}		if (gFullscreen)												// Attempt Fullscreen Mode?	{		DEVMODE dmScreenSettings;								// Device Mode		memset(&dmScreenSettings,0,sizeof(dmScreenSettings));	// Makes Sure Memory's Cleared		dmScreenSettings.dmSize=sizeof(dmScreenSettings);		// Size Of The Devmode Structure		dmScreenSettings.dmPelsWidth	= width;				// Selected Screen Width		dmScreenSettings.dmPelsHeight	= height;				// Selected Screen Height		dmScreenSettings.dmBitsPerPel	= bits;					// Selected Bits Per Pixel		dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;		// Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.		if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)		{			// If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.			if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By/nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)			{				gFullscreen=FALSE;		// Windowed Mode Selected.  Fullscreen = FALSE			}			else			{				// Pop Up A Message Box Letting User Know The Program Is Closing.				MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);				return FALSE;									// Return FALSE			}		}	}	if (gFullscreen)												// Are We Still In Fullscreen Mode?	{		dwExStyle=WS_EX_APPWINDOW;								// Window Extended Style		dwStyle=WS_POPUP;										// Windows Style		ShowCursor(FALSE);										// Hide Mouse Pointer	}	else	{		dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;			// Window Extended Style		dwStyle=WS_OVERLAPPEDWINDOW;							// Windows Style	}	AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);		// Adjust Window To True Requested Size	// Create The Window	if (!(hWnd=CreateWindowEx(	dwExStyle,							// Extended Style For The Window								"OpenGL",							// Class Name								title,								// Window Title								dwStyle |							// Defined Window Style								WS_CLIPSIBLINGS |					// Required Window Style								WS_CLIPCHILDREN,					// Required Window Style								0, 0,								// Window Position								WindowRect.right-WindowRect.left,	// Calculate Window Width								WindowRect.bottom-WindowRect.top,	// Calculate Window Height								NULL,								// No Parent Window								NULL,								// No Menu								hInstance,							// Instance								NULL)))								// Dont Pass Anything To WM_CREATE	{		CloseWindow();								// Reset The Display		MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);		return FALSE;								// Return FALSE	}	static	PIXELFORMATDESCRIPTOR pfd=				// pfd Tells Windows How We Want Things To Be//.........这里部分代码省略.........
开发者ID:JoshMarino,项目名称:lims-hsv-system,代码行数:101,


示例12: getProcessHandle

void* getProcessHandle() {    return (void*)GetModuleHandle(NULL);}
开发者ID:krichter722,项目名称:jdk9-jdk9-jdk,代码行数:3,


示例13: getWindowsVersion

bool getWindowsVersion(char* version){	int index = 0;	OSVERSIONINFOEX osvi = {};	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);	if (!GetVersionEx((OSVERSIONINFO*)&osvi))		return false;	if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)		return false;// Vista	if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)	{		if (osvi.wProductType == VER_NT_WORKSTATION)		{			index += sprintf(version + index, "Microsoft Windows Vista");			uint32_t productType = 0;			HMODULE hKernel = GetModuleHandle("KERNEL32.DLL");			if (hKernel)			{				typedef bool (*funcGetProductInfo)(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t*);				funcGetProductInfo pGetProductInfo = (funcGetProductInfo)GetProcAddress(hKernel, "GetProductInfo"); 				if (pGetProductInfo)					pGetProductInfo(6, 0, 0, 0, &productType);	  				switch (productType)				{				case PRODUCT_STARTER:				{					index += sprintf(version + index, " Starter");					break;				}				case PRODUCT_HOME_BASIC_N:				{					index += sprintf(version + index, " Home Basic N");					break;				}				case PRODUCT_HOME_BASIC:				{					index += sprintf(version + index, " Home Basic");					break;				}				case PRODUCT_HOME_PREMIUM:				{					index += sprintf(version + index, " Home Premium");					break;				}				case PRODUCT_BUSINESS_N:				{					index += sprintf(version + index, " Business N");					break;				}				case PRODUCT_BUSINESS:				{					index += sprintf(version + index, " Business");					break;				}				case PRODUCT_ENTERPRISE:				{					index += sprintf(version + index, " Enterprise");					break;				}				case PRODUCT_ULTIMATE:				{					index += sprintf(version + index, " Ultimate");					break;				}				default:					break;				}			}		}		else if (osvi.wProductType == VER_NT_SERVER)		{			index += sprintf(version + index, "Microsoft Windows Server 2008");			if (osvi.wSuiteMask & VER_SUITE_DATACENTER)				index += sprintf(version + index, " Datacenter Edition");			else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)				index += sprintf(version + index, " Enterprise Edition");			else if (osvi.wSuiteMask == VER_SUITE_BLADE)				index += sprintf(version + index, " Web Edition");			else				index += sprintf(version + index, " Standard Edition");		}	}// Windows Server 2003	else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)	{		index += sprintf(version + index, "Microsoft Windows Server 2003");		if (GetSystemMetrics(SM_SERVERR2))			index += sprintf(version + index, " R2");//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:101,


示例14: PTABDEF

PTABDEF OEMDEF::GetXdef(PGLOBAL g)  {  typedef PTABDEF (__stdcall *XGETDEF) (PGLOBAL, void *);  char    c, getname[40] = "Get";  PTABDEF xdefp;  XGETDEF getdef = NULL;  PCATLG  cat = Cat;#if defined(WIN32)  // Is the DLL already loaded?  if (!Hdll && !(Hdll = GetModuleHandle(Module)))    // No, load the Dll implementing the function    if (!(Hdll = LoadLibrary(Module))) {      char  buf[256];      DWORD rc = GetLastError();      sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, Module);      FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |                    FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,                    (LPTSTR)buf, sizeof(buf), NULL);      strcat(strcat(g->Message, ": "), buf);      return NULL;      } // endif hDll  // The exported name is always in uppercase  for (int i = 0; ; i++) {    c = Subtype[i];    getname[i + 3] = toupper(c);    if (!c) break;    } // endfor i  // Get the function returning an instance of the external DEF class  if (!(getdef = (XGETDEF)GetProcAddress((HINSTANCE)Hdll, getname))) {    sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname);    FreeLibrary((HMODULE)Hdll);    return NULL;    } // endif getdef#else   // !WIN32  const char *error = NULL;  // Is the library already loaded?//  if (!Hdll && !(Hdll = ???))  // Load the desired shared library  if (!(Hdll = dlopen(Module, RTLD_LAZY))) {    error = dlerror();    sprintf(g->Message, MSG(SHARED_LIB_ERR), Module, SVP(error));    return NULL;    } // endif Hdll  // The exported name is always in uppercase  for (int i = 0; ; i++) {    c = Subtype[i];    getname[i + 3] = toupper(c);    if (!c) break;    } // endfor i  // Get the function returning an instance of the external DEF class  if (!(getdef = (XGETDEF)dlsym(Hdll, getname))) {    error = dlerror();    sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error));    dlclose(Hdll);    return NULL;    } // endif getdef#endif  // !WIN32  // Just in case the external Get function does not set error messages  sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype);  // Get the table definition block  if (!(xdefp = getdef(g, NULL)))    return NULL;  // Have the external class do its complete definition  if (!cat->Cbuf) {    // Suballocate a temporary buffer for the entire column section    cat->Cblen = cat->GetSizeCatInfo("Colsize", "8K");    cat->Cbuf = (char*)PlugSubAlloc(g, NULL, cat->Cblen);    } // endif Cbuf  // Here "OEM" should be replace by a more useful value  if (xdefp->Define(g, cat, Name, "OEM"))    return NULL;  // Ok, return external block  return xdefp;  } // end of GetXdef
开发者ID:SunguckLee,项目名称:MariaDB,代码行数:85,


示例15: TCOD_sys_get_num_cores

int TCOD_sys_get_num_cores() {#ifdef TCOD_WINDOWS	/* what a crap !!! works only on xp sp3 & vista */	typedef enum _PROCESSOR_CACHE_TYPE {	  CacheUnified,	  CacheInstruction,	  CacheData,	  CacheTrace	} PROCESSOR_CACHE_TYPE;	typedef struct _CACHE_DESCRIPTOR {	  BYTE                   Level;	  BYTE                   Associativity;	  WORD                   LineSize;	  DWORD                  Size;	  PROCESSOR_CACHE_TYPE   Type;	} CACHE_DESCRIPTOR,	 *PCACHE_DESCRIPTOR;	typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {	  RelationProcessorCore,	  RelationNumaNode,	  RelationCache,	  RelationProcessorPackage	} LOGICAL_PROCESSOR_RELATIONSHIP;	typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {	  ULONG_PTR                        ProcessorMask;	  LOGICAL_PROCESSOR_RELATIONSHIP   Relationship;	  union {	    struct {	      BYTE Flags;	    } ProcessorCore;	    struct {	      DWORD NodeNumber;	    } NumaNode;	    CACHE_DESCRIPTOR Cache;	    ULONGLONG Reserved[2];	  };	} SYSTEM_LOGICAL_PROCESSOR_INFORMATION,	 *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;	typedef BOOL (WINAPI *LPFN_GLPI)(	    PSYSTEM_LOGICAL_PROCESSOR_INFORMATION,	    PDWORD);    LPFN_GLPI glpi;    BOOL done = FALSE;    PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL;    PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL;    DWORD returnLength = 0;    DWORD logicalProcessorCount = 0;    DWORD byteOffset = 0;    glpi = (LPFN_GLPI) GetProcAddress(                            GetModuleHandle(TEXT("kernel32")),                            "GetLogicalProcessorInformation");    if (! glpi) {        return 1;    }    while (!done) {        DWORD rc = glpi(buffer, &returnLength);        if (FALSE == rc)        {            if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {                if (buffer)                    free(buffer);                buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc(                        returnLength);                if (NULL == buffer) {                    return 1;                }            } else {                return 1;            }        } else {            done = TRUE;        }    }    ptr = buffer;    while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) {        switch (ptr->Relationship) {        case RelationProcessorCore:            /* A hyperthreaded core supplies more than one logical processor. */            logicalProcessorCount += CountSetBits(ptr->ProcessorMask);            break;        default: break;        }        byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);        ptr++;    }    free(buffer);    return logicalProcessorCount;#else//.........这里部分代码省略.........
开发者ID:Amarna,项目名称:libtcod,代码行数:101,


示例16: main_set_default_skin

int main_set_default_skin(void){	HINSTANCE hInstance;	float   positionpercentage;		if (Skin.Object[PositionSlider].maxw == 1)	{		positionpercentage =			(float) globals.main_int_track_position /			(float) Skin.Object[PositionSlider].h;	}		else	{		positionpercentage =			(float) globals.main_int_track_position /			(float) Skin.Object[PositionSlider].w;	}		globals.main_int_title_scroll_position = 0;	globals.mail_int_title_scroll_max_position = 0;	memset(&Skin, 0, sizeof(Skin));		main_skin_set_struct_value(PlaySwitch, 172, 23, 24, 16, 0, 19, 60, 24,							   7, "");	main_skin_set_struct_value(StopSwitch, 222, 23, 24, 16, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(PauseSwitch, 197, 23, 24, 16, 0, 197, 23,							   25, 17, "");	main_skin_set_struct_value(RepeatSwitch, 197, 57, 24, 16, 0, 96, 60,							   35, 7, "");	main_skin_set_struct_value(ShuffleSwitch, 158, 57, 38, 16, 0, 50, 60,							   39, 7, "");	main_skin_set_struct_value(EqSwitch, 97, 93, 17, 28, 0, 97, 93, 18, 29,							   "");	main_skin_set_struct_value(MinimizeButton, 230, 5, 7, 8, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(ExitButton, 239, 5, 7, 8, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(NextSkinButton, 254, 44, 9, 27, 0, 0, 0, 0,							   0, "");	main_skin_set_struct_value(EjectButton, 222, 40, 24, 16, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(NextButton, 197, 40, 24, 16, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(PrevButton, 172, 40, 24, 16, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(MoveArea, 0, 0, 229, 12, 0, 0, 0, 0, 0, "");	main_skin_set_struct_value(PlaylistButton, 222, 57, 24, 16, 0, 0, 0, 0,							   0, "");	main_skin_set_struct_value(VolumeSlider, 84, 95, 9, 75, 1, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(PositionSlider, 12, 78, 233, 8, 0, 0, 0, 0,							   0, "");	main_skin_set_struct_value(Eq1, 115, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq2, 132, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq3, 149, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq4, 166, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq5, 183, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq6, 200, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq7, 217, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(Eq8, 234, 95, 9, 75, 1, 0, 0, 0, 0, "");	main_skin_set_struct_value(SongtitleText, 18, 21, 6, 13, 23, 0, 0, 0,							   0, "");	main_skin_set_struct_value(TrackText, 18, 44, 13, 14, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(TimeText, 59, 35, 13, 14, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(BitrateText, 83, 48, 0, 0, 0, 0, 0, 0, 0,							   "");	main_skin_set_struct_value(FreqText, 125, 48, 0, 0, 0, 0, 0, 0, 0, "");		Skin.transparentcolor = 0x0000ff00;	hInstance = GetModuleHandle(NULL);	graphics.bmp_main_up =		(HBITMAP) LoadImage(hInstance, MAKEINTRESOURCE(IDB_MAINUP),							IMAGE_BITMAP, 0, 0, 0L);	graphics.bmp_main_down =		(HBITMAP) LoadImage(hInstance, MAKEINTRESOURCE(IDB_MAINDOWN),							IMAGE_BITMAP, 0, 0, 0L);	graphics.bmp_main_switch = graphics.bmp_main_down;	graphics.bmp_main_time_font =		(HBITMAP) LoadImage(hInstance, MAKEINTRESOURCE(IDB_MAINBIGFONT),							IMAGE_BITMAP, 0, 0, 0L);	graphics.bmp_main_track_font = graphics.bmp_main_time_font;	graphics.bmp_main_title_font =		(HBITMAP) LoadImage(hInstance, MAKEINTRESOURCE(IDB_MAINSMALLFONT),							IMAGE_BITMAP, 0, 0, 0L);	                        	if (Skin.Object[PositionSlider].maxw == 1)	{		globals.main_int_track_position =			(int)((float)(Skin.Object[PositionSlider].h) *				  positionpercentage);	}		else//.........这里部分代码省略.........
开发者ID:Runcy,项目名称:coolplayer,代码行数:101,


示例17: main

int main(){	HWND	hWnd;	WNDCLASSEX wc;	ZeroMemory(&wc, sizeof(wc));	wc.cbSize		=	sizeof(WNDCLASSEX);	wc.style		=	CS_HREDRAW | CS_VREDRAW;	wc.lpfnWndProc	=	(WNDPROC)WndProc;	wc.hInstance	=	GetModuleHandle(NULL);	wc.hCursor		=	LoadCursorW(NULL, IDC_ARROW);	wc.lpszClassName=	L"QuadTree";	if(!RegisterClassEx(&wc)) 		MessageBoxW(NULL, L"RegisterClass Failed", L"ERROR...", MB_OK);	if(!(hWnd = CreateWindowEx(NULL, L"QuadTree", L"QuadTree", WS_OVERLAPPEDWINDOW, 0, 0,								 SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, wc.hInstance, NULL)))		MessageBoxW(NULL, L"RegisterClass Failed", L"ERROR...", MB_OK);	ShowWindow(hWnd, SW_SHOWNORMAL);	UpdateWindow(hWnd);	srand((unsigned) time(NULL));	dx->SetParameters(hWnd);	dx->Light();	dx->SetCamera();	qt = new QuadTree(dx->getDevice());	qt->RunOnce(hWnd);#ifdef GUI_TREE	Node* node = new Node(-512, -512, 1024, 1024, dx->getDevice());#else	Node* node = new Node(-512, -512, 1024, 1024);#endif	for(int i = 0; i < NUM_OF_SQUARES; i++) 		node->AddCoordsToRoot(qt->GetModel(i));	node->BuildQuad();	srand(GetTickCount());	MSG msg;		while(TRUE){		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){			if(msg.message == WM_QUIT)				break;			TranslateMessage(&msg);			DispatchMessage(&msg);		}		else{			dx->ClearBackBuffer();			dx->Begin();			{				node->MoveNode();				//dx->SetCamera();				qt->RenderSquare();				qt->SimulateSquare();#ifdef GUI_TREE				node->DrawGrid();#endif			}			dx->End();		}	}	return msg.wParam;}
开发者ID:saurabhs,项目名称:quadtree,代码行数:72,


示例18: main_skin_check_ini_value

//.........这里部分代码省略.........		if (stricmp(name, "PlaylistSkin") == 0)		{			char    pathbuf[MAX_PATH];						if (path_is_relative(textposition + strlen(name) + 1))			{				strcpy(pathbuf, options.main_skin_file);				path_remove_filespec(pathbuf);				strcat(pathbuf, textposition + strlen(name) + 1);			}						else				strcpy(pathbuf, textposition + strlen(name) + 1);							if (!globals.playlist_bool_force_skin_from_options)				strcpy(options.playlist_skin_file, pathbuf);		}				if (stricmp(name, "transparentcolor") == 0)		{			int     colortext;			sscanf(textposition, "%s %x", name, &colortext);			Skin.transparentcolor = colortext;			return;		}				if (stricmp(name, "BmpCoolUp") == 0)		{			strcpy(Skin.CoolUp, textposition + strlen(name) + 1);		}				if (stricmp(name, "BmpCoolDown") == 0)		{			strcpy(Skin.CoolDown, textposition + strlen(name) + 1);		}				if (stricmp(name, "BmpCoolSwitch") == 0)		{			strcpy(Skin.CoolSwitch, textposition + strlen(name) + 1);		}				if (stricmp(name, "BmpTextFont") == 0)		{			strcpy(Skin.aTextFont, textposition + strlen(name) + 1);		}				if (stricmp(name, "BmpTimeFont") == 0)		{			strcpy(Skin.aTimeFont, textposition + strlen(name) + 1);		}				if (stricmp(name, "BmpTrackFont") == 0)		{			strcpy(Skin.aTrackFont, textposition + strlen(name) + 1);		}				if (stricmp(name, "NextSkin") == 0)		{			if (stricmp(textposition + strlen(name) + 1, "default") == 0)			{				globals.main_bool_skin_next_is_default = TRUE;			}						else			{				char    drive[_MAX_DRIVE];				char    fname[MAX_PATH];				char    modpathbuf[MAX_PATH];				char    ext[_MAX_EXT];				char    dir[_MAX_DIR];				char    skinfile2[MAX_PATH];				strcpy(skinfile2, options.main_skin_file);				path_remove_filespec(skinfile2);								main_get_program_path(GetModuleHandle(NULL), modpathbuf,									  MAX_PATH);				_splitpath(textposition + strlen(name) + 1, drive, dir,						   fname, ext);				           				if (strcmp(drive, "") == 0)				{					sprintf(options.main_skin_file, "%s%s%s", skinfile2,							fname, ext);				}								else					strcpy(options.main_skin_file,						   textposition + strlen(name) + 1);					       				if (_access(options.main_skin_file, 0) == -1)				{					sprintf(options.main_skin_file, "%s%s%s%s", modpathbuf,							dir, fname, ext);				}								globals.main_bool_skin_next_is_default = FALSE;			}		}	}}
开发者ID:Runcy,项目名称:coolplayer,代码行数:101,


示例19: Instance_LocateModule

bool Instance_LocateModule(char * name, char * fileName){#if defined(__WIN32__)   HMODULE hModule = null;   if(name && name[0])   {      uint16 _wmoduleName[MAX_LOCATION];      UTF8toUTF16Buffer(name, _wmoduleName, MAX_LOCATION);      hModule = GetModuleHandle(_wmoduleName);      if(!hModule)      {         wcscat(_wmoduleName, L".exe");         hModule = GetModuleHandle(_wmoduleName);      }      if(hModule)      {         uint16 _wfileName[MAX_LOCATION];         GetModuleFileNameW(hModule, _wfileName, MAX_LOCATION);         UTF16toUTF8Buffer(_wfileName, (byte *)fileName, MAX_LOCATION);         return true;      }   }   else   {      uint16 _wfileName[MAX_LOCATION];      GetModuleFileNameW(null, _wfileName, MAX_LOCATION);      UTF16toUTF8Buffer(_wfileName, (byte *)fileName, MAX_LOCATION);      return true;   }#elif defined(__APPLE__)   if(name && name[0])   {      int imageCount = _dyld_image_count();      int c;      int nameLen = strlen(name);      for(c = 0; c<imageCount; c++)      {         struct mach_header * header = _dyld_get_image_header(c);         char * path = _dyld_get_image_name(c);         int pathLen = strlen(path);         char * subStr = RSearchString(path, name, pathLen, false, false);         if(subStr)         {            if(( *(subStr-1) == '/' || !strncmp(subStr - 4, "/lib", 4)) &&               (!subStr[nameLen] || !strncmp(subStr + nameLen, ".dylib", 6)))            {               strcpy(fileName, path);               return true;            }         }      }   }   else   {      int size = MAX_LOCATION;      _NSGetExecutablePath(fileName, &size);      return true;   }#elif defined(__unix__)   //File f = FileOpen("/proc/self/maps", read);   FILE * f;   char exeName[MAX_FILENAME];   exeName[0] = 0;#if defined(__linux__)   f = fopen("/proc/self/status", "r");#else   f = fopen("/proc/curproc/status", "r");#endif   if(f)   {      char line[1025];      while(fgets(line, sizeof(line), f))      {         char * name = strstr(line, "Name:/t");         if(name)         {            int nameLen;            name += 6;            nameLen = strlen(name);            name[--nameLen] = 0;            strcpy(exeName, name);            break;         }      }      fclose(f);  }#if defined(__linux__)   f = fopen("/proc/self/maps", "r");#else   f = fopen("/proc/curproc/map", "r");#endif   if(f)   {      char line[1025];      //while(f.GetLine(line, sizeof(line)))      while(fgets(line, sizeof(line), f))      {         char * path = strstr(line, "/");         if(path)         {//.........这里部分代码省略.........
开发者ID:RockBaby,项目名称:sdk,代码行数:101,


示例20: SetGameStatus

//.........这里部分代码省略.........		m_GameClientView.SetGameEndStart();	}	//赢金币	for (WORD i =0;i<GAME_PLAYER;i++)	{		if(m_cbPlayStatus[i] == FALSE) continue;		if(m_dEndScore[i]>0L)		{			m_lCenterScore = m_lCenterScore -m_dEndScore[i]-m_lTotalScore[i];			m_GameClientView.UpdateWindow();			m_GameClientView.DrawMoveAnte(i,CGameClientView::AA_CENTER_TO_BASEFROM,m_dEndScore[i]+m_lTotalScore[i]);			m_GameClientView.SetCenterScore(m_lCenterScore);		}		else if(m_dEndScore[i] == 0L)		{			m_GameClientView.DrawMoveAnte(i,CGameClientView::AA_CENTER_TO_BASEFROM,m_lTotalScore[i]);			m_lCenterScore = m_lCenterScore-m_lTotalScore[i];			m_GameClientView.SetCenterScore(m_lCenterScore);			m_GameClientView.UpdateWindow();		}		m_GameClientView.SetTotalScore(i,0L);		m_GameClientView.UpdateWindow();	}	//播放声音	if (IsLookonMode()==false)	{		if (m_dEndScore[m_wMeChairID]>=0L) 			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_WIN"));		else 			PlayGameSound(AfxGetInstanceHandle(),TEXT("GAME_LOST"));	}	else PlayGameSound(GetModuleHandle(NULL),TEXT("GAME_END"));	if(m_cbPlayStatus[m_wMeChairID]==TRUE && !IsLookonMode())	{		//调整位置		CRect rcControl;		m_GameClientView.m_ScoreView.GetWindowRect(&rcControl);		CRect rcView ;		m_GameClientView.GetWindowRect( &rcView );		m_GameClientView.m_ScoreView.MoveWindow(rcView.left+5,rcView.bottom-15-rcControl.Height()*3/2,rcControl.Width(),rcControl.Height()/*nWidth/2-rcControl.Width()/2,nHeight/2+56,0,0,SWP_NOZORDER|SWP_NOSIZE*/);		m_GameClientView.m_ScoreView.SetGameScore(m_wMeChairID,m_dEndScore[m_wMeChairID]);		m_GameClientView.m_ScoreView.ShowWindow(SW_SHOW);		m_GameClientView.m_ScoreView.SetShowTimes();	}	if(!IsLookonMode())	{		//开牌按钮		if(m_bOpenCard)		{			m_GameClientView.m_btOpenCard.ShowWindow(SW_SHOW);		}		if (m_GameClientView.m_ScoreView.IsWindowVisible()==TRUE)		{			m_GameClientView.m_ScoreView.SetStartTimes();		}		else if(m_bAutoStart==FALSE)		{			SetGameTimer(m_wMeChairID,IDI_START_GAME,TIME_START_GAME);		}		else //自动开始		{
开发者ID:firehot,项目名称:WH2008,代码行数:67,


示例21: usb_install_driver_np

int usb_install_driver_np(const char *inf_file){  HDEVINFO dev_info;  SP_DEVINFO_DATA dev_info_data;  INFCONTEXT inf_context;  HINF inf_handle;  DWORD config_flags, problem, status;  BOOL reboot;  char inf_path[MAX_PATH];  char id[MAX_PATH];  char tmp_id[MAX_PATH];  char *p;  int dev_index;  HINSTANCE newdev_dll = NULL;  HMODULE setupapi_dll = NULL;  update_driver_for_plug_and_play_devices_t UpdateDriverForPlugAndPlayDevices;  setup_copy_oem_inf_t SetupCopyOEMInf;  newdev_dll = LoadLibrary("newdev.dll");  if(!newdev_dll)    {      usb_error("usb_install_driver(): loading newdev.dll failed/n");      return -1;    }    UpdateDriverForPlugAndPlayDevices =      (update_driver_for_plug_and_play_devices_t)     GetProcAddress(newdev_dll, "UpdateDriverForPlugAndPlayDevicesA");  if(!UpdateDriverForPlugAndPlayDevices)    {      usb_error("usb_install_driver(): loading newdev.dll failed/n");      return -1;    }  setupapi_dll = GetModuleHandle("setupapi.dll");    if(!setupapi_dll)    {      usb_error("usb_install_driver(): loading setupapi.dll failed/n");      return -1;    }  SetupCopyOEMInf = (setup_copy_oem_inf_t)    GetProcAddress(setupapi_dll, "SetupCopyOEMInfA");    if(!SetupCopyOEMInf)    {      usb_error("usb_install_driver(): loading setupapi.dll failed/n");      return -1;    }  dev_info_data.cbSize = sizeof(SP_DEVINFO_DATA);  /* retrieve the full .inf file path */  if(!GetFullPathName(inf_file, MAX_PATH, inf_path, NULL))    {      usb_error("usb_install_driver(): .inf file %s not found/n",                 inf_file);      return -1;    }  /* open the .inf file */  inf_handle = SetupOpenInfFile(inf_path, NULL, INF_STYLE_WIN4, NULL);  if(inf_handle == INVALID_HANDLE_VALUE)    {      usb_error("usb_install_driver(): unable to open .inf file %s/n",                 inf_file);      return -1;    }  /* find the .inf file's device description section marked "Devices" */  if(!SetupFindFirstLine(inf_handle, "Devices", NULL, &inf_context))    {      usb_error("usb_install_driver(): .inf file %s does not contain "                "any device descriptions/n", inf_file);      SetupCloseInfFile(inf_handle);      return -1;    }  do {    /* get the device ID from the .inf file */    if(!SetupGetStringField(&inf_context, 2, id, sizeof(id), NULL))      {        continue;      }    /* convert the string to lowercase */    strlwr(id);    reboot = FALSE;    /* copy the .inf file to the system directory so that is will be found */    /* when new devices are plugged in */    SetupCopyOEMInf(inf_path, NULL, SPOST_PATH, 0, NULL, 0, NULL, NULL);    /* update all connected devices matching this ID, but only if this *///.........这里部分代码省略.........
开发者ID:Habib2014,项目名称:tinyos-2.x-contrib,代码行数:101,


示例22: CPlApplet

extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2){    LPNEWCPLINFO lpNewCPlInfo;    LPCPLINFO lpCPlInfo;    SHELLEXECUTEINFO shellExecInfo;    switch (uMsg) {        case CPL_INIT:      /* first message, sent once  */            hinst = GetModuleHandle("afs_cpa.cpl");            hinstResources = TaLocale_LoadCorrespondingModule (hinst);            CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);            return (hinst != 0);        case CPL_GETCOUNT:  /* second message, sent once */            return 1;        case CPL_INQUIRE:  /* in case we receive this we should indicate that we like NEWINQUIRE better. */            lpCPlInfo = (CPLINFO *) lParam2;            lpCPlInfo->idIcon = ((IsClientInstalled() || !IsWindowsNT())? IDI_AFSD : IDI_CCENTER);            lpCPlInfo->idName = CPL_DYNAMIC_RES;            lpCPlInfo->idInfo = CPL_DYNAMIC_RES;            lpCPlInfo->lData = 0;            break;        case CPL_NEWINQUIRE: /* third message, sent once per app */            lpNewCPlInfo = (LPNEWCPLINFO) lParam2;            lpNewCPlInfo->dwSize = (DWORD) sizeof(NEWCPLINFO);            lpNewCPlInfo->dwFlags = 0;            lpNewCPlInfo->dwHelpContext = 0;            lpNewCPlInfo->lData = 0;	    if (IsClientInstalled() || !IsWindowsNT())	       lpNewCPlInfo->hIcon = TaLocale_LoadIcon(IDI_AFSD);	    else	       lpNewCPlInfo->hIcon = TaLocale_LoadIcon(IDI_CCENTER);            lpNewCPlInfo->szHelpFile[0] = '/0';            GetString (lpNewCPlInfo->szName, (!IsWindowsNT()) ? IDS_CPL_NAME_95 : (!IsClientInstalled()) ? IDS_CPL_NAME_CCENTER : IDS_CPL_NAME_NT);            GetString (lpNewCPlInfo->szInfo, (!IsWindowsNT()) ? IDS_CPL_DESC_95 : (!IsClientInstalled()) ? IDS_CPL_DESC_CCENTER : IDS_CPL_DESC_NT);            break;    case CPL_DBLCLK:		/* applet icon double-clicked */            memset(&shellExecInfo, 0, sizeof(shellExecInfo));            shellExecInfo.cbSize = sizeof(shellExecInfo);            shellExecInfo.nShow = SW_SHOWNORMAL;            shellExecInfo.hwnd = hwndCPl;            shellExecInfo.lpFile = "afs_config.exe";	    if (!IsClientInstalled() && IsWindowsNT())                shellExecInfo.lpParameters = "/c";            ShellExecuteEx(&shellExecInfo);            break;    case CPL_EXIT:            CoUninitialize();            if (hinstResources)                FreeLibrary (hinstResources);            break;    }    return 0;}
开发者ID:snktagarwal,项目名称:openafs,代码行数:62,


示例23: wWinMain

//-----------------------------------------------------------------------------// Name: wWinMain()// Desc: The application's entry point//-----------------------------------------------------------------------------INT WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, INT){	UNREFERENCED_PARAMETER(hInst);	CKT::CFileReader* pIniReader = NULL;	pIniReader = new CKT::CFileReader();	pIniReader->init(L"..//RES//STARTUP.INI");	pIniReader->read();	// Register the window class	WNDCLASSEX wc =	{		sizeof(WNDCLASSEX),		CS_CLASSDC,		MsgProc,		0L,		0L,		GetModuleHandle(NULL),		NULL,		NULL,		NULL,		NULL,		CKT::CEngine::WINDOW_CLASS_NAME,		NULL	};	RegisterClassEx(&wc);	// choose only, from graphicscard, supported Resolution	RECT winRect;	winRect.left = 8;	winRect.right = 800 + winRect.left;	winRect.top = 31;	winRect.bottom = 600 + winRect.top;	if (pIniReader && pIniReader->hasRead())	{		winRect.right = winRect.left + pIniReader->getEntryAsInt(L"WIDTH", L"GRAPHIC");		winRect.bottom = winRect.top + pIniReader->getEntryAsInt(L"HEIGHT", L"GRAPHIC");	}	AdjustWindowRect(&winRect, WS_OVERLAPPEDWINDOW, false);	std::wstring sAppName = L"CKT - ENGINE : Test";	if (pIniReader && pIniReader->hasRead())	{		sAppName = pIniReader->getEntryAsString(L"APPNAME", L"GENERAL");	}	// Create the application's window	HWND hWnd = CreateWindow(		CKT::CEngine::WINDOW_CLASS_NAME,		sAppName.c_str(),		WS_OVERLAPPEDWINDOW,		winRect.left,		winRect.top,		winRect.right,		winRect.bottom,		NULL,		NULL,		wc.hInstance,		NULL);	g_pGame = new CMyGame(hWnd, *pIniReader);	g_pGame->GameLoop();	CKT_RELEASE(g_pGame);	if (pIniReader)	{		delete pIniReader;		pIniReader = NULL;	}	UnregisterClass(CKT::CEngine::WINDOW_CLASS_NAME, wc.hInstance);	return 0;}
开发者ID:Chefkoch85,项目名称:D3D_2D_Engine,代码行数:80,


示例24: do_symlink

	return true;}#endifstatic void do_symlink(const char *old, const char *new, int is_dir){#ifndef GIT_WIN32	GIT_UNUSED(is_dir);	cl_must_pass(symlink(old, new));#else	typedef DWORD (WINAPI *create_symlink_func)(LPCTSTR, LPCTSTR, DWORD);	HMODULE module;	create_symlink_func pCreateSymbolicLink;	cl_assert(module = GetModuleHandle("kernel32"));	cl_assert(pCreateSymbolicLink = (create_symlink_func)GetProcAddress(module, "CreateSymbolicLinkA"));	cl_win32_pass(pCreateSymbolicLink(new, old, is_dir));#endif}static void do_hardlink(const char *old, const char *new){#ifndef GIT_WIN32	cl_must_pass(link(old, new));#else	typedef DWORD (WINAPI *create_hardlink_func)(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES);	HMODULE module;	create_hardlink_func pCreateHardLink;
开发者ID:1336,项目名称:libgit2,代码行数:30,


示例25: GetModuleHandle

void System::InitializeWindows(int& screenWidth, int& screenHeight){	WNDCLASSEX wcex;	DEVMODE dmScreenSettings;	int posX, posY;	// get an external pointed to this object	ApplicationHandle = this;	// get the instance of this application	m_hInstance = GetModuleHandle(NULL);	// give the application a name	m_applicationName = L"Engine";	// setup the windows class with default settings	wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	wcex.lpfnWndProc = WndProc;	wcex.cbClsExtra = 0;	wcex.cbWndExtra = 0;	wcex.hInstance = m_hInstance;	wcex.hIcon = LoadIcon(NULL, IDI_WINLOGO);	wcex.hIconSm = wcex.hIcon;	wcex.hCursor = LoadCursor(NULL, IDC_ARROW);	wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);	wcex.lpszMenuName = NULL;	wcex.lpszClassName = m_applicationName;	wcex.cbSize = sizeof(WNDCLASSEX);	// register window class	RegisterClassEx(&wcex);	// get resolution of screen	screenWidth = GetSystemMetrics(SM_CXSCREEN);	screenHeight = GetSystemMetrics(SM_CYSCREEN);	// setup screen settings	if (FULL_SCREEN){		// set to max size of desktop		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));		dmScreenSettings.dmSize = sizeof(dmScreenSettings);		dmScreenSettings.dmPelsWidth = (unsigned long)screenWidth;		dmScreenSettings.dmPelsHeight = (unsigned long)screenHeight;		dmScreenSettings.dmBitsPerPel = 64; // 64-bit		dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;		// change display settings to fullscreen		ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);		// position window top left		posX = posY = 0;	}	else{		// windowed 800x600		screenWidth = 800;		screenHeight = 600;		// centre window		posX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth) / 2;		posY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2;	}	// create window with settings	m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName,		WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP,		posX, posY, screenWidth, screenHeight, NULL, NULL, m_hInstance, NULL);	// show and focus window	ShowWindow(m_hwnd, SW_SHOW);	SetForegroundWindow(m_hwnd);	SetFocus(m_hwnd);	// hide cursor	ShowCursor(false);}
开发者ID:braedy,项目名称:directx12-personal,代码行数:74,


示例26: WinServiceInstall

bool WinServiceInstall(){    CSD_T ChangeService_Config2;    HMODULE advapi32;    SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);    if (serviceControlManager)    {        char path[_MAX_PATH + 10];        if (GetModuleFileName( 0, path, sizeof(path)/sizeof(path[0]) ) > 0)        {            SC_HANDLE service;            std::strcat(path, " -s run");            service = CreateService(serviceControlManager,                serviceName,                                // name of service                serviceLongName,                            // service name to display                SERVICE_ALL_ACCESS,                         // desired access                                                            // service type                SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,                SERVICE_AUTO_START,                         // start type                SERVICE_ERROR_IGNORE,                       // error control type                path,                                       // service's binary                0,                                          // no load ordering group                0,                                          // no tag identifier                0,                                          // no dependencies                0,                                          // LocalSystem account                0);                                         // no password            if (service)            {                advapi32 = GetModuleHandle("ADVAPI32.DLL");                if(!advapi32)                {                    CloseServiceHandle(service);                    CloseServiceHandle(serviceControlManager);                    return false;                }                ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");                if (!ChangeService_Config2)                {                    CloseServiceHandle(service);                    CloseServiceHandle(serviceControlManager);                    return false;                }                SERVICE_DESCRIPTION sdBuf;                sdBuf.lpDescription = serviceDescription;                ChangeService_Config2(                    service,                                // handle to service                    SERVICE_CONFIG_DESCRIPTION,             // change: description                    &sdBuf);                                // new data                SC_ACTION _action[1];                _action[0].Type = SC_ACTION_RESTART;                _action[0].Delay = 10000;                SERVICE_FAILURE_ACTIONS sfa;                ZeroMemory(&sfa, sizeof(SERVICE_FAILURE_ACTIONS));                sfa.lpsaActions = _action;                sfa.cActions = 1;                sfa.dwResetPeriod =INFINITE;                ChangeService_Config2(                    service,                                // handle to service                    SERVICE_CONFIG_FAILURE_ACTIONS,         // information level                    &sfa);                                  // new data                CloseServiceHandle(service);            }        }        CloseServiceHandle(serviceControlManager);    }    return true;}
开发者ID:Scergo,项目名称:zero,代码行数:73,


示例27: GetModuleHandle

bool WindowWin32::Create( const unsigned int width, const unsigned int height,                          const bool requestFullscreen,                          const char* windowTitle, const unsigned int bits){    m_width = width;    m_height = height;    m_isFullscreen = requestFullscreen;    DWORD dwExStyle;	// extended window style    DWORD dwStyle;		// window style    // setup window rectangle (size)    m_windowRect.left = (long)0;    m_windowRect.right = (long)width;    m_windowRect.top = (long)0;    m_windowRect.bottom = (long)height;    m_moduleHandle = GetModuleHandle(NULL);    // setup window parameters    m_window.cbSize = sizeof(WNDCLASSEX);    m_window.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;    m_window.lpfnWndProc = WindowWin32::StaticWndProc;    m_window.cbClsExtra = 0;    m_window.cbWndExtra = 0;    m_window.hInstance = m_moduleHandle;    m_window.hIcon = LoadIcon(NULL, IDI_WINLOGO);    m_window.hCursor = LoadCursor(NULL, IDC_ARROW);    m_window.hbrBackground = NULL;    m_window.lpszMenuName = NULL;    m_window.lpszClassName = "Window";    // create window class    if (!RegisterClassEx(&m_window))    {        printf("Failed to rigister the window class", (LPWSTR)"ERROR", MB_OK | MB_ICONINFORMATION);        return false;    }    // setup fullscreen parameters    if (m_isFullscreen)    {        DEVMODE dmScreenSettings; // info about device init        memset( &dmScreenSettings, 0, sizeof( dmScreenSettings));        dmScreenSettings.dmSize = sizeof( dmScreenSettings);        dmScreenSettings.dmPelsWidth = width;        dmScreenSettings.dmPelsHeight = height;        dmScreenSettings.dmBitsPerPel = bits; // bits per pixel        dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;        // check if display settings can be switched        if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)        {            printf("The requested FullScreen Mode is not supported by your video card use window mode instead!");            m_isFullscreen = false;        }    }    if (m_isFullscreen)    {        dwExStyle = WS_EX_APPWINDOW;        dwStyle = WS_POPUP;        ShowCursor(false); // Hide mouse pointer    }    else    {        dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;        dwStyle = WS_OVERLAPPEDWINDOW;    }    AdjustWindowRectEx(&m_windowRect, dwStyle, false, dwExStyle);    if ( !(m_windowHandle = CreateWindowEx(	dwExStyle,                                            "Window",                                            windowTitle,                                            WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dwStyle,                                            0,                                            0,                                            m_windowRect.right - m_windowRect.left,                                            m_windowRect.bottom - m_windowRect.top,                                            NULL,                                            NULL,                                            m_moduleHandle,                                            this))) // last var is a pointer to the class that receives the lpfnWndProc    {        printf("Window creation Error");        return false;    }    if (!(m_deviceContext = GetDC( m_windowHandle))) // get handle to device context for client erea of specified window or for the entire screen    {        printf("Cant create a Device Context.");        return false;    }    ShowWindow( m_windowHandle, SW_SHOW);    UpdateWindow( m_windowHandle);    SetForegroundWindow(m_windowHandle);    SetFocus(m_windowHandle);//.........这里部分代码省略.........
开发者ID:JJoosten,项目名称:GLComputeTest,代码行数:101,


示例28: EnableCreateFile

CHookAPI::CHookAPI(void){#ifdef _DEBUG	CreateFileAPI=(pfnCreateFile)HookAPI(_T("KERNEL32.dll"),LPCSTR("CreateFileW"),(FARPROC)Hook_CreateFile,GetModuleHandle(_T("Duilib_ud.dll")));	EnableCreateFile(true);	HookAPI(_T("Duilib_ud.dll"),LPCSTR("[email
C++ GetModuleHandleEx函数代码示例
C++ GetModuleFileNameW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。