安装MSI后无法在我的应用程序中显示png
我想知道msi安装的完整方法,因为 安装时创建的msi文件未显示.png类型的图片,为什么会发生这种情况以及如何解决此问题?
在创建msi之前,当我在vc ++ 2008中执行程序时,其显示图片.为什么在创建同一程序时无法查看png图片,为什么可以查看其他位图类型的图片.
我已将png图片放在res文件夹中.
并遵循以下步骤
解决方案资源管理器-> ResourceFiles->右键单击鼠标->添加现有项->(添加了res文件夹的png文件)
安装msi后,我还应该怎么做才能使png图片出现.
[更新]
我已使用图片ctrl显示png
I want to know the complete method of msi installation because The msi file created when installed is not displaying the pictures that are of .png type why does this happen and how to solve this problem?
Before creating msi when I execute the program in the vc++2008 its showing pictures. why I am not able to view png pictures when I create the same program msi other pics of bitmap type can be viewed.
I have placed png pictures in res folder.
and also followed the following procedure
solution explorer->ResourceFiles->right click mouse->add existing item->(added png files of res folder)
What else should I do to make my png pictures appear after installing msi.
[updated]
I have used picture ctrl to display png
BOOL CPictureCtrl::Load(BYTE* pData, size_t nSize)
{
return LoadFromStream(pData, nSize);
}
....
CPictureCtrl m_picCtrl;
CFile picFile;
if(picFile.Open(_T("res/uprightAcousticPiano.png"), CFile::modeReadWrite | CFile::typeBinary))
{
cout("opened");
BYTE* pBuffer = new BYTE[(unsigned int)picFile.GetLength()];
if(pBuffer != NULL)
{
picFile.Read(pBuffer, (UINT)picFile.GetLength());
//Load the Image
cout("displayed");
m_picCtrl.Load(pBuffer, (size_t)picFile.GetLength());
delete pBuffer;
}
}
....
在安装后是否已在调试器中运行它?我假设您正在构建要安装的发行版-您是否尝试过运行发行版以查看其行为
在没有代码优化的情况下发布它,程序数据库(分别为/od和/Zi)
与/DEBUG链接
然后,您可以调试或附加所需的只是源代码和pdbs
几个观察
1.您正在请求RW访问权限?您需要RW吗?该文件是否已安装RO?
2.您假设您当前的工作目录高于``res \\''
3.您的目录斜杠是错误的方式
have you run it under a debugger after it''s been installed? I assume you''re building release for install - have you tried running the release build to see its behaviour
Compile it under release with no code optimisations, program database (/od and /Zi respectively)
Link with /DEBUG
You can then debug, or attach, all you need is the source and the pdbs
Couple of observations
1. You''re requesting RW access? do you need RW? is the file installed RO?
2. You''re assuming your current working dir is above ''res\\''
3. Your directory slash is the wrong way round
如果我正确阅读了您的问题,则说明您正在使用.msi文件将应用程序安装在另一个(甚至是您自己的)系统上.
您的代码尝试从名为"res"的目录中加载.png文件,该目录是包含.exe文件的文件夹的子目录.
您的.msi是否还包括res文件夹和.png文件以及您的应用程序的分发?如果不是这样,那就是问题所在,因为文件(和.res dir)将不存在(除非作为开发文件夹的子目录).
希望这会有所帮助.
If I read your problem correctly, you''re using an .msi file to install your application on another (or even your own) system.
Your code tries to load your .png file from a directory called "res", which is a subdirectory of the folder containing your .exe file.
Does your .msi also include distribution of the res folder and the .png files along with your application? If not, that is the problem since the files (and the .res dir) won''t exist (except as a subdirectory of your development folder).
Hope this helps.