cambalinho 125 Practically a Posting Shark

i know use the some functions for put an image on window:

void setImage(string FileName)
    {
        HBITMAP hImage =(HBITMAP) LoadImage(NULL,FileName.c_str(),IMAGE_BITMAP,20,20,LR_LOADFROMFILE);
        HDC image = CreateCompatibleDC(NULL);
        SelectObject(image,hImage);
        BITMAP bitmap;
        GetObject(hImage,sizeof(BITMAP),&bitmap);
        BitBlt(GetDC(this->hwnd),0,0,bitmap.bmWidth,bitmap.bmHeight,image,0,0,SRCCOPY);
    }

but i get 2 problems:
1 - the image isn't showed with original size :( ;
2 - after 2 seconds, i loose the image :(

without using the WM_PAINT how can i add an image to a window and be persistence?
can i use the SendMessage() for resolve the problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.