winapi - Loading bitmap image in c++ thread -


i attempting load in selected .bmp file , display in wm_paint. function being ran code visual studio see it. here code seems not working:

case wm_paint: {     _hwindowdc = beginpaint(_hwnd, &ps);      if (g_bisfileloaded)     {         std::wstring wsfilename = g_vecimagefilenames.back();         g_vecimagefilenames.pop_back();          std::string file(wsfilename.length(), ' ');         std::copy(wsfilename.begin(), wsfilename.end(), file.begin());          hbitmap h_bitmap = (hbitmap)loadimagea(g_hinstance, file.c_str(), image_bitmap, 0, 0, lr_loadfromfile);         hdc h_homedc = createcompatibledc(_hwindowdc);         bitmap bitmap;          int i_final = getobject(reinterpret_cast<hgdiobj>(h_bitmap), sizeof(bitmap), reinterpret_cast<lpvoid>(&bitmap));          hbitmap h_oldbit = (hbitmap)::selectobject(h_homedc, h_bitmap);          setstretchbltmode(_hwindowdc, halftone);          bool paintbit = stretchblt(_hwindowdc, 1, 1, 50, 50, h_homedc, 0, 0, bitmap.bmwidth, bitmap.bmheight, srccopy);          ::selectobject(h_homedc, h_oldbit);         ::deletedc(h_homedc);         ::deleteobject(h_bitmap);          invalidaterect(_hwnd, null, null);          g_bisfileloaded = false;     }      endpaint(_hwnd, &ps);     return (0); } break; 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -