Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 687357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:07:07+00:00 2026-05-14T02:07:07+00:00

Dear friends, I need your help. I need to send .bmp file to another

  • 0

Dear friends, I need your help.

I need to send .bmp file to another process (dialog box) and display it there, using MMF(Memory Mapped File)
But the problem is that image displays in reversed colors and upside down.

Here’s source code:

In first application I open picture from HDD and link it to the named MMF “Gigabyte_picture”

HANDLE hFile = CreateFile("123.bmp", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, "Gigabyte_picture");

In second application I open mapped bmp file and at the end I display m_HBitmap on the static component, using SendMessage function.

HANDLE hMappedFile = OpenFileMapping(FILE_MAP_READ, FALSE, "Gigabyte_picture");
PBYTE pbData = (PBYTE) MapViewOfFile(hMappedFile, FILE_MAP_READ, 0, 0, 0); 

BITMAPINFO bmpInfo = { 0 };
LONG lBmpSize = 60608; // size of the bmp file in bytes

bmpInfo.bmiHeader.biBitCount = 32;
bmpInfo.bmiHeader.biHeight = 174;
bmpInfo.bmiHeader.biWidth = 87;
bmpInfo.bmiHeader.biPlanes = 1;
bmpInfo.bmiHeader.biSizeImage = lBmpSize;
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);               

UINT * pPixels = 0;    
HDC hDC = CreateCompatibleDC(NULL);

HBITMAP m_HBitmap = CreateDIBSection(hDC, &bmpInfo, DIB_RGB_COLORS, (void **)& pPixels, NULL, 0);                               
SetBitmapBits(m_HBitmap, lBmpSize, pbData);
SendMessage(gStaticBox, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)m_HBitmap);
/////////////
HWND gStaticBox = CreateWindowEx(0, "STATIC","",
SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE,
10,10,380, 380, myDialog, (HMENU)-1,NULL,NULL);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:07:07+00:00Added an answer on May 14, 2026 at 2:07 am

    pbData points to begin of bitmap data, which points to bitmap header.
    Give SetBitmapBits pointer to raw data: pbData + header size + optional pallete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear Friends from Stackoverflow, Please help me with a problem that i'm having when
my dear friends. Could you help me to figure out where do I have
my dear Friends I am new to this java ..so plz help me thank
Dear friends, this is a script which simply upload file and insert filename into
Dear All, please help me since I'm newbie in SQL Server. I have a
Dear friends, i'm concerned if i'm making a bad use of references in C++
Dear experts, I was trying to dynamically generate DOM elements using JS. I read
dear all..i've a textfield, it using barcode scanner for input data..after scan it shows
Hi dear friends i have 495 cells and a textField for inserting number and
Dear Friends good afternoon. My problem may be this is very basic one i.e.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.