|
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
|
|
|
|
|
Hi.
I have a whole bunch of DLLs on a server and I want to trace the CreateObject calls within the DLL classes so I can see how things are linked together.
I know that the whole concept of compiled DLLs is to encapsulate the implementation. However, is there a way to efficiently and accurate trace through these DLLs?
|
|
|
|
|
I have a COM+ component. Until now i have only clients hosted into the same computer like my business component.
Now is needed to have clients on other computers, over the net, who must access data from my COM+ component.
The way is to deploy a DCOM component and make calls from clients to that DCOM.
But i dont want to copy the code from my COM+ component into the new DCOM component.
I know is possible to make a com to be like an exe DCOM, but i dont know how... Know somebody how ?
Adrian Bacaianu
|
|
|
|
|
Since this is a COM+ component, you can instantiate it remotely too. You don't have to write a new DCOM server - thank God! (How would you provide all COM+ services in the DCOM server after all? rewrite them?)
Just call (from VB/VBScript)
Set obj = CreateObject(ProgID, Remote server name)
and you' ll get a remote instance of your component.
For C++ code, CoCreateInstanceEx will do the trick.
For DCOM to work, you need ports 135 & 1024-65535 open between your machines.
Hope I helped.
|
|
|
|
|
Yes, was working, many thanks!
The speed isnt so good but that it is...
Adrian Bacaianu
|
|
|
|
|
I have two classes, classA and classB.
Both these classes have got only pure virtual functions and nothing else.
But ClassA has got aggregation relationship with classB. For more clarity let us say, classA contains classB.
My question: whether classA can be treated as a COM compatible inteface.
Here my question is, whether this aggregation relationship does effect this ClassA not to be tratred as an Interface, as per COM spesification.
My requirement is that, when I create an object (component)of classA
say ObjA.
ObjA should also contain an object of classB say ObjB.
So that when ever I call a method on objA, it should be possible to delegate
or forward this call to objeB.
Thanks in advance for clarification.
Regards
Hara
Hara
|
|
|
|
|
Why OLECHAR* maps to 'ref ushort' in c#?
And how do I pass strings.
Do I have to declare array: ushort[] arr = new ushort[100] fill with ascii codes and supply
'ref arr[0]'
I'm having problems with the following function:
IMarkupPointer::Right(BOOL fMove, MARKUP_CONTEXT_TYPE* pContext, IHTMLElement** ppElement, long* pcch, OLECHAR* pchText);
Please help
|
|
|
|
|
Everything works fine with ushort array , I wish there were some easy convertion between array of uchar and string
|
|
|
|