Click here to Skip to main content
16,007,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Data movement between CString && string Pin
hearties31-May-01 21:26
hearties31-May-01 21:26 
GeneralRe: Data movement between CString && string Pin
Miroslav Rajcic31-May-01 22:14
Miroslav Rajcic31-May-01 22:14 
GeneralDialog Help! Pin
Joseph LeBlanc31-May-01 15:05
Joseph LeBlanc31-May-01 15:05 
GeneralRe: Dialog Help! Pin
Christian Graus31-May-01 15:17
protectorChristian Graus31-May-01 15:17 
GeneralRe: Dialog Help! Pin
1-Jun-01 3:39
suss1-Jun-01 3:39 
GeneralWant Easy E-mail for automated process Pin
Mark Terrano31-May-01 13:17
Mark Terrano31-May-01 13:17 
GeneralRe: Want Easy E-mail for automated process Pin
Ravi Bhavnani31-May-01 13:26
professionalRavi Bhavnani31-May-01 13:26 
GeneralWierd problem saving in GDI+ Pin
Christian Graus31-May-01 12:33
protectorChristian Graus31-May-01 12:33 
OK, I am working on an article and I have only one thing to fix: saving. I wrote a simple app that loaded and saved a bitmap in different formats, worked fine. So I went ahead with this:
BOOL CGDIPlusPaintDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
	CString name(lpszPathName);

	CString ext = name.Right(3);

	ext.MakeLower();

	CLSID  Clsid;
	int ret;
	
	if (ext == "jpg")
	{
		ret = GetCodecClsid(L"image/jpeg", &Clsid);  // Non-API helper function
	}
	else if (ext == "gif")
	{
		ret = GetCodecClsid(L"image/gif", &Clsid);  // Non-API helper function
	}
	else if(ext == "tif")
	{
		ret = GetCodecClsid(L"image/tiff", &Clsid);  // Non-API helper function
	}
	else if (ext == "png")
	{
		ret = GetCodecClsid(L"image/png", &Clsid);  // Non-API helper function
	}
	else // save anything else as a bmp
	{
		ret = GetCodecClsid(L"image/bmp", &Clsid);  // Non-API helper function
	}

	if (m_Bitmap->Save(name.AllocSysString(), &Clsid, NULL)!= Ok)
			AfxMessageBox("Failed to save");	

	return CDocument::OnSaveDocument(lpszPathName);
}

It just plain won't work !! I've traced it all through, the save returns Ok, but the file is 0 length. Here's the odd bit. If I hardcode a path like this:

L"c:\\image.bmp"

then it saves fine every time !! Argh !! I know my string is OK, I use the same method to load the files. I know saving is possible, a hard coded path saves. I know my string is correct going in, it creates an empty file at that location. Any suggestions ?


Christian

#include "std_disclaimer.h"

People who love sausage and respect the law should never watch either one being made.

The things that come to those who wait are usually the things left by those who got there first.
GeneralRe: Wierd problem saving in GDI+ Pin
Michael Dunn31-May-01 18:38
sitebuilderMichael Dunn31-May-01 18:38 
GeneralRe: Wierd problem saving in GDI+ Pin
Christian Graus31-May-01 19:27
protectorChristian Graus31-May-01 19:27 
GeneralInterfacing VB & C++ BSTR* v. BSTR Pin
31-May-01 11:34
suss31-May-01 11:34 
GeneralRe: Interfacing VB & C++ BSTR* v. BSTR Pin
Carlos Antollini31-May-01 11:45
Carlos Antollini31-May-01 11:45 
GeneralRe: Interfacing VB & C++ BSTR* v. BSTR Pin
[James Pullicino]1-Jun-01 3:18
[James Pullicino]1-Jun-01 3:18 
GeneralRe: Interfacing VB & C++ BSTR* v. BSTR Pin
Carlos Antollini1-Jun-01 3:47
Carlos Antollini1-Jun-01 3:47 
GeneralHandling Tab and Esc Keys Pin
ThunderBird31-May-01 9:12
ThunderBird31-May-01 9:12 
GeneralDisplay Text on Screen Pin
31-May-01 8:14
suss31-May-01 8:14 
GeneralRe: Display Text on Screen Pin
Christian Graus31-May-01 8:20
protectorChristian Graus31-May-01 8:20 
QuestionHow to start MFC Pin
31-May-01 7:16
suss31-May-01 7:16 
AnswerRe: How to start MFC Pin
Christian Graus31-May-01 8:16
protectorChristian Graus31-May-01 8:16 
GeneralRe: How to start MFC Pin
31-May-01 10:51
suss31-May-01 10:51 
GeneralRe: How to start MFC Pin
Sab3awy31-May-01 14:15
Sab3awy31-May-01 14:15 
GeneralRe: How to start MFC Pin
Christian Graus31-May-01 14:24
protectorChristian Graus31-May-01 14:24 
GeneralRe: How to start MFC Pin
Tomasz Sowinski1-Jun-01 0:19
Tomasz Sowinski1-Jun-01 0:19 
GeneralRe: How to start MFC Pin
1-Jun-01 6:49
suss1-Jun-01 6:49 
GeneralAnyone familiar with SQL Server ?!?!?! Pin
31-May-01 6:26
suss31-May-01 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.