473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

imapi staging image for record iz on CD WINxp

4
Hi to all, this is my first post here so I'm hoping you can help me. Now I'm writing a app which, among all other things need to record some data to CD. I'm using IMAPI v1 and here is the problem: i cant create an staging image, this is the part of my code:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. IStorage* pStorage = NULL;
  3. IStream* pStream;
  4. int i=0;
  5. StgCreateDocfile( NULL, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, &pStorage);
  6.  
  7. CFile files[32];
  8.  
  9. //filenames is CStringList which is populated by users choice of files they want to record on CD
  10. POSITION pos = filenames.GetHeadPosition();
  11. while(pos != NULL)
  12. {
  13. CString strFilePath=filenames.GetNext(pos);
  14.  
  15. int nSize = 0;
  16. CFileException e;
  17.  
  18. if (filesIdea.Open(strFilePath,CFile::modeRead|CFile::typeBinary,&e))
  19. {
  20. LPWSTR lpszW = new WCHAR[255];
  21. LPTSTR lpStr = strFilePath.GetBuffer( strFilePath.GetLength() );
  22. int nLen = MultiByteToWideChar(CP_ACP, 0,lpStr, -1, NULL, NULL);
  23. int code = MultiByteToWideChar(CP_ACP, 0, strFilePath, -1, pszW,nLen);
  24. if(!code)
  25. {
  26. CString tmp = _T("'MultiByteToWideChar' returns NULL!");
  27. DWORD err = GetLastError();
  28. DisplayErrorString(tmp,err);
  29. if (lpszW)
  30. delete [] lpszW;
  31. filesIdea.Close();
  32. pDiscMaster->ClearFormatContent();
  33. return FALSE;
  34. }
  35.  
  36. HRESULT res;
  37. if( (res = pStorage->CreateStream( lpszW, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_FAILIFTHERE, 0, 0, &pStream) ) != S_OK )
  38. {!!!HERE IT'S CRACKS SAYING "Invalid value for pwcsName." (lpszW???)
  39. ShowHRError(res);
  40. if (lpszW)
  41. delete [] lpszW;
  42. filesIdea.Close();
  43. pDiscMaster->ClearFormatContent();
  44. return FALSE;
  45. }
  46. nSize = files[i].GetLength();
  47. BYTE *pBuffer = new BYTE[nSize];
  48. if (files[i].Read(pBuffer,nSize) > 0)
  49. {
  50. pStream->Write(pBuffer,nSize,NULL);
  51. pStream->Release();
  52. }
  53. files[i].Close();
  54. delete[] pBuffer;
  55. }
  56.  
  57. ...
  58.  
As I put it my code breaks in line 37.
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!
May 29 '07 #1
2 2390
weaknessforcats
9,208 Expert Mod 8TB
Per Microsoft docs lpszW:
must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction.
Does your lpszW fconform to this?
May 29 '07 #2
cagi
4
Per Microsoft docs lpszW:

Does your lpszW fconform to this?
I'm aweare of that!

Can I burn both directories and files?
May 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Perry | last post by:
I desperately need help to get the IMAPI (Image Mastering API interface comes with Windows XP to burn CD) to work on my PC. I downloaded the IMAPI sample on Microsoft website: ...
7
by: Zri Man | last post by:
I have searched far and wide (not wide enough some might chip in) but cannot find the syntax for creating a staging table for an MQT. IBM manuals talk long and longer in serveral sections of this...
2
by: ms | last post by:
Access 2000: I am trying to delete duplicate records imported to a staging table leaving one of the duplicates to be imported into the live table. A unique record is based on a composite key of 3...
7
by: Scott Simonson | last post by:
Sorry if this posts twice. I can only assume that my previous post didn't because I attached a small image to it to show the error. I have had an application in MSAccess 2k for about year now...
2
by: Tony B | last post by:
Does anybody know what sdk is needed for VB 5.0 for using the IMAPI functions for writing files to cd in windows XP...or where can i download it from. I think this is it Microsoft Platform SDK,...
7
by: tonylc | last post by:
Hi, I'm trying to program in 2003 Visual Studio to try and burn files onto a cd burner in windows xp service pack 2. http://msdn.microsoft.com/msdnmag/issues/04/04/CQA/ I found some code on...
1
by: tonylc | last post by:
does anyone know what you need to include to get Visual Studio 2003 or 2005 to recognize IDiscMaster, IDiscRecorder and all the other interfaces in IMAPI? Right my visual studio only recognizes...
6
by: tonylc | last post by:
I would like to do some error checking to see if the CD is write protected or not or whether there is even a CD media at all. From what I gather I should be calling the method QueryMediaType. ...
6
by: Klemens | last post by:
I want to create an MQT, intialize it manually and then use staging table to refresh it with new data, but i don' t see a way for not doing full refresh after creating the staging table. I tried...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.