Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

C++
BOOL CPictureCtrl::Load(BYTE* pData, size_t nSize)
{
	return LoadFromStream(pData, nSize);
}

C++
....
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;
		}
	}
....
Posted
Updated 14-May-12 19:42pm
v5
Comments
Code-o-mat 11-May-12 6:58am    
Do you use some library to work with png files that requires a DLL maybe? If yes, does your installer include this DLL?
chaiein 14-May-12 23:28pm    
no I am not using any different dll I have included below as part of the code display png


int myInt=0;
Patch = (unsigned char)myInt;
m_picCtrl.FreeImage();
CFile picFile;
if(picFile.Open(_T("res/acoustic grand piano_small.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;
}
}
enhzflep 15-May-12 1:21am    
What's the type of m_picCtrl?
Or, more importantly (and the information I would look up if I knew the type) - is there a return value from m_picCtrl.Load?
I'd also be checking to see if picFile.GetLength() was returning the correct values.
Otherwise, it's a bit hard to tell(guess) - the code you show above looks good. It sure sounds like an odd problem.
chaiein 15-May-12 1:43am    
CPictureCtrl m_picCtrl;
i have include PictureCtrl.h and .cpp
enhzflep 15-May-12 2:03am    
Reading the comments below makes me wonder how you're linking to the MFC / VC libs. I use VS too infrequently to recall what kind of error message would be thrown - but have you tried to Statically Link these libraries - that is, not rely on DLLs in your exe?

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
 
Share this answer
 
Comments
chaiein 15-May-12 1:39am    
if i use in release mode instead of warning the program closes.
barneyman 15-May-12 1:41am    
ok - then you have some release vs debug build issues - you're going to have to debug the release build to work out what's missing
chaiein 15-May-12 1:44am    
how to do that where should I change the properties?
chaiein 15-May-12 1:49am    
It works perfect as I require before msi creation but only after msi creation and installed and try to run the png problem and warning(debug mode) or close program(release mode)comes.
barneyman 15-May-12 1:54am    
I assume you're talking about installing on a different machine?

If that's the case, the debug problem is environmental; there is something missing on the destination machine, that you are implicitly/explicitly assuming is already there

The release problem points to some more fundamental issues at play; I'd solve those first if I were you - you're NOT going to be shipping debug code

Again - your only real option (after using depends.exe to make sure you're not missing a supporting dll) is to debug it ...

I've given you the switches to do that
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.
 
Share this answer
 
Comments
chaiein 18-May-12 3:01am    
ya I have included res in the msi and it contains png files too and included the png also its not working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900