Try <br/>{< br/> hinstance ghinstapp = AfxGetInstanceHandle (); <br/> hrsrc = findresource (null, <br/> makeintresource (idb_bitmap1), rt_bitmap ); <br/> assert (hrsrc); <br/> DWORD dwerr = getlasterror (); <br/> DWORD dwlen = sizeofresource (ghinstapp, hrsrc ); <br/> assert (dwlen); <br/> hglobal = loadresource (ghinstapp, hrsrc); </P> <p> cfile file (_ T ("C: // temp // a.bmp "), cfile: modecreate | cfile: modewrite ); </P> <p> // construct a file header <br/> bitmapfileheader BFH = {0}; // bitmap file header <br/> BFH. bfoffbits = sizeof (bitmapfileheader) + sizeof (bitmapinfoheader); // offset of the data in the in-place graph <br/> BFH. bfsize = BFH. bfoffbits + dwlen-sizeof (bitmapinfoheader); // total file size <br/> BFH. bftype = (Word) 0x4d42; </P> <p> file. write (& BFH, sizeof (BFH); <br/> file. write (hglobal, dwlen); <br/> file. close (); <br/>}< br/> catch (...) <br/>{< br/> assert (0); <br/>}