赞
踩
C++ 调用WINDOWS照片查看器打开图片,关闭照片查看器
目的:使用C++,1. 调用WINDOWS照片查看器打开图片,2. 关闭照片查看器
CString sPicturePath = "d:\test.jpg";
CString sPicturePara= "shimgvw.dll ImageView_Fullscreen "+ sPicturePath ;
ShellExecute(NULL, NULL,
"rundll32.exe",
sPicturePara,
"C:\\WINDOWS\\system32",
SW_SHOW);
HWND hFrmWnd = ::FindWindow(_T("Photo_Lightweight_Viewer"),NULL);
if (hFrmWnd != NULL)
{
HWND hBtnWnd = ::FindWindowEx(hFrmWnd,NULL, _T("Photos_CommandBar"), NULL);
if (hBtnWnd != NULL) {
::ShowWindow(hFrmWnd, SW_SHOWNORMAL);
::SetForegroundWindow(hFrmWnd);
::PostMessage(hFrmWnd, WM_CLOSE, 0, 0); // close the app
return 0;
}
}
return -1;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。