㈠ 如何在VC控制台環境載入顯示圖片,寫個實例解釋
#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
voidmain()
{
charstrAppName[1024];
{
typedefint(WINAPIICEPUB_GETAPPLICATIONNAME)(char*strReturn);
ICEPUB_GETAPPLICATIONNAME*icePub_getApplicationName=0;
HINSTANCEhDLLDrv=LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_getApplicationName=(ICEPUB_GETAPPLICATIONNAME*)GetProcAddress(hDLLDrv,"icePub_getApplicationName");
}
if(icePub_getApplicationName!=NULL)
{
icePub_getApplicationName(strAppName);
}
if(hDLLDrv)
FreeLibrary(hDLLDrv);
}
HWNDpWnd=FindWindow(NULL,strAppName);
{
typedefint(WINAPIICEPUB_DISPIMG)(HWNDhWnd,char*strImgFilename,intx,inty);
ICEPUB_DISPIMG*icePub_dispImg=0;
HINSTANCEhDLLDrv=LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_dispImg=(ICEPUB_DISPIMG*)GetProcAddress(hDLLDrv,"icePub_dispImg");
}
if(icePub_dispImg!=NULL)
icePub_dispImg(pWnd,"e:\a.jpg",10,10);
if(hDLLDrv)
FreeLibrary(hDLLDrv);
}
getchar();
}
把"e:\a.jpg"改成你本機存在的圖片路徑文件名即可
文檔里有icePubDll.dll下載