Link to home
Create AccountLog in
Avatar of alexott
alexott

asked on

how to open a client window for bitmap ?

My intention is to open a new window without any menu for displaying a bitmap picture, which i want to create with the CPaintDC->setPixel command. My image data ist stored on heap. What is the best way to do this ?
Avatar of Vinayak Kumbar
Vinayak Kumbar

Hi,

Do like this.
1. Using classwizard create a new class say CMyWnd derived from CWnd.
2. say u want to pop up this window in xxxx.cpp, then go to xxxx.h and add the #include "MyWnd.h" to it.
3. Then add the public variable as
CMyWnd *pWnd;
4. In the xxxx.cpp file constructor do
pWnd = NULL;
5. Then whenever U want to pop it up do

CRect rect(10,10,200,200);
pWnd = new CMyWnd;
pWnd->Create(NULL, "MTV", WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU, rect, this, 4545, NULL);
pWnd->ShowWindow(SW_SHOW);

6. U can map the WM messages to the CMyWnd class like WM_PAINT and handle them.

Try it out.
VinExpert
Avatar of alexott

ASKER

answer does not tell me anything about bitmaps and how to pu them into a new window
Avatar of alexott

ASKER

This question has a deletion request Pending
Avatar of alexott

ASKER

answer does noct tell me anything about how to put pixels into the new window
This question no longer is pending deletion
Hi,

U know it already, U have to use SetPixel to do that. May be in a seperate thread.

Try it out.
VinExpert

NOTE : copy this comment 3 times
ASKER CERTIFIED SOLUTION
Avatar of Vinayak Kumbar
Vinayak Kumbar

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Depends on the size of your bitmap but for me, SetPixel is sure not the best way to draw your bitmap : should rather use ::PaintDIB or something like that.