// 菜单项
cximage-》resource-》Load Jpeg Resource
//CxImage\demo\demo.cpp ON_COMMAND(ID_CXIMAGE_LOADJPEGRESOURCE,OnCximageLoadjpegresource)
void CDemoApp::OnCximageLoadjpegresource() { CxImage* newImage = new CxImage(); if (!newImage->LoadResource(FindResource(NULL,_T("IDR_JPG2"),_T("JPG")),CXIMAGE_FORMAT_JPG)){ CString s = newImage->GetLastError(); AfxMessageBox(s); delete newImage; newImage =NULL; return; } CDemoDoc *doc = (CDemoDoc *)demoTemplate->OpenDocumentFile(NULL); if (doc){ doc->image = newImage; CString s; s.Format(_T("JPEG Resource Image %d"),m_nDocCount++); doc->SetTitle(s); doc->UpdateAllViews(0,WM_USER_NEWIMAGE); doc->UpdateStatusBar(); } }
// WM_USER_NEWIMAGE 消息传递到view 层 virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); void CDemoView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { switch (lHint) { case WM_USER_NEWIMAGE: { .... } } }
标签:菜单,doc,USER,newImage,NEWIMAGE,NULL,cximage From: https://www.cnblogs.com/leochan007/p/16840502.html