|
Hi,
I have a java application. It communicates with a VC dll, using JNI. This dll launches IE, using CoCreateInstance(). When I aceess the IWebBrowser2 pointer, I have received from CoCreateInstance(), it works fine for the first time. But when I try to access it (for invoking navigate2()), I get an error with code 0 (ERROR_SUCCESS). Can you tell me what is wrong? What is the meaning of ERROR_SUCCESS? Am I missing any initialization? Is some method needs to be called in every JNI method? Is this happening because the launched browser is a separate process, something outside the scope of a JVM?
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_ALL, IID_IWebBrowser2, (void**)&m_spBrowser);
- Nikhil
|
|
|
|
|
you should take a look at http://www.microsoft.com/com/resources/comdocs.asp
you'll find there micrososft's com specifications. It will take a few hours to read, but if you are not very confident with com initialization, allocation techniques, common client / server implementations, etc, you will find that very useful.
As for your specific question: be sure to use CoInitialize / uninitialize when loading/unloading com.
Also, note that any memory passed thru com interfaces must be allocated and freed using com specific mechanism (like ComTaskMemAlloc), and certain rules for doing this apply. (depending on the type of the variable: in, out, in/out, etc).
Another thing to keep in mind is that all strings passing thru Com interfaces are Unicode strigs (aka OLESTR, array of unsigned chars).
Are you using the internetexplorer with / without graphical interface ? (background or as an activex control in your user interface ?).
It seems to me that you are not using the user interface, case in witch you should stick with MSHTML only, and use url monikers to load web pages for parsing and other tasks.
Please post more of your code and/or some more details to help us figure out what's wrong with the picture.
Angel
|
|
|
|
|
// firstly define interface
IEnumString* pEnumStr;
...
|
|
|
|
|
Hi
I have a ATL COM Object derived from IDispatch.When i create this object i need to attach a windows handle to this object so that i can handle windows messages.
Pls help.I will be grateful if anybody helps me with sampl code or links.
Thnks in advace
Ram
|
|
|
|
|
Hello cberam,
I'm not sure what is the difficulty you are facing. You can certainly obtain the windows handle via a parameter of a method.
Once you have a valid Windows Handle, you can use the Get/SetWindowLong() APIs (with GWL_WNDPROC as the 2nd parameter) to hook its window procedure.
The most important part of this system is that the ATL COM Object must be housed inside a DLL. This is because your windows procedure must reside in the same executable module as the Window Handle.
Does the above help ? If so, I'll see if I can spare some time to write some startup code for you.
Best Regards,
Bio.
|
|
|
|
|
In your question, you said: ATL COM Object derived from IDispatch but if you plan to attach a window handle to this object, you should consider a FULL ActiveX control. You can then use: Project->Add To Project->Components and Controls to insert an MFC wrapper class for your control. If you can't, maybe source code is not available or whatever the other reason. You may write it yourself...
class CMyWindowWrapper : public CWnd
{
public:
void CreateObject() { m_pYourOjbect.CreateInstance(__uuidof(IYourObject)); }
void MyWrapper_Method1() { m_pYourObject->Method1(); }
void MyWrapper_Method2(BSTR text) { m_pYourObject->Method2(text); }
protected:
CComPtr<IYourObject> m_pYourObject;
};
ÿFor the bread of God is he who comes down from heaven and gives life to the world. - John 6:33
|
|
|
|
|
this is a reminder especially for STEVE S, perhaps he didn't notice
my lasts posts in the thread
"programming autocad : GetAttributes"
12:29 12 Aug '03
JPG
|
|
|
|
|
Hi,
I have a VC++(console)/ATL Script host app in which i create COM objects(say for Buttons) dynamically .I like to handle events for these Objects.Will it be possible for to handle events using IConnectionPoint/Sinks ?. Or this is possible only for in case of MFC app.Pls help me.Should i need to migrate from Console to MFC?
Thnks
Ram
|
|
|
|
|
Hello cberam,
>> Will it be possible for to handle events using IConnectionPoint/Sinks ?.
Yes.
>> Or this is possible only for in case of MFC app.Pls help me.
>> Should i need to migrate from Console to MFC?
No need, cberam. Just use the normal connection point/sink mechanism.
Regards,
Bio.
|
|
|
|
|
There is a substantial number of ActiveX controls implementing graph/chart.
All of them are "output" controls, i.e. they draw graph using data from
a client application.
But I'm now interested in an "input" control, i.e. control allowing user
to draw a graph (by creating/deleting/moving points) and providing this
user input to the clien application.
Does such stuff exist and how can I get it?
I suspect that some of "output" graph controls may be "input" controls
as well, but up to now I failed to find such.
|
|
|
|
|
Hi Dears
I want to develop a MS Word Addin. The main functionality of this addin is:
--> I have to convert a MS Word file (.doc) into (.pdf) file format.
What should I take as first step to implement this functionality.
Kindly guide/help me in the form of some code/link.
I'll be grateful to you.
Kind Regards
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
The PDF writer (a virtual printer which is part of the Adobe product line) does exactly this. It installs itself like any other printer driver and thus appears when you print a word document (and in fact any other document from any other application with printing capabilities).
RSS feed
|
|
|
|
|
Hello all,
I'm a C++/MFC programmer and I want to lurn how to build COM applications,
How to create and use COM objects, How to... .
How is the best way to do it
Thanks
Carlos Mariano
|
|
|
|
|
I recommend Developer's Workshop to COM and ATL 3.0 by Andrew Troelsen.
Kuphryn
|
|
|
|
|
Today is my first day of work, my vacations gone. Yes I must start to read something.
Thanks for your answer.
Carlos Mariano
|
|
|
|
|
Reading "Inside COM" by Dale Rogerson is a good way to start.
|
|
|
|
|
Today is my first day of work, my vacations gone. Yes I must start to read something.
Thanks for your answer.
Carlos Mariano
|
|
|
|
|
Hi all
Recent time ago i ask this question on other forum but don’t get explicit decision.
Matter of question is can I pass some pointers on COM object through another method of other COM object.
I.e.
Suppose I have
CoObjectInner – internal object which will be created another object , for handle CoObjectOuter.
CoObjectOuter, which have interface IObjectOuter and this interface has GetInnerObject([out,retval]CoObjectInner** pVal) method which retrieved pointer on internal object.
Formerly on this question I get suggestion that this not way of COM passed pointers on object through methods of an interfaces, and this may raised a lot of trouble, but when I use code like this fashion in my application all work fine. Moreover in any Microsoft Office applications (for instance Word) object model used methods what make same things. And if not use this way in COM then we can’t use hierarchy model, i.e. we can’t
pass internal object through outer, of cause it is possible expose a pointers to a interface of inner object but if inner object contained outbound interfaces then how we can use it in Visual Basic ???
So that VB can catch some events of an COM object necessary defined one with WithEvents word. Although we can declare COM object with WithEvents specification
But we can’t create its object because of this is internal object (we cant create it use new keyword) and also we cant create it within object library and expose one to client. Ultimately we can create outbound interface for outer object and charge to raise all events from internal object through one.
But its more complicated. Where is escape here???
Thought above actually regardless in order to typed so much , but major thing it is –“ why I can’t do this, although other do this???”
And more utilized question on this time.
I create ATL composed control in Visual C++ 6
All work fine but when I placed one on my MFC dialog box (in design mode) then this control appear not properly – simple grew rectangle, but when I run my application when this control view properly.
Thanks if you read this rave from the end.
And maybe some one give to me explicit decision of this trouble??
Sorry for bad eanglish.
|
|
|
|
|
Don't know where to post this because a whole bunch of stuff comes into play here.
First of all, I have a program that is in MFC that calls an MFC extension DLL (with UI components) which in turn calls another DLL to interface to Outlook using low level COM to access the MAPI information. I am using the restrict method to search for appointments for the next year, and I want to include recurring appointments. However, it only returns non-recurring appointments. I am also seeding the Outlook search with the sort property set for ascending, and the includerecurrences property set to true.
[edit]
I just checked the source code for the program that is working and it is a little different than I thought. Outlook calls an MFC DLL from it's Import/Export dialog which loads all the data, then calls an EXE to show data to select.
[/edit]
Here's where it gets interesting. We have an older application that is run directly from Outlook's file export function (it shows up in the list). This application is an MFC exectuable that calls a separate DLL (which is not an AFXDLL). The strange thing is that the restrict method gives me back all of the appointments (recurring and non-recurring).
Does anyone have any clue about what's going on? I checked my project settings, and aside from the DLL definitions, everything is the same...optimizations, files to link in, etc.
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
Hi,
I created a simple MFC dialog application and added a custom interface to the application via the wizard. I also included the typelib in the .rc file. This all seems to be rather easy, but when I try to query the interface of the COM object in a client application, the hresult is 0x80004002.
I registered the application and when I lookup the the coclass and typelib in the OLE/COM object Viewer, I can find both of them but the interface I cannot find. So it seems the interface is not registered (I also cannot find the IID in the registry).
Is the interface not always automatically registered when the typelib is registered? The application does not seem to have a proxy/stub makefile, so I also can not nmake that and register it.
Any one know what the cause of this problem is?
|
|
|
|
|
If your interface IDL looks like
[ uuid(7F24AABF-C822-4c18-9432-21433208F4DC) ]
interface ICOMServer : IUnknown
{
HRESULT Name([out, retval] BSTR* objectname);
}
Then make sure to add the oleautomation attribute to it so the interface gets registered. And of course, make sure to include the interface declaration within the library scope in the IDL file.
library LibCOMServer
{
...
[ uuid(7F24AABF-C822-4c18-9432-21433208F4DC),
oleautomation
] interface ICOMServer : IUnknown
{
HRESULT Name([out, retval] BSTR* objectname);
}
...
}
RSS feed
|
|
|
|
|
i am new to directx.
i want to use directx to capture screen , could you give me some examples (visual c++) or suggestions about this?
any hints will be helpful
thx
includeh10
|
|
|
|
|
I need to list the attributes of an autocad block reference :
_variant_t arrayAttrib; // array of AttributeRef objects
IAcadAttributeReferencePtr pAttribRef = NULL;
long lbound, ubound;
HRESULT result;
arrayAttrib = pAcadBlockRef->GetAttributes();
SafeArrayGetLBound(arrayAttrib.parray, 1, &lbound);
SafeArrayGetUBound(arrayAttrib.parray, 1, &ubound);
for (long i = lbound; i <= ubound; i++)
{
result = SafeArrayGetElement(arrayAttrib.parray, &i, pAttribRef);
...
}
GetAttributes() works : i get an array of attributes in a variant;
but SafeArrayGetElement return error code and pAttribRef is not initialized.
JPG
|
|
|
|
|
And the HRESULT is....
Steve S
|
|
|
|
|
IAcadAttributeReferencePtr pAttribRef = NULL;
...
result = SafeArrayGetElement(arrayAttrib.parray, &i, pAttribRef);
result = E_INVALIDARG : one of the arguments is invalid.
Of course the invalid argument must be pAttribRef, but i have no
idea of the way to persuade SafeArrayGetElement to put what i want
in this argument ...
I have already used SafeArrayGetElement to extract simple values
(int, char buffer, ...), but not a com object.
Perhaps my IAcadAttributeReferencePtr is 'hidden' in a variant ?
I try this :
_variant_t val;
result = SafeArrayGetElement(arrayAttrib.parray, &i, &val); // --> result = S_OK
but when looking inside this variant, I have no clue to extract what i want.
Autocad documentation gives only examples in VBA, where all seems so simple...
thank you for your help
|
|
|
|