Click here to Skip to main content
15,896,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMultiline edit control Pin
tom groezer4-Jun-07 23:45
tom groezer4-Jun-07 23:45 
AnswerRe: Multiline edit control Pin
Cedric Moonen4-Jun-07 23:50
Cedric Moonen4-Jun-07 23:50 
GeneralRe: Multiline edit control Pin
tom groezer5-Jun-07 0:16
tom groezer5-Jun-07 0:16 
AnswerRe: Multiline edit control Pin
David Crow5-Jun-07 2:53
David Crow5-Jun-07 2:53 
AnswerRe: Multiline edit control Pin
Matthew Faithfull5-Jun-07 3:47
Matthew Faithfull5-Jun-07 3:47 
QuestionHow to check mouse move in ToolBar Items? Pin
Atul234-Jun-07 23:43
Atul234-Jun-07 23:43 
AnswerRe: How to check mouse move in ToolBar Items? Pin
Nibu babu thomas4-Jun-07 23:53
Nibu babu thomas4-Jun-07 23:53 
Questionburning CD using IMAPI 1 Pin
josip cagalj4-Jun-07 23:08
josip cagalj4-Jun-07 23:08 
Hi again, I'm trying to find someone who used Imapi for cd recording if he could help me. I'm having a problem with staging a image for folders to enable burning to cd. I'm using ISorage and IStream, I'm only having trouble with folders(subfolders), no problem recording files! I call my function member 'BurnCD()' for recording, here is the code:
<br />
BOOL CBurn::BurnCD()<br />
{<br />
	HRESULT hr;<br />
<br />
	CFile files[32];<br />
	IStorage* pStorage = NULL;<br />
	IStream* pStream;<br />
	int i=0;<br />
<br />
	//m_lsFiles-> is ClistCtrl which contain files/folders chosen for burning<br />
	for (i =0; i<m_lsFiles.GetItemCount(); i++)<br />
	{<br />
		CString strFilePath=m_lsFiles.GetItemText(i,0);<br />
		CString tip=m_lsFiles.GetItemText(i,2);<br />
		CFileException e;<br />
		int nSize = 0;<br />
	<br />
		if(tip == CTXT_DOC)//if it's a file<br />
		{<br />
<br />
			hr = StgCreateDocfile( NULL, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, &pStorage);<br />
			if (files[i].Open(strFilePath,CFile::modeRead,&e))<br />
			{<br />
				USES_CONVERSION;<br />
				CString ime = files[i].GetFileName();<br />
				HRESULT res;<br />
				if( (res = pStorage->CreateStream( T2W(ime.operator LPCTSTR()),  STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_FAILIFTHERE, 0, 0, &pStream) ) != S_OK )<br />
					return FALSE;<br />
<br />
				nSize = files[i].GetLength();<br />
				BYTE *pBuffer = new BYTE[nSize];<br />
				if (files[i].Read(pBuffer,nSize) > 0)<br />
				{<br />
					hr = pStream->Write(pBuffer,nSize,NULL);<br />
					hr = pStream->Release();<br />
				}<br />
				files[i].Close(); <br />
				delete[] pBuffer;<br />
				hr = pJolietDiscMaster->AddData(pStorage, 0);<br />
			}<br />
		}<br />
		else if (tip == CTXT_DIR)// if it's a folder<br />
		{<br />
			hr = StgCreateStorageEx(NULL,<br />
				 STGM_CREATE | STGM_READWRITE |STGM_SHARE_EXCLUSIVE | STGM_DIRECT,<br />
                 STGFMT_STORAGE,<br />
                 0,0,0,<br />
				 IID_IStorage,<br />
                 (void**)&pStorage);<br />
	<br />
			CString curDir = strFilePath;<br />
			//get dir name<br />
			CString dir_name=_T(""),temp = strFilePath;<br />
			int len = temp.GetLength();<br />
			for(int i=len-1; i>=0; i--)<br />
			{<br />
				if(temp.GetAt(i)=='\\')<br />
				{<br />
					dir_name = temp.Right(len-i-1);<br />
					break;<br />
				}<br />
			}<br />
			IStorage* pDirStorage;<br />
			USES_CONVERSION;<br />
			hr = pStorage->CreateStorage(A2W(dir_name.operator LPCTSTR()),<br />
				 STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT,<br />
                 0,0,&pDirStorage);<br />
			SetCurrentDirectory(strFilePath);<br />
			CString F_name;<br />
			CFileFind m_ff;<br />
			strFilePath += "\\";<br />
			strFilePath += "*.*";<br />
			BOOL b_dd = m_ff.FindFile(strFilePath);<br />
			if(!b_dd)<br />
			{<br />
				DWORD err = GetLastError();<br />
				DisplayErrorString("",err);<br />
				return FALSE;<br />
			}<br />
			while(b_dd)<br />
			{<br />
				b_dd = m_ff.FindNextFile();<br />
				if(m_ff.IsDots()) continue;<br />
				F_name = m_ff.GetFileName();<br />
				if( F_name.GetLength() > 31)<br />
				{<br />
					return FALSE;<br />
				}<br />
<br />
				if(m_ff.IsDirectory())<br />
				{<br />
					// StorageDir() function member for storaging subfolders<br />
					//link:<a href = "http://tinyurl.com/yuyfw3" rel="nofollow">http://tinyurl.com/yuyfw3</a>[<a href = "http://tinyurl.com/yuyfw3" target = "_blank" rel="nofollow">^</a>]<br />
					BOOL res = StorageDir( curDir, F_name, pDirStorage);<br />
					if(!res) return FALSE;<br />
					continue;<br />
				}<br />
<br />
				CFile File;<br />
				if(!File.Open(F_name,CFile::modeRead,&e))<br />
					return FALSE;<br />
<br />
				IStream* pDirFileStream;<br />
				HRESULT rez;<br />
				rez = pDirStorage->CreateStream(A2W(F_name.operator LPCTSTR()),<br />
					STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE,<br />
					0, 0, &pDirFileStream);<br />
				nSize = File.GetLength();<br />
				BYTE *pBuffer = new BYTE[nSize];<br />
				if (File.Read(pBuffer,nSize) > 0)<br />
				{<br />
					hr =pDirFileStream->Write(pBuffer,nSize,NULL);<br />
					hr = pDirFileStream->Commit(STGC_OVERWRITE);<br />
					hr= pDirFileStream->Release();<br />
				}<br />
				File.Close(); <br />
				delete[] pBuffer;<br />
			}<br />
			hr = pJolietDiscMaster->AddData(pStorage, 0);<br />
			pStorage->Release();<br />
		}<br />
	}<br />
	theApp.DoWaitCursor(1);<br />
	hr = pDiscMaster->RecordDisc(FALSE,TRUE);<br />
	theApp.DoWaitCursor(-1);<br />
<br />
	return TRUE;<br />
<br />


on the bolded,underlined line is where my code crak's reporting "Insufficient permissions to create stream!"
If someone can help with this or post it's code how to solve storage for folders please do so, I'm very thankful to all who can help!
QuestionCMenu problem Pin
prithaa4-Jun-07 22:46
prithaa4-Jun-07 22:46 
AnswerRe: CMenu problem Pin
Rajkumar R4-Jun-07 23:20
Rajkumar R4-Jun-07 23:20 
GeneralRe: CMenu problem Pin
prithaa4-Jun-07 23:50
prithaa4-Jun-07 23:50 
AnswerRe: CMenu problem Pin
Rajkumar R5-Jun-07 0:54
Rajkumar R5-Jun-07 0:54 
AnswerRe: CMenu problem Pin
Nibu babu thomas4-Jun-07 23:48
Nibu babu thomas4-Jun-07 23:48 
GeneralRe: CMenu problem Pin
prithaa4-Jun-07 23:59
prithaa4-Jun-07 23:59 
GeneralRe: CMenu problem Pin
Naveen5-Jun-07 0:14
Naveen5-Jun-07 0:14 
QuestionRe: CMenu problem Pin
Nibu babu thomas5-Jun-07 0:32
Nibu babu thomas5-Jun-07 0:32 
AnswerRe: CMenu problem Pin
Naveen5-Jun-07 0:40
Naveen5-Jun-07 0:40 
QuestionHow to register .NET DLL explicitly? Pin
Banks K4-Jun-07 22:22
Banks K4-Jun-07 22:22 
AnswerRe: How to register .NET DLL explicitly? Pin
_AnsHUMAN_ 4-Jun-07 23:35
_AnsHUMAN_ 4-Jun-07 23:35 
GeneralRe: How to register .NET DLL explicitly? Pin
Banks K5-Jun-07 0:22
Banks K5-Jun-07 0:22 
QuestionLaunch Application after Setup Pin
baerten4-Jun-07 22:13
baerten4-Jun-07 22:13 
AnswerRe: Launch Application after Setup Pin
Dustin Henry5-Jun-07 4:50
Dustin Henry5-Jun-07 4:50 
GeneralVC++ Links and Ebooks Pin
N a v a n e e t h4-Jun-07 21:39
N a v a n e e t h4-Jun-07 21:39 
GeneralRe: VC++ Links and Ebooks Pin
Hamid_RT4-Jun-07 21:44
Hamid_RT4-Jun-07 21:44 
GeneralRe: VC++ Links and Ebooks Pin
Anurag Gandhi4-Jun-07 21:51
professionalAnurag Gandhi4-Jun-07 21:51 

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.