打开选择显示画面:
int cx,cy;
RECT rect,rc;
HDC hdc;
char szFileName[MAX_PATH]={0};
OPENFILENAME OpenFileName = {0};
OpenFileName.lStructSize =sizeof(OPENFILENAME);
OpenFileName.nMaxFile = MAX_PATH;
OpenFileName.lpstrFilter = "图片(*.bmp)\0*.bmp\0图片(*.jpg)\0*.jpg\0";
OpenFileName.lpstrFile = szFileName;
OpenFileName.lpstrInitialDir ="D:\\SaveZklsBmp\0";
OpenFileName.nFilterIndex =1;
OpenFileName.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_ALLOWMULTISELECT;
if(::GetOpenFileName(&OpenFileName))
{
MessageBox(NULL,szFileName,"测试",MB_OK);
//HBITMAP hbmp = (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CImage image;
image.Load(szFileName);
cx = image.GetWidth();
cy = image.GetHeight();
HWND hwdn = GetDlgItem(m_hWin,IDC_STATPICTRUE);//m_hwin 主窗口句柄
GetWindowRect(hwdn,&rect);
hdc = GetDC(hwdn);
GetClientRect(hwdn,&rc);
image.StretchBlt(hdc,rc,SRCCOPY);
ReleaseDC(hwdn,hdc);
}