Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ C ++ CBitmap, HBitmap, Bitmap difference and contact     - SSH mutual trust configuration (Server)

- Talk about jsonp (Programming)

- Oracle in the add & split partition on the impact of global & local index (Database)

- Zombie process under Linux (Linux)

- Spark SQL job of a lifetime (Server)

- Linux monitoring tools introduced series --smem (Server)

- Use this one-time password via SSH secure login Linux (Programming)

- Linux installation skynet issue summary (Linux)

- Python-- for anomalies and reflection of objects articles (Programming)

- Linux System Getting Started Learning: From VirtualBox from the client host access NAT (Linux)

- The hashcode method of Java (Programming)

- independently configurable PHP environment under CentOS6.5 (Server)

- FastDFS installation and deployment (Server)

- KVM add virtual disks (Linux)

- Oracle table of nested loop connection (Database)

- Servlet life cycle works (Programming)

- Ubuntu 14.10 install KDE Plasma 5.2 (Linux)

- Linux System Getting Started Tutorial: how to find information on Linux-embedded module (Linux)

- Use XtraBackup to MySQL database online incremental backup and recovery (Database)

- About Java 7 module system (Programming)

  C ++ CBitmap, HBitmap, Bitmap difference and contact
  Add Date : 2018-11-21      
  Loading a map, you can use LoadImage:

HANDLE LoadImage (HINSTANCE hinst, LPCTSTR lpszName, UINT uType, int cxDesired, int CyDesired, UINT fuLoad);

LoadImage can be used to load bitmaps, icons and cursors

When loading a predetermined map can be loaded into memory the size of the graph:

    cxDesired: Specifies the width of the icon or cursor, in pixels. If this parameter is zero and the parameter value LR_DEFAULTSIZE fuLoad is not used, the function uses the current resource width.

cyDesired: Specifies the height of the icon or cursor, in pixels. If this parameter is zero and the parameter value LR_DEFAULTSIZE fuLoad is not used, the function uses the current resource level.

LoadImage return value is the handle of related resources. Because the load is a bitmap so the handle is returned HBITMAP type (need to cast).

Extending understand HBITMAP / CBitmap / BITMAP:

HBITMAP is bitmap pointer,

msdn in the case: Handle to a bitmap.typedef HANDLE HBITMAP;

CBitmap is encapsulated bitmap mfc classes;

msdn in:

Encapsulates (include) a Windows graphics device interface (GDI) bitmap and provides member functions to manipulate (operating) the bitmap.

BITMAP is a structure that encapsulates some of the bitmap information. It defines the height, width, color, format and bit-valued logic bitmaps.

MSDN in the case: This structure defines the type, width, height, color format, and bit values ​​of a bitmap.

The relationship between the three conversion:

HBITMAP hBitmap;

CBitmap bitmap;


// Here is the link between the three:

bitmap.Attach (hBitmap); // get the HBITMAP associated CBitmap

bitmap.GetBitmap (& bm); // get BITMAP linked by CBitmap
hBitmap = (HBITMAP) bitmap.GetSafeHandle (); // get the HBITMAP associated CBitmap

BITMAP structure has the following form:

typedef struct tagBITMAP
    int bmType;
    int bmWidth; // Wide
      int bmHeight; // High
      int bmWidthBytes;
    BYTE bmPlanes;
    BYTE bmBitsPixel;
    LPVOID bmBits;

By extending understanding Attach / Detach:

  is to attach a C ++ object is associated with a WINDOWS object until you put the association with detach removed.
  If you attach no later detach, the C ++ object is destroyed when the object along WINDOWS finished together.
  attach later, HWND C ++ object pointer and WINDOWS objects have a mapping which acts you directly to a C ++ object Create a WINDOWS object, such as CEdit edit; edit.create (...)
  And this map is permanent, know this until the object is finished.
  If a similar GetDlgItem function can return a pointer and can be cast. GetDlgItem will find the mapping table.
  There are two kinds of mapping table, is a permanent, one is temporary.
  WINDOWS object directly in C ++ objects created by attach or object mappings are placed in a permanent table, or to create a map in a temporary table.
  So GetDlgItem do not recommend you save the returned pointer, because it's hard to keep your WINDOWS objects associated with the C ++ object is placed in a permanent table.
  If the mapping is in a temporary table, then the idle time will be automatically deleted.
  With attcah solely for the convenience of using MFC class member functions to manipulate WINDOWS object.
- About AWR More Description (Database)
- Oracle 11g RMAN cross-platform transfer table space (Database)
- RVM installation instructions (Linux)
- Ubuntu FAQ solutions (Linux)
- CentOS How quickly customize kernel binary RPM package (Linux)
- Fedora 20 installation source Xen4.3.0 (Linux)
- Install Oracle JDK 8 and JVM class loading mechanism in Linux (Linux)
- How to Install Foreman under Ubuntu (Server)
- CentOS7 boot systemd introduction and use of management (Linux)
- Distributed File System using MogileFS (Linux)
- Java implementation chain store binary tree (Programming)
- Various sorting algorithms implemented in Python (Programming)
- VMware virtual machines to install virt-manager unable to connect to libvirt's approach (Linux)
- TCP protocol flaw incomplete records (Linux)
- Command-line based tools for better alternatives (Linux)
- The Java utility, JavaMail (Programming)
- Linux systems for entry-learning: Install closed-source packages in Debian (Linux)
- Hadoop 2.6.0 stand-alone / pseudo-distributed installation (Server)
- Win7 + Ubuntu Kylin + CentOS 6.5 installed three systems (Linux)
- Linux, rename the file or folder (mv command and rename command) (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.