Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

phieu

@phieu
About
Posts
7
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Shared memory with CreateDIBSection
    P phieu

    Ok, thanks Mark!

    C / C++ / MFC question graphics performance

  • Shared memory with CreateDIBSection
    P phieu

    m_hBitmap is not NULL, and I can display it ok, but GetLastError() = 87, INVALID_PARAMETER. I don't know why?

    C / C++ / MFC question graphics performance

  • Shared memory with CreateDIBSection
    P phieu

    Thanks Mark. OK, Now I see the data pointed to by ppvBits can be shared through the file mapping. But now I don’t know why: error code = 87 (ERROR_INVALID_PARAMETER) when I call CreateDIBSection thought out but bitmap is valid. Someone can tell me why? Thank you. Here is my code: #define BITMAP_MMF_NAME "Global\\PRJ_IMS" HANDLE m_hMMF; HBITMAP m_hBitmap; void CBitmapMMFDlg::OnButton3() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください int nWidth = 100, nHeight = 100; long nSize = nWidth*nHeight*3; // Create a file-mapping m_hMMF = ::CreateFileMapping( (HANDLE)0xFFFFFFFF, NULL, PAGE_READWRITE, 0, nSize, BITMAP_MMF_NAME); DWORD dw = GetLastError(); if (m_hMMF) { // Create bitmap and map this bitmap to File-mapping m_hBitmap = NULL; HDC hdc = ::GetDC(NULL); // entire screen //off-screen bitmap/image size - width must be DWORD aligned (multiples of 4) LONG sizeImage = ((nWidth * 3 + 3) & 0xfffffffc) * nHeight; BITMAPINFO bmpInfo; memset(&bmpInfo,0,sizeof(bmpInfo)); bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmpInfo.bmiHeader.biWidth = nWidth; bmpInfo.bmiHeader.biHeight = -nHeight; bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; bmpInfo.bmiHeader.biSizeImage = sizeImage ; bmpInfo.bmiHeader.biXPelsPerMeter = 0; bmpInfo.bmiHeader.biYPelsPerMeter = 0; bmpInfo.bmiHeader.biClrUsed = 0; bmpInfo.bmiHeader.biClrImportant = 0; //Create DIB Section - off screen bitmap void* pBits = NULL; DWORD dwOffset = 0; m_hBitmap = CreateDIBSection(hdc, &bmpInfo, DIB_RGB_COLORS, &pBits, m_hMMF, dwOffset); TRACE("Error code = %d \n", GetLastError()); // change bitmap bit data -> to test output if(pBits != NULL) { for (int i = 0; i < 30000; i ++) { *((char*)(pBits) +i) = i%255; } } ///////////////////////////////////////////////// // display bitmap if (m_hBitmap != NULL) { CDC* pDC = GetDlgItem(IDC_STATIC)->GetDC(); if (pDC) { CDC dcMem; dcMem.CreateCompatibleDC(pDC); CBitmap* pBmp = CBitmap::FromHandle(m_hBitmap); CBitmap* pOldBmp= dcMem.SelectObject(pBmp); pDC->BitBlt(0,0, 100, 100, &dcMem, 0, 0, SRCCOPY); } } } }

    C / C++ / MFC question graphics performance

  • Shared memory with CreateDIBSection
    P phieu

    Hi all, I want to create a bitmap by the function CreateDIBSection, and share the bitmap with other process. HBITMAP CreateDIBSection( HDC hdc, // handle to DC CONST BITMAPINFO *pbmi, // bitmap data UINT iUsage, // data type indicator VOID **ppvBits, // bit values HANDLE hSection, // handle to file mapping object DWORD dwOffset // offset to bitmap bit values ); Following MSDN, hSection is handle that created by CreateFileMapping. Now I want ask that: in the shared-memory that hold by handle hSection: what is shared data? it is ppvBits?. If not, what is relating between ppvBits and data shared in the memory. I don't see any word in MSDN about this. That is good if anyone give me a sample code. Thank you. The world is not enough!

    C / C++ / MFC question graphics performance

  • CListCtrl: Change position first/last item position in Icon mode
    P phieu

    Hi all, Now I have a list controls; the list is set in Icon mode and I use it to display thumnail image (look like explorer in winxp to show images in thumbnail mode). When I put scroll (Vertical) position at the min position (zero value); items rectange (GetItemRect(0,&rect, LVIS_BOUNDS)) at the first line always is zero value! How can I change this value? (mean I can make a distance between item and the ceil of list control rect); Similarily with items at the last line when I put scroll position at the maximum value: bottom value of these items always dash the floor of list controls rect! Can I change this distance? In otherwise, if list control is a box; I see items always are fixed in the box; How can I enlarger this box??? Please tell me some ideas! Thanks! :doh:

    C / C++ / MFC question

  • When use callback function?
    P phieu

    Hello all, When use callback function, and what is the purpose? Which cases we should use the callback functions? Could you tell me about? Thanks!

    C / C++ / MFC question

  • Thumbnail view and Drag and Drop
    P phieu

    Hi all, Now I have image items in thumbnail view in CListCtrl(it looks like Explorer), and I want to implement drag and drop image items in the control. Could you tell me the way? Thank you! phucfbk@yahoo.com

    C / C++ / MFC com question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups