473,545 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

imapi staging image for record iz on CD WINxp

4 New Member
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 2394
weaknessforcats
9,208 Recognized Expert Moderator Expert
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 New Member
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
2003
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: http://msdn.microsoft.com/msdnmag/issues/04/04/cqa/default.aspx With SDK installed, I compiled and run the code on my PC running XP Pro with service pack 1. I do...
7
7756
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 "marvel" but there is no indication of what it takes to create one. I have seen indications that appear to suggest that the CREATE table...
2
4978
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 fields (vehicleID, BattID, and ChgHrs). VehicleID and BattID are a TEXT datatype and ChrHrs are a number(long int.) datatype. Since records to be...
7
2674
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 without issues until today. My users were using it in W98 without issue, but recently moved to WindowsXP and now are getting an error. It is with the...
2
2912
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, February 2003 Edition, by don't know if windows or core etc... Please help...
7
3119
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 this website that i'm trying to run, but it keeps saying it cannot find imapi.h. But I thought imapi.h came with windows xp? Any ideas?
1
1054
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 ICDBurn. Any idea would be great. Thanks, Tony
6
3032
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. However, on the call right before I set my DiscRecorder hr = pDiscMaster->SetActiveDiscRecorder(pDiscRecorder); I keep getting same HRESULT ...
6
5457
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 set integrity immediate unchecked, but refresh table after that seems to do a full refresh. Should this work? If so, what would be the right...
0
7411
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7669
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7926
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7439
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5987
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3468
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.