|
Hi,
I am looking to implement/access these interfaces from either C++ or VB, but I am having trouble finding much detailed information about them.
Does anybody have a good starting point on these interfaces, sample code for implementing and exporting them from a C++ COM DLL or accessing and using them from within VB.
any help much appreciated
cheers
Michael
mpine@pegasussoftware.com.au
|
|
|
|
|
Are you looking for more information about ISyncMgrRegister or more information about implementing interfaces in C++ and VB?
PeterRitchie.com
|
|
|
|
|
I've successfully implemented AxWebBrowser in a windows form and it works fine.
Except the little flaw when client code pops up a window.
The new window does not seem to have access to the same session or cookies.
But if I log in to the same site from IE the same time, the popup from my form works fine.
Any ideas how to solve this behaviour?
|
|
|
|
|
How are you popping up the window?
You can "popup" a window by telling your application to run IE (or whatever browser is the default) when opening the link; which will start the popup in a completely different context. If that's the case you need to popup the window in your application, not the default browser.
PeterRitchie.com
|
|
|
|
|
As far as I understood overloading with COM/AchtiveX-Components is not possible, i.e. you cannot have a component, that exposes overloaded methods like a C++ class. Something like
mycomponent::mymethod(long lVal)
mycomponent::mymethod(double dVal)
would not work. Am I right?
Now I'm wondering if the "Union" type in MIDL could be a solution to build an interface to pass for example exactly two well defined types (e.g. long and double) as a parameter to a method.
Of course I could use a variant as parameter and check inside the method if the passed parameters are of the types I wanted, but that would be some kind of late binding that would be checked at run time. If it was possible to pass some union, checks for right types would be done at compile time (early binding).
So, who can give me an example of how to handle union datatypes with automation COM components and what the interface should look like?
|
|
|
|
|
Automation generally implies you are supporting non C++ clients. Once you move beyond C++ clients, VB is by far the next most sophisticated consumer of COM objects. VB cannot use UNION types (other than the special case of a VARIANT type) and neither can any other type of Automation client (i.e. scripting languages). No point in creating an interface that no Automation clients can use.
You could create two methods, or you could pass both parameters as Optional.
Robert
|
|
|
|
|
Hi, Can somebody give me a sample or pointer on how to establish a virtual com port for Bluetooth USB dongle?
Thanks in adavance.
TW
|
|
|
|
|
|
I'm integrating a newly created COM component into an existing GUI. When the program returns from the following implicit call, the PIUnknown pointer gets set to zero and the program subsequently fails. I have no clue what's happening and I can't step into the function to see. Any Ideas would be greatly appreciated.
mark
|
|
|
|
|
MDowning wrote:
I'm integrating a newly created COM component into an existing GUI. When the program returns from the following implicit call, the PIUnknown pointer gets set to zero and the program subsequently fails. I have no clue what's happening and I can't step into the function to see. Any Ideas would be greatly appreciated.
Here is the function call:
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));
thanks, mark
|
|
|
|
|
Shouldn't that be:
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));
or did you not turn off HTML tags?
Have you verified that your pointer to the outer object is valid?
Robert
|
|
|
|
|
So what's the value of hr ? CoCreateInstance reports the reason for a failure.
You do occasionally get badly-implemented COM components which return a success code when asked for their primary interface, but fail (returning E_NOINTERFACE ) when asked for IUnknown . This is of course an implementation error - all components must implement IUnknown .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Are you calling CoInitialize(NULL)?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Hello,
i try to use late binding for office automation with powerpoint and c#.
I found some examples for word which work fine:
<br />
Type comType;<br />
object comObject;<br />
<br />
comType = Type.GetTypeFromProgID("Word.Application"); <br />
comObject = Activator.CreateInstance(comType);<br />
<br />
object o = comType.InvokeMember("Application", BindingFlags.Public | BindingFlags.GetProperty, null, oPptAppObject, null);<br />
...<br />
...<br />
So far everything works fine. The Compiler is happy
But when i replace the ...("Word.Application")... with ...("PowerPoint.Application")...
i get an exception (which says: unknown name) for line with:
object o = comType.InvokeMember.....
Also "Application" is a Member of PowerPoint, like it is in Word.
I also tried other Members from PowerPoint but was not lucky.
I googled the whole day, but no solution.
Can anybody help me please?
It have no idea what to do.
Thanks a lot!
|
|
|
|
|
"Word.Application" is the ProgID, it doesn't mean access the "Application" member of "Word".
I don't have PowerPoint installed on my computer, just the Viewer. I would use "PowerPointView.Application" to instansiate the viewer.
Do you have PowerPoint installed on your computer?
PeterRitchie.com
|
|
|
|
|
In *.idl file:
interface Ixxxx : IDispatch
{
[id(1), helpstring("method GetData")] HRESULT GetData(LPCTSTR Key, DWORD *Data);
[id(2), helpstring("method SetData")] HRESULT SetData(LPCTSTR Key, const DWORD Data);
}; Both these methods generate warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'Key' of Procedure 'GetData' ( Interface 'Ixxxx') ]. Other than these warnings the interface seems to run correctly. Is it something I have to worry about or can I safely ignore them. If I have to worry about it, how do I go about fixing it? All MSDN says is make sure the interface is derived from IUnknown or IDispatch.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Classes marked as "dual" have implied oleautomation attribute.
The oleautomation attribute simply means that the interface is compatible with older versions of Visual Basic, VBScript, JavaScript, etc. (i.e. untyped scripting languages).
If you don't need your interface to be compatible with any of those, then you can ignore the warning.
If you need to be compatible, you can get rid of the error by replaycing LPCTSTR with BSTR.
PeterRitchie.com
|
|
|
|
|
Thanks, I don't need them to be compatible (so far ) but I hate getting warnings in my code, makes me nervous that I am doing something wrong. I changed the LPCTSTR s to const BSTR s and all is well.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
How Can I catch Key Event When I have focus on Webbrowser object in my application?There are a lot of articles about context menu etc, but no one has said anything about catching Key Event. Is there some solution by using some API or?
|
|
|
|
|
Hi BorisKco,
You encounter to the infamous problem with WebBrowser control.
There r some work arounds for this problem.
BTW, wht r u exactally looking at ?
Cheers,
Vishal
|
|
|
|
|
I have solved the problem already. But, thanks anyway.
Boris
|
|
|
|
|
requirements minimum to install an application developed in C #using COM+ [. NET] in a computer with WIN98?
lang
|
|
|
|
|
hello..
I have finished an application developed in C #using COM+ and I have the following errror:
at System.EnterpriseServices.ServicedComponentProxy.CleanupQueues(Boolean bGit)
at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type serverType, Object[] props, Boolean bNewObj)
at WinInterface.Login.btnAceptar_Click(Object sender, EventArgs e)
The type initializer for "System.EnterpriseServices.ServicedComponentProxy" threw an exception.
The application has been created in WINXP and will settle in WIN98SE.
Code Sample ... All BusinessLogic.
[Guid("35D02EB6-BC99-4c57-8078-1CF58CFE1FE7"),
JustInTimeActivation(),
Synchronization(SynchronizationOption.Required),
Transaction(TransactionOption.Required)]
public class ClienteBL : ServicedComponent
Help me ... please
lang
|
|
|
|
|
I have a minimal C# project with a form containing a AxSHDocVw.AxWebBrowser. The project also contains a UserControl that has been given a GUID to act as an ActiveX-compnent. The UserControl has its backgroup color set (yellow) but besides that it does "nothing".
During execution the HTML code: "<html><body><object classid=\"clsid:#GUID#\"></object></body></html>"
is loaded into the AxWebBrowser and the yellow UserControl is shown.
The problem occurs after Dispose. When the form is closed it's Dispose method is called and the application freezes.
The stack trace tells me that the execution has stopped in system.windows.forms.dll!System.Windows.Forms.Control.ActiveXImpl.SetClientSite
If I explicitly call AxWebBrowser.Dispose() the application freezes at that line of code.
If I omit the ActiveX from the HTML the problem does not occur.
Any suggestions?
Thanks in advance
/Dan
|
|
|
|
|
I am using an IHTMLDocument class to sent text information to the printer in HTML format. One problem I have encountered is that I want to send many HTML documents in one go. There is no HTML tag for "page break" so I must send each document as a different print job. If I'm doing this the print dialog box will be thrown up 20 times (being a real pain for the user).
I know that the flag PRINT_DONTBOTHERUSER can be set to stop the dialog being activated but there is next to no info on Google and MSDN is really unhelpful. Has anyone with experience in COM done this before? Is there any example code you could demonstrate?
For info, here is the code I am using to perform the print job:
// includes for COM stuff
#include <comdef.h>
#include <mshtml.h>
#pragma warning(disable : 4146) // see Q231931 - MSDN
#import <mshtml.tlb> no_auto_exclude
// end of COM stuff
......
bool CSomeClass::PrintHTMLNotes(void)
{
// get IHTMLDocument handle
MSHTML::IHTMLDocument2Ptr pDoc;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2, (void**)&pDoc);
if (pDoc==NULL)
return false;
// convert string to safearray
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT,0,1);
VARIANT *param;
hr = SafeArrayAccessData(psa,(LPVOID*)¶m);
param->vt = VT_BSTR;
SAFEARRAY* psaIn = SafeArrayCreateVector(VT_VARIANT,0,1);
VARIANT *pvaIn;
hr = SafeArrayAccessData(psaIn,(LPVOID*)&pvaIn);
pvaIn->vt = VT_ARRAY;
pvaIn->iVal = PRINT_DONTBOTHERUSER;
// write data to document
bstr_t bsData;
for (int i=0; i<m_ncurrentnote; i++)
="" {
="" bsdata="m_csaNotes[i];
" param-="">bstrVal = (BSTR)bsData;
hr = pDoc->write(psa); // write buffer
}
hr = pDoc->close(); // close document (applys code)
SafeArrayDestroy(psa); // clean up
// print the file
CComQIPtr<iolecommandtarget> spTarget = pDoc;
if (spTarget != NULL)
spTarget->Exec(NULL, OLECMDID_PRINT, 0, pvaIn, NULL);
else
return false;
return true;
}
|
|
|
|