这篇教程C++ GetObject函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetObject函数的典型用法代码示例。如果您正苦于以下问题:C++ GetObject函数的具体用法?C++ GetObject怎么用?C++ GetObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetObject函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetObjectbool GameFactory::DestroyInstance(NetworkID id){ FactoryObject reference = GetObject(id); DestroyInstance(reference); return true;}
开发者ID:TheMw3Wolv,项目名称:Vault-Tec-Multiplayer-Mod,代码行数:6,
示例2: SaveBmp//把HBITMAP保存成位图BOOL SaveBmp(HBITMAP hBitmap, LPCWSTR FileName){ HDC hDC; //当前分辨率下每象素所占字节数 int iBits; //位图中每象素所占字节数 WORD wBitCount; //定义调色板大小, 位图中像素字节大小 ,位图文件大小 , 写入文件字节数 DWORD dwPaletteSize=0, dwBmBitsSize=0, dwDIBSize=0, dwWritten=0; //位图属性结构 BITMAP Bitmap; //位图文件头结构 BITMAPFILEHEADER bmfHdr; //位图信息头结构 BITMAPINFOHEADER bi; //指向位图信息头结构 LPBITMAPINFOHEADER lpbi; //定义文件,分配内存句柄,调色板句柄 HANDLE fh, hDib, hPal,hOldPal=NULL; //计算位图文件每个像素所占字节数 hDC = CreateDC( _T( "DISPLAY" ), NULL, NULL, NULL); iBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES); DeleteDC(hDC); if (iBits <= 1) wBitCount = 1; else if (iBits <= 4) wBitCount = 4; else if (iBits <= 8) wBitCount = 8; else wBitCount = 24; GetObject(hBitmap, sizeof(Bitmap), (LPSTR)&Bitmap); bi.biSize = sizeof(BITMAPINFOHEADER); bi.biWidth = Bitmap.bmWidth; bi.biHeight = Bitmap.bmHeight; bi.biPlanes = 1; bi.biBitCount = wBitCount; bi.biCompression = BI_RGB; bi.biSizeImage = 0; bi.biXPelsPerMeter = 0; bi.biYPelsPerMeter = 0; bi.biClrImportant = 0; bi.biClrUsed = 0; dwBmBitsSize = ((Bitmap.bmWidth * wBitCount + 31) / 32) * 4 * Bitmap.bmHeight; //为位图内容分配内存 hDib = GlobalAlloc(GHND,dwBmBitsSize + dwPaletteSize + sizeof(BITMAPINFOHEADER)); lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDib); *lpbi = bi; // 处理调色板 hPal = GetStockObject(DEFAULT_PALETTE); if (hPal) { hDC = ::GetDC(NULL); hOldPal = ::SelectPalette(hDC, (HPALETTE)hPal, FALSE); RealizePalette(hDC); } // 获取该调色板下新的像素值 GetDIBits(hDC, hBitmap, 0, (UINT) Bitmap.bmHeight, (LPSTR)lpbi + sizeof(BITMAPINFOHEADER) +dwPaletteSize, (BITMAPINFO *)lpbi, DIB_RGB_COLORS); //恢复调色板 if (hOldPal) { ::SelectPalette(hDC, (HPALETTE)hOldPal, TRUE); RealizePalette(hDC); ::ReleaseDC(NULL, hDC); } //创建位图文件 fh = CreateFile( FileName, GENERIC_WRITE,0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL ); if (fh == INVALID_HANDLE_VALUE) return FALSE; // 设置位图文件头 bmfHdr.bfType = 0x4D42; // "BM" dwDIBSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + dwPaletteSize + dwBmBitsSize; bmfHdr.bfSize = dwDIBSize; bmfHdr.bfReserved1 = 0; bmfHdr.bfReserved2 = 0; bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + (DWORD)sizeof(BITMAPINFOHEADER) + dwPaletteSize; // 写入位图文件头 WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL); // 写入位图文件其余内容 WriteFile(fh, (LPSTR)lpbi, dwDIBSize, &dwWritten, NULL); //清除 GlobalUnlock(hDib); GlobalFree(hDib); CloseHandle(fh); return TRUE;}
开发者ID:Roger8,项目名称:win32-screencapture,代码行数:91,
示例3: GetObjectint CxSkinButton::GetBitmapWidth (HBITMAP hBitmap){ BITMAP bm; GetObject(hBitmap,sizeof(BITMAP),(PSTR)&bm); return bm.bmWidth;}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:2,
示例4: UE_LOGconst FFieldNetCache* FObjectReplicator::ReadField( const FClassNetCache* ClassCache, FInBunch& Bunch ) const{ if ( Connection->InternalAck ) { // Replays use checksum rather than index uint32 Checksum = 0; Bunch << Checksum; if ( Bunch.IsError() ) { UE_LOG(LogNet, Error, TEXT("ReadField: Error reading checksum: %s"), *GetObject()->GetFullName()); return NULL; } if ( Checksum == 0 ) { return NULL; // We're done } const FFieldNetCache * FieldNetCache = ClassCache->GetFromChecksum( Checksum ); if ( FieldNetCache == NULL ) { UE_LOG(LogNet, Error, TEXT("ReadField: GetFromChecksum failed: %s"), *GetObject()->GetFullName()); Bunch.SetError(); return NULL; } return FieldNetCache; } const int32 RepIndex = Bunch.ReadInt( ClassCache->GetMaxIndex() + 1 ); if ( Bunch.IsError() ) { UE_LOG(LogRep, Error, TEXT("ReadField: Error reading RepIndex: %s"), *GetObject()->GetFullName()); return NULL; } if ( RepIndex == ClassCache->GetMaxIndex() ) { return NULL; // We're done } if ( RepIndex > ClassCache->GetMaxIndex() ) { // We shouldn't be receiving this bunch of this object has no properties or RPC functions to process UE_LOG(LogRep, Error, TEXT("ReadField: RepIndex too large: %s"), *GetObject()->GetFullName()); Bunch.SetError(); return NULL; } const FFieldNetCache * FieldNetCache = ClassCache->GetFromIndex( RepIndex ); if ( FieldNetCache == NULL ) { UE_LOG(LogNet, Error, TEXT("ReadField: GetFromIndex failed: %s"), *GetObject()->GetFullName()); Bunch.SetError(); return NULL; } return FieldNetCache;}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:63,
示例5: GetObjectvoid FObjectReplicator::ReplicateCustomDeltaProperties( FOutBunch & Bunch, FReplicationFlags RepFlags, bool & bContentBlockWritten ){ if ( LifetimeCustomDeltaProperties.Num() == 0 ) { // No custom properties return; } UObject* Object = GetObject(); check( Object ); check( OwningChannel ); UNetConnection * OwningChannelConnection = OwningChannel->Connection; // Initialize a map of which conditions are valid bool ConditionMap[COND_Max]; const bool bIsInitial = RepFlags.bNetInitial ? true : false; const bool bIsOwner = RepFlags.bNetOwner ? true : false; const bool bIsSimulated = RepFlags.bNetSimulated ? true : false; const bool bIsPhysics = RepFlags.bRepPhysics ? true : false; ConditionMap[COND_None] = true; ConditionMap[COND_InitialOnly] = bIsInitial; ConditionMap[COND_OwnerOnly] = bIsOwner; ConditionMap[COND_SkipOwner] = !bIsOwner; ConditionMap[COND_SimulatedOnly] = bIsSimulated; ConditionMap[COND_AutonomousOnly] = !bIsSimulated; ConditionMap[COND_SimulatedOrPhysics] = bIsSimulated || bIsPhysics; ConditionMap[COND_InitialOrOwner] = bIsInitial || bIsOwner; ConditionMap[COND_Custom] = true; // Replicate those properties. for ( int32 i = 0; i < LifetimeCustomDeltaProperties.Num(); i++ ) { // Get info. const int32 RetireIndex = LifetimeCustomDeltaProperties[i]; FPropertyRetirement & Retire = Retirement[RetireIndex]; FRepRecord * Rep = &ObjectClass->ClassReps[RetireIndex]; UProperty * It = Rep->Property; int32 Index = Rep->Index; if (LifetimeCustomDeltaPropertyConditions.IsValidIndex(i)) { // Check the replication condition here ELifetimeCondition RepCondition = LifetimeCustomDeltaPropertyConditions[i]; check(RepCondition >= 0 && RepCondition < COND_Max); if (!ConditionMap[RepCondition]) { // We didn't pass the condition so don't replicate us continue; } } const int32 BitsWrittenBeforeThis = Bunch.GetNumBits(); // If this is a dynamic array, we do the delta here TSharedPtr<INetDeltaBaseState> & OldState = RecentCustomDeltaState.FindOrAdd( RetireIndex ); TSharedPtr<INetDeltaBaseState> NewState; // Update Retirement records with this new state so we can handle packet drops. // LastNext will be pointer to the last "Next" pointer in the list (so pointer to a pointer) FPropertyRetirement ** LastNext = UpdateAckedRetirements( Retire, OwningChannelConnection->OutAckPacketId ); check( LastNext != NULL ); check( *LastNext == NULL ); ValidateRetirementHistory( Retire ); FNetBitWriter TempBitWriter( OwningChannel->Connection->PackageMap, 0 ); //----------------------------------------- // Do delta serialization on dynamic properties //----------------------------------------- const bool WroteSomething = SerializeCustomDeltaProperty( OwningChannelConnection, (void*)Object, It, Index, TempBitWriter, NewState, OldState ); if ( !WroteSomething ) { continue; } *LastNext = new FPropertyRetirement(); // Remember what the old state was at this point in time. If we get a nak, we will need to revert back to this. (*LastNext)->DynamicState = OldState; // Save NewState into the RecentCustomDeltaState array (old state is a reference into our RecentCustomDeltaState map) OldState = NewState; // Write header, and data to send to the actual bunch RepLayout->WritePropertyHeader( Object, ObjectClass, OwningChannel, It, Bunch, Index, bContentBlockWritten ); const int NumStartingBits = Bunch.GetNumBits(); // Send property. Bunch.SerializeBits( TempBitWriter.GetData(), TempBitWriter.GetNumBits() );//.........这里部分代码省略.........
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:101,
示例6: ObjectEquivalenceScope::Object EquivalenceScope::GetObject(ASTContext &C, const Expr *E, VarDecl *Var, uint64_t Offset) { return Object(E, Offset, GetObject(C, Var));}
开发者ID:ben-brewer-codethink,项目名称:flang,代码行数:3,
示例7: GetObject cCustomBinaryData::cDataAndPos*cCustomBinaryData::GetDataByID(int e_iID) { return GetObject(e_iID); }
开发者ID:fatmingwang,项目名称:FM79979,代码行数:4,
示例8: SetFovAnglevoid CameraProperties::SetFovAngle( Float pAngle){ Cast<Camera>(GetObject())->SetFovAngle(pAngle); FirePropertyChanged(&mFovAngle);}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:5,
示例9: switch/*!/brief This function is responsible for drawing player, foods, background playing field and shows all the text in the game.As it prescribe management in our game.For control of the game and drawing the background playing field meets the code. /code switch (message) { case WM_CREATE: hBitmap = (HBITMAP)LoadImage(hInst, L"1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); break; case WM_KEYDOWN: switch (wParam) { //Repeat game case 'O': pause= !pause; break; case 'P': if(GameOver == 1) { GameOver=0; ship.health = 20; RECT r = {0,0,700,500}; for (int i=0;i<ASTEROID_COUNT;i++) { asteroids[i] = CreateAsteroid(r); } } break; } case WM_MOUSEMOVE: //Passing the coordinates of the mouse cursor. xPos = GET_X_LPARAM(lParam); targetx=xPos; yPos = GET_Y_LPARAM(lParam); targety=yPos; break; InvalidateRect(hWnd,NULL,1); break;/endcodeThis part of the code responsible for drawing player and foods. Drawing in WinApi performed using brushes and pens. With feathers, we draw the contours of ourplayer and foods. With a brush paints we figure our color. /codecase WM_PAINT: hdc = BeginPaint(hWnd, &ps); RECT rect; BITMAP bitmap; HDC hdcMem; HGDIOBJ oldBitmap; GetClientRect(hWnd, &rect); width=rect.right; height=rect.bottom; backbuffDC = CreateCompatibleDC(hdc); backbuffer = CreateCompatibleBitmap( hdc, width, height); savedDC = SaveDC(backbuffDC); SelectObject( backbuffDC, backbuffer ); // Draw HERE //clear window hBrush = CreateSolidBrush(RGB(255,0,255)); FillRect(backbuffDC,&rect,hBrush); DeleteObject(hBrush); hdcMem = CreateCompatibleDC(hdc);//! oldBitmap = SelectObject(hdcMem, hBitmap);//! //draw background GetObject(hBitmap, sizeof(bitmap), &bitmap);//! BitBlt(backbuffDC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);//! //draw ball //Rectangle(backbuffDC,0, 0, 785, 663); //draw asteroids //Drawing food for (int i=0;i<ASTEROID_COUNT;i++) { hPen = CreatePen(PS_SOLID, 1, RGB(asteroids[i].dY, asteroids[i].dX, asteroids[i].dX+40)); hOldPen = (HPEN)SelectObject(backbuffDC, hPen); Ellipse(backbuffDC,asteroids[i].X-asteroids[i].r, asteroids[i].Y-asteroids[i].r,asteroids[i].X+asteroids[i].r,asteroids[i].Y+asteroids[i].r); SelectObject(backbuffDC, hOldPen); DeleteObject(hPen); hPen = CreatePen(PS_SOLID, asteroids[i].r, RGB(asteroids[i].dY, asteroids[i].dX, asteroids[i].dX+40)); hOldPen = (HPEN)SelectObject(backbuffDC, hPen); Ellipse(backbuffDC, asteroids[i].X - (asteroids[i].r/1.9), asteroids[i].Y - (asteroids[i].r/1.9),asteroids[i].X + (asteroids[i].r/1.9), asteroids[i].Y + (asteroids[i].r/1.9)); Ellipse(backbuffDC, asteroids[i].X - (asteroids[i].r/2.1), asteroids[i].Y - (asteroids[i].r/2.1),asteroids[i].X + (asteroids[i].r/2.1), asteroids[i].Y + (asteroids[i].r/2.1)); SelectObject(backbuffDC, hOldPen); DeleteObject(hPen); }//.........这里部分代码省略.........
开发者ID:StudProject,项目名称:NemchenkoAleks,代码行数:101,
示例10: serviceBmpFilterResizeBitmapstatic INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam){ BITMAP bminfo; int width, height; int xOrig, yOrig, widthOrig, heightOrig; ResizeBitmap *info = (ResizeBitmap *) wParam; if (info == NULL || info->size != sizeof(ResizeBitmap) || info->hBmp == NULL || info->max_width < 0 || info->max_height < 0 || (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) < RESIZEBITMAP_STRETCH || (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) > RESIZEBITMAP_MAKE_SQUARE) return 0; // Well, lets do it // Calc final size GetObject(info->hBmp, sizeof(bminfo), &bminfo); width = info->max_width == 0 ? bminfo.bmWidth : info->max_width; height = info->max_height == 0 ? bminfo.bmHeight : info->max_height; xOrig = 0; yOrig = 0; widthOrig = bminfo.bmWidth; heightOrig = bminfo.bmHeight; if (widthOrig == 0 || heightOrig == 0) return 0; switch(info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) { case RESIZEBITMAP_STRETCH: { // Do nothing break; } case RESIZEBITMAP_KEEP_PROPORTIONS: { if (height * widthOrig / heightOrig <= width) { if (info->fit & RESIZEBITMAP_FLAG_DONT_GROW) height = min(height, bminfo.bmHeight); width = height * widthOrig / heightOrig; } else { if (info->fit & RESIZEBITMAP_FLAG_DONT_GROW) width = min(width, bminfo.bmWidth); height = width * heightOrig / widthOrig; } break; } case RESIZEBITMAP_MAKE_SQUARE: { if (info->fit & RESIZEBITMAP_FLAG_DONT_GROW) { width = min(width, bminfo.bmWidth); height = min(height, bminfo.bmHeight); } width = height = min(width, height); // Do not break. Use crop calcs to make size } case RESIZEBITMAP_CROP: { if (heightOrig * width / height >= widthOrig) { heightOrig = widthOrig * height / width; yOrig = (bminfo.bmHeight - heightOrig) / 2; } else { widthOrig = heightOrig * width / height; xOrig = (bminfo.bmWidth - widthOrig) / 2; } break; } } if ((width == bminfo.bmWidth && height == bminfo.bmHeight) || ((info->fit & RESIZEBITMAP_FLAG_DONT_GROW) && !(info->fit & RESIZEBITMAP_MAKE_SQUARE) && width > bminfo.bmWidth && height > bminfo.bmHeight)) { // Do nothing return (INT_PTR)info->hBmp; } else { FIBITMAP *dib = FreeImage_CreateDIBFromHBITMAP(info->hBmp); if (dib == NULL) return NULL; FIBITMAP *dib_tmp; if (xOrig > 0 || yOrig > 0) dib_tmp = FreeImage_Copy(dib, xOrig, yOrig, xOrig + widthOrig, yOrig + heightOrig); else//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,
示例11: ifvoid CInfoPanel::LoaderThread(){ m_news.clear(); CHttpSocket sock; cvs::string xml; CXmlTree tree; size_t len; if(!sock.create("http://march-hare.com")) { xml="<?xml version=/"1.0/" encoding=/"windows-1252/"?>/n<messages>/n<message><subject>Need assistance? Click here for our professional support options!</subject><author>"March Hare Support" <[email C++ GetObjectA函数代码示例 C++ GetObj函数代码示例
|