|
I am working with a project which handles large compound files. Now I face a problem with IStream::Write().
IStream::Write()retuns an error STG_E_DOCFILETOOLARGE (Error:"The compound file is too large for the current implementation").
I am trying to write in a compound file created with 512 Byte sectors (Info MSDN see below). The current file size is about 300 MByte and the number of streams are about 100000 ! The error occurs only with Win 2000 SP3 and XP SP1. In Win NT 4.0 SP6a it works !!! When I create the file with 4096 Byte sectors in StgCreateStorageEx, IStream::Write works for Win 2000 and XP too. Now my question: Is this a bug?
Info from MSDN Library:
The compound file implementation can be configured to use 512 or 4096 byte sectors, as defined in the STGOPTIONS structure. File size limits: 512: 2 gigabytes (GB) 4096: Up to file system limits Number of elements in a file: 512: Unlimited, but performance may degrade if elements number in the thousands 4096: Unlimited
Mainul Hossain
Germany
|
|
|
|
|
What implementation of IStream are you using (how do you create stream object)?
|
|
|
|
|
Hello!
I have a COM (ATL) object IDataProvider which used to provide data to some services. This object can be used from other processes.
Also I have a C++ object which contains data and I need to attach this object to IDataProvider object somehow.
eg:
class CDataContainer
{
...
};
class ATL_NO_VTABLE CDataProvider :
public CComObjectRootEx<ccommultithreadmodel>,
public CComCoClass<ctestdataprovider, &clsid_dataprovider="">,
public IDataProvider
{
...
}
I need something like this:
void CDataContainer::DoDataExchange(pDX)
{
CComPtr<idataprovider> pDataProvider;
pDataProvider.CoCreateInstance(CLSID_DataProvider);
pDataProvider->SetDataContainer(this);
// pDX object can be located in another process
pDX->DoDataExchange(pDataProvider);
}
========================================================
IDataProvider object can be created only from DLL which contains CDataContainer code. Can I use it like this:
class CDataContainer
{
...
};
class CDataProvider : public IDataProvider
{
...
}
void CDataContainer::DoDataExchange(pDX)
{
CDataProvider* pDataProvider = new CDataProvider(this);
// pDX object can be located in another process
pDX->DoDataExchange(pDataProvider);
}
With regards,
Pavel Krupets
|
|
|
|
|
It has to be a COM object. Try IDataObject interface.
|
|
|
|
|
Hello!
Thank you for reply.
Do you mean I cannot use "class CDataProvider : public IDataProvider"?
If so I was almost sure it won't do the trick.
But in my case I cannot pass data to server, it have to ask me for it. Because it might use only part of it and it isn't right to load everything.
With regards,
Pavel Krupets
|
|
|
|
|
What I meant is for your SetData(...), you need some COM interface to pass as parameter. something like:
SetData([in]IMyDataHolder* pHolder);
IDataObject is standard interface and seems appropriate for a job. If it does not satisfy your needs, you should create another interface. The main idea is that if you have C++ class and you want to use it in COM , there is only one way to do it - it is to encapsulate it in the COM object.
|
|
|
|
|
Hello!
It's impossible to encapsulate this object inside COM object. Due to application architecture. And I think the only solution is to gather all data and pass it into the server.
Thank you...
With regards,
Pavel Krupets
|
|
|
|
|
Hello!
In my case it can be solved like this:
class CDataProvider : public IDataProvider
{
CDataProvider(CDataSource* pSource);
...
};
void CDataSource::DoDataExchange(IServer* pServer)
{
CComPtr<idataprovider> pDP;
pDP.Attach(new CDataProvider(this));
pServer->DoDataExchange(pDP);
// pDP will be destroyed here...
}
This will work even if pServer is in another process.
With regards,
Pavel Krupets
|
|
|
|
|
Is there a way to convert a HGLOBAL memory handle to a Safarray of VT1, without copying memory ?
Jonathan de Halleux.
|
|
|
|
|
|
I want to get "selected ELEMENT" or "selected ELEMENT Collection" in MSHTML.
--------------------------
IHTMLDocument2 *pDoc2;
IHTMLSelectionobject *pSel;
IHTMLTxtRange *pRange;
pDoc2->get_selection(&pSel);
pSel->createRange(&pRange);
pRange->parentElement(--);
----------------------------
I got the element by the above.
But This is not that I wished.
abc
abc2
if "table element" & "font element" is selected,
I will get "body element".
Then I will process to process-undesired "span element".
I want to create what I processes only selected elements.
Therefore, I want to get "ELEMENT collection".
Please tell me!!
|
|
|
|
|
|
Thank you for a reply.
But I want to create "IHTMLElement object" from "IHTMLTxtRange object" or "document selection".
I thought the same idea as Franks's.
But I cannot process the element which does not have ID in an attribute.And I may do wrong processing.
IHTMLTxtRange *pRange;
pRange->get_htmlText(&BSTR);
For example,BSTR is the below
defg1 '1
defg2 '2
defg3 '3
As the above,"'2" isn't processed.
Can "the MSHTML" directly change a selection into the element?
|
|
|
|
|
jajamal wrote:
I thought the same idea as Franks's.
But I cannot process the element which does not have ID in an attribute.And I may do wrong processing.
Ok, what prevents you from adding the id attribute on the fly ?
|
|
|
|
|
Thank you for a reply.
The idea has bad affinity with a "the script" in my program.
But I considered another method.I have not made yet.
1. I surrounds the selection elements with a new element .
2. I may get the element collection from a new element(parent element)
3.the processing
4. delete only parent element.
Now, I am writting source.
|
|
|
|
|
I developed a ASP component which can create process,I want it run a program which will product some files,but the problem is the ASP component created process and didn't product files.
the code is follow:
STDMETHODIMP CWebExam::CompileFile()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
"e:\\web2\\exam\\cl.exe /Fee:\\web2\\exam\\ /Foe:\\web2\\exam\\ e:\\web2\\exam\\test2.cpp", // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
"e:\\web2\\exam\\", // Use self starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
error=1;
//MessageBox(NULL,"create process wrong",NULL,MB_OK);
}
else
{
error=0;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return S_OK;
}
|
|
|
|
|
Difficult to say, but I would check the rights - because I think that the process running under the IIS web account (this IUSR_xxx), so it might be that it have no rights to create a file or do any other action.
If it runs when started normally (under your account), it will probably be some rights problem.
|
|
|
|
|
sorry!I think I didn't write the problem clearly!
In this component ,I have a property named "Eror",it will return a value which points out the process is created or not.
To test this component ,I set the IIS web account as administrator,also I create a asp page,created the component,run the method,after this,I checked the "Error"'s value ,to my superise,I found it created a process successed. but it didn't product any outfiles.
I doubt that it maybe has something to do with the environment of the process running.
Thank your reply!
|
|
|
|
|
I have been using an ActiveX control for controlling the printing of some specific pages. I followed the examples of msdn and how they use print templates and printing programmatically... but now I have one major problem that i cannot seem to fix.
I have provided a print, and preview button in the page to invoke my control's own printing, but when the user selects print from the file menu or ctrl+p, internet explorer does its own printing. What I wanted to do is that my control should take over all printing operations so long as the user is viewing that report.
I know this is possible because ScriptX has an event called user_print and user_preview and I wanted to know how such an event could be achieved.
The ideas that I had so far are the following:
1. CBT Hooking
2. Capture the necesary events from a pointer to WebBrowser2
3. Using Javascript, capture onbeforeprint and use my own
But the above 3 things all didnt work out in my experience, first, the CBT Hooking didnt exactly allow me to drill down into the webbrowser instance, it did however, allow me to capture the print dialog and replace the action of the OK button. But what about when the user presses the print icon in IE. Also, what about when the user presses the print icon from the preview window. The javascript event doesnt cancel so if I just call my own print function when that event is called, it goes into an infinite recursion and a stack overflow and it causes internet explorer to be terminated. The second one is the only one that still might have any hope. I just dont know enough about COM/ATL to be able to capture events from an interface.
So to wrap it up, I have 2 functions in the activex, Print, Preview, and PrintNoPrompt
Print first shows the print dialog and prints
Preview just previews the page
PrintNoPrompt just prints the page without showing the prompt
I was wondering if there was a way to do the following:
First, Redirect CTRL+P, File->Print, Rightclick->Print to my Print function. Second, Redirect File->Preview and Print Preview icon on toolbar to my Preview function. And finally, Redirect Print icon on toolbar to my PrintNoPrompt function.
If anyone can help me figure this out, it will be greatly appreciated.
MoMad the NoMad
|
|
|
|
|
OK to rephrase this question:
How do I sink WebBrowser events from an activeX Control inside the webbrowser?
MoMad the NoMad
|
|
|
|
|
I am not sure what exactly are you asking....
My guess would be to implement interface OleCommandTarget on COleControlSite, make your own Exec and check for nCmdID == OLECMDID_PRINTPREVIEW || ...
|
|
|
|
|
I want to know how to intercept internet explorer events such as menu item click or clicking on a toolbar item, or pressing a hot key like ctrl+p.
MoMad the NoMad
|
|
|
|
|
Can COM interface pointers be used as reliable identities?
Please consider this out-of-proc scenario:
'VB Code
obj.MethodCall aCOMObject
...
obj.MethodCall aCOMObject
obj.MethodCall aCOMObject results in a call to my C++ method:
STDMETHODIMP CClass::MethodCall(IInterface* pIf)
{
...
}
My question is now; will the pointer pIf always contain the same value in all calls from the client (in this case VB)? Can I use this interface pointer to uniquely identify the object no matter what type of client is calling? Is this perhaps controlled by the MIDL interface attribute pointer_default ?
I know it'll work in an in-proc C++ only scenario, but I cannot guarantee that this will always be the case.
--
we dance to the sound of sirens
and we watch genocide to relax
we dance to the sound of sirens
we are the heroes of self-deception
|
|
|
|
|
I think, that if you will receive the calls from the same object in the same thread, you have to receive the same value.
But as long as you cannot guarantee that this will be always your case, I will not rely on such a mechanism, as it could bring lot of weird problems.
|
|
|
|
|
All,
I'm looking to build a plug in architecture where individuals can create VB ActiveX DLLs to be used by my application. I have seen this done with products like ViewStar. The catch is, to maximize performance, I'd like to be able to use the vTable of the ActiveX DLL.
So, I'd like to have the following:
The VB ActiveX DLL would have a specific interface. For example, the following Methods:
Function ApplicationStart(...)
Function ApplicationClose(...)
How do I call the methods via the vTable from my Visual C++ application?
I would appreciate any help.
Thanks,
Rich
|
|
|
|