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: -
...
-
IStorage* pStorage = NULL;
-
IStream* pStream;
-
int i=0;
-
StgCreateDocfile( NULL, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, &pStorage);
-
-
CFile files[32];
-
-
//filenames is CStringList which is populated by users choice of files they want to record on CD
-
POSITION pos = filenames.GetHeadPosition();
-
while(pos != NULL)
-
{
-
CString strFilePath=filenames.GetNext(pos);
-
-
int nSize = 0;
-
CFileException e;
-
-
if (filesIdea.Open(strFilePath,CFile::modeRead|CFile::typeBinary,&e))
-
{
-
LPWSTR lpszW = new WCHAR[255];
-
LPTSTR lpStr = strFilePath.GetBuffer( strFilePath.GetLength() );
-
int nLen = MultiByteToWideChar(CP_ACP, 0,lpStr, -1, NULL, NULL);
-
int code = MultiByteToWideChar(CP_ACP, 0, strFilePath, -1, pszW,nLen);
-
if(!code)
-
{
-
CString tmp = _T("'MultiByteToWideChar' returns NULL!");
-
DWORD err = GetLastError();
-
DisplayErrorString(tmp,err);
-
if (lpszW)
-
delete [] lpszW;
-
filesIdea.Close();
-
pDiscMaster->ClearFormatContent();
-
return FALSE;
-
}
-
-
HRESULT res;
-
if( (res = pStorage->CreateStream( lpszW, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_FAILIFTHERE, 0, 0, &pStream) ) != S_OK )
-
{!!!HERE IT'S CRACKS SAYING "Invalid value for pwcsName." (lpszW???)
-
ShowHRError(res);
-
if (lpszW)
-
delete [] lpszW;
-
filesIdea.Close();
-
pDiscMaster->ClearFormatContent();
-
return FALSE;
-
}
-
nSize = files[i].GetLength();
-
BYTE *pBuffer = new BYTE[nSize];
-
if (files[i].Read(pBuffer,nSize) > 0)
-
{
-
pStream->Write(pBuffer,nSize,NULL);
-
pStream->Release();
-
}
-
files[i].Close();
-
delete[] pBuffer;
-
}
-
-
...
-
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!
2 2394
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?
Per Microsoft docs lpszW:
Does your lpszW fconform to this?
I'm aweare of that!
Can I burn both directories and files?
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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?
|
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
|
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
...
|
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...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |