Click here to Skip to main content
15,901,122 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to change client area? Pin
Arman S.29-May-07 3:50
Arman S.29-May-07 3:50 
QuestionRe: How to change client area? Pin
David Crow29-May-07 3:46
David Crow29-May-07 3:46 
AnswerRe: How to change client area? Pin
Max++29-May-07 4:24
Max++29-May-07 4:24 
QuestionRe: How to change client area? Pin
David Crow29-May-07 4:28
David Crow29-May-07 4:28 
AnswerRe: How to change client area? Pin
Stephen Hewitt29-May-07 13:56
Stephen Hewitt29-May-07 13:56 
QuestionTo change the font of caption for SDI application Pin
Neeraj Sinha29-May-07 2:17
Neeraj Sinha29-May-07 2:17 
AnswerRe: To change the font of caption for SDI application Pin
Hamid_RT29-May-07 6:32
Hamid_RT29-May-07 6:32 
QuestionImapi staging an image? Pin
josip cagalj29-May-07 1:51
josip cagalj29-May-07 1:51 
Hi again.
I came with my app to the point where I need to stage an image for CD record! But error occure once again.
I'm obviously doing something wrong in my code. Here it is:

...<br />
IStorage* pStorage = NULL;<br />
IStream* pStream;<br />
int i=0;<br />
StgCreateDocfile( NULL, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, &pStorage);<br />
   <br />
CFile files[32];<br />
<br />
//filenames is CStringList which is populated by users choice of files they //want to record on CD   <br />
POSITION pos = filenames.GetHeadPosition();    <br />
while(pos != NULL)<br />
{<br />
        CString strFilePath=filenames.GetNext(pos);<br />
<br />
        int nSize = 0;<br />
        CFileException e;<br />
<br />
    if (filesIdea.Open(strFilePath,CFile::modeRead|CFile::typeBinary,&e))<br />
    {<br />
        LPWSTR lpszW = new WCHAR[255];<br />
        LPTSTR lpStr = strFilePath.GetBuffer( strFilePath.GetLength() );<br />
        int nLen = MultiByteToWideChar(CP_ACP, 0,lpStr, -1, NULL, NULL);<br />
        int code = MultiByteToWideChar(CP_ACP, 0, strFilePath, -1, pszW,nLen);<br />
        if(!code)<br />
        {<br />
            CString tmp = _T("'MultiByteToWideChar' returns NULL!");<br />
            DWORD err = GetLastError();<br />
            DisplayErrorString(tmp,err);<br />
            if (lpszW)<br />
                delete [] lpszW;<br />
            filesIdea.Close();<br />
            pDiscMaster->ClearFormatContent();<br />
            return FALSE;<br />
         }<br />
       <br />
         HRESULT res;<br />
         if( (res = pStorage->CreateStream( lpszW,  STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_FAILIFTHERE, 0, 0, &pStream) ) != S_OK )<br />
         {!!!HERE IT'S CRACKS SAYING "Invalid value for pwcsName." (lpszW???)<br />
             ShowHRError(res);<br />
             if (lpszW)<br />
                delete [] lpszW;<br />
             filesIdea.Close();<br />
             pDiscMaster->ClearFormatContent();<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 />
		pStream->Write(pBuffer,nSize,NULL);<br />
		pStream->Release();<br />
	  }<br />
		files[i].Close(); <br />
		delete[] pBuffer;<br />
}<br />
<br />
  ...


I'm trying to find code example which works?? Or someone who can tell me where I did wrong??Why can't I create stream, what is wrong with lpszW
THX to all
QuestionCListCtrl Pin
Bravoone_200629-May-07 1:02
Bravoone_200629-May-07 1:02 
AnswerRe: CListCtrl Pin
Hans Dietrich29-May-07 1:21
mentorHans Dietrich29-May-07 1:21 
QuestionOf course... Pin
CPallini29-May-07 1:53
mveCPallini29-May-07 1:53 
AnswerRe: Of course... Pin
David Crow29-May-07 3:48
David Crow29-May-07 3:48 
GeneralRe: Of course... Pin
CPallini29-May-07 4:04
mveCPallini29-May-07 4:04 
QuestionRun Time Combo Box Pin
Y_Kaushik29-May-07 0:40
Y_Kaushik29-May-07 0:40 
AnswerRe: Run Time Combo Box Pin
Naveen29-May-07 0:44
Naveen29-May-07 0:44 
GeneralRe: Run Time Combo Box Pin
Y_Kaushik29-May-07 0:56
Y_Kaushik29-May-07 0:56 
GeneralRe: Run Time Combo Box Pin
_AnsHUMAN_ 29-May-07 1:00
_AnsHUMAN_ 29-May-07 1:00 
GeneralRe: Run Time Combo Box Pin
Hamid_RT29-May-07 1:03
Hamid_RT29-May-07 1:03 
GeneralRe: Run Time Combo Box Pin
Naveen29-May-07 1:05
Naveen29-May-07 1:05 
AnswerRe: Run Time Combo Box Pin
Hamid_RT29-May-07 0:56
Hamid_RT29-May-07 0:56 
GeneralRe: Run Time Combo Box Pin
Y_Kaushik29-May-07 1:17
Y_Kaushik29-May-07 1:17 
GeneralRe: Run Time Combo Box Pin
Hamid_RT29-May-07 1:30
Hamid_RT29-May-07 1:30 
GeneralRe: Run Time Combo Box Pin
Y_Kaushik29-May-07 1:52
Y_Kaushik29-May-07 1:52 
GeneralRe: Run Time Combo Box Pin
Hamid_RT29-May-07 2:04
Hamid_RT29-May-07 2:04 
QuestionTypecasting Pin
siddharthsan29-May-07 0:26
siddharthsan29-May-07 0: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.