|
Hi there,
I have an addin to ms Word written in visual c++ implementing the IDTExtensibility2 interface.
I sink events properly and launch my functions...
My question is..how can I call those functions from a different c++ project?(that should be possible)need I to register them as word native functions, can I use messages to call them?...
thanks and happy codding
AB.
|
|
|
|
|
I am beginner in COM.
I have come across a InvokeHelper Function.Most of them contain the syntax as follows
InvokeHelper(0x1f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, NULL);
I understood the rest of the parameters except for the first one.
The MSDN says it identifies the method.I would like to know how to check the what that hexadecimal number(the 1st parameter) refers to??
is it method name translated to hexadecimal form??
I mean how to check which number refers to which control??
Any Kind of Help Would Be Highly Appreciated
|
|
|
|
|
Look for the function number in your component's idl, if its written by yourself,
or in the typelib of the component.
interface IMySecurity : IDispatch<br />
{<br />
[id(1), helpstring("First function.")] <br />
HRESULT First();<br />
[id(2), helpstring("Second function.")] <br />
HRESULT Second();<br />
};
The numbers are the ids.
|
|
|
|
|
I created win application with comboBox1, axAcroPDF1, button1.
The code looks like this:
…Button1_Click()…
{
if(comboBox1.Text =="myfile1.pdf")
{
axAcroPDF1.LoadFile(@"\myfile1.pdf");
axAcroPDF1.Show();
}
else if(comboBox1.Text =="myfile2.pdf"))
{
axAcroPDF1.LoadFile(@"\myfile2.pdf");
axAcroPDF1.Show();
}
}
It displayed "myfile1.pdf" when I chose "myfile1.pdf" from comboBox1 and pressed the button but gave me the error when I tried to display "myfile2.pdf". Does anybody know how to fix this problem?
Thanks
|
|
|
|
|
I fixed it. It was easy.
|
|
|
|
|
Did anyone tried event handling on activex controls from Grid present on property sheet provided by MFC ActiveX control wizard.
If yes can anyone let me how can this be done
from
ashwin kumar
|
|
|
|
|
Did anyone tried event handling on activex controls from Grid present on property sheet provided by MFC ActiveX control wizard.
If yes can anyone let me how can this be done
|
|
|
|
|
Hai..
I am extracting the data from the various webpages using com interface IHTMLDocument, IHTMLElement and some other. If any utf-8 occurs in the webpage i am getting the data in ????? symbols. I am building my application with UNICODE. How to solve this bug.
Thanks,
Veera Raghavendra
|
|
|
|
|
hi folks;)
I need to put a struct (in which i have another struct...) into a VARIANT to pass it between DCOM client and server methods.
I would like to avoid custom marshaling (i've never done it and the customer is getting angry... so I have no time to spend on it...).
How can I do?
Thanks in advance!
Morenz
|
|
|
|
|
|
Hi,
First of all, thanks for your prompt reply!
Well, I can say that in 3 sheets of paper there's the informations I searched for days!
Only one thing, SafeArrayCreateEx function and VT_RECORD vartype are not declared in my Visual Studio 6. Can I get access to them installing service packs?
Many thanks, you're great!
Hope can help you back in future,
bye for now,
Morenz
|
|
|
|
|
They are declared in my installation of Visual Studio 6. I'm using SP5. The easiest way to find out your service pack level is to launch Visual Basic, since the service pack number is included in the splash screen graphic.
Download service packs from here[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Many thanks.
My problem was that I did not know if that new function was implemented in a later service pack or other stuff. Telling me that you have that function in your SP5 resolved me the problem, so I'm installing SP6 (that I had in the past, on the other computer).
OK, let's implement those final functions and make the customer happy!
Thanks to everyone again!
Morenz
|
|
|
|
|
Hello again...
it was too good to be real....
I used what that HOWTO said (implementing a struct into my IDL file, giving it a UUID and managing it with VARIANTs).
Now, I got a problem.
If I write in IDL
typedef [uuid(...)]
struct myStruct
{
...
...
...
}my;
, when I compile my project, MIDL is OK, but I get C2787 when compiling: no GUID has been associated with this object.
I tried to use, in IDL,
[uuid(....)]
struct myStruct
{
...
...
..
}my;
and now I get MIDL2072: inapplicable attribute: [uuid][Struct 'myStruct']
How can I get it compiled?
I'm going crazy!
thanx again!
-- modified at 6:37 Friday 30th September, 2005
|
|
|
|
|
OK OK OK , I got the problem. I think.
Probably I need February 2003 Platform SDK (the last one released for VS 6.0).
I tried to compile that code with VS.NET 2002 and it worked.
Now the problem is to get that SDK, that is not downloadable anymore from Microsoft website...
I will search, in worst case I will order the CD....
Bye
|
|
|
|
|
If you've written both client and server (and so can control alignment and other compile-time issues), you could create a common header file for both applications that contains the struct definition and then embed the data as a byte stream (VT_UI1|VT_ARRAY) in a VARIANT and pass that over (D)COM. I've used that method successfully in the past and its reasonably flexible.
|
|
|
|
|
Hi!
What you're saying is to brutally force custom serialization
This should be a good method, but how can I declare my safearray dimension? With sizeof()? I've got some structs that has inside an array of another struct....
Thanks again...
|
|
|
|
|
Yes, use sizeof(YourStruct). If you have embedded structs, you're going to have to be more creative e.g.
sizeof(YourStruct) + (sizeof(YourEmbeddedStruct) * NumberOfEmbeddedStructs)
etc.
It can get tricky if your structs contain "variable" data, such as strings. In the past, I've either defined the maximum size of the string (and therefore constrained the array inside the struct definition) or I've added a counter then a pointer, e.g.
...
unsigned long ByteCount;
unsigned char* pByteData;
};
The count tells the caller how big the variable data is. Hope that helps.
|
|
|
|
|
Why do that, when you can define the structure in IDL?
--
Look straight into the light!
|
|
|
|
|
Yep, that's perfectly valid (and arguably the "right" way) but then you have an extra step of publishing the interface and managing proxy stubs. My way keeps things simple and flexible.
|
|
|
|
|
Because my structs contain, in some cases, arrays, that have to be defined as SAFEARRAYS.
In any case, I implemented this way... I will debug the application when I will resolve my new problems (It's since a month that, when I manage to resolve a strange problem, there comes in another problem, even stranger, if possible! )
If you're curious, look above....
Thanks again,
Morenz
|
|
|
|
|
Hi,
I'm a newbie in COM development. I need to open a file of a particular format,other the ones supported by IE like .doc,.txt,.PDF etc, in the IE.
e.g. if the file is say, a.x, of a particular format, the "Open With : IE" will open the file in the IE browser window, much like the case of .pdf file.
I browsed a lot, such as, BHO etc. but could not find a proper solution.
So, I need this very urgently....
Regards,
babai.
-- modified at 12:37 Thursday 29th September, 2005
|
|
|
|
|
I have a COM object that throws an event with a collection of others COM objects. I’m not sure about the way I have to do it. The code I have implemented is like....
ICollection * pInterfaceCollection;<br />
CCollection * pCollection = new CCollection (<COM objects array>);<br />
pCollection->QueryInterface(IID_ICollection, (void**) &pInterfaceCollection);<br />
pInterfaceCollection->Release();<br />
<br />
result = Fire_OnColletionItems(pInterfaceCollection);<br />
if(FAILED(result))<br />
{<br />
... <br />
}
The problem here is that I have memory leaks. I fire the event, the client (an VB application) manages it, I shut down the client, and then I shut down my application (the server)... and there they are. I thought that the client was who release the object so I shouldn’t do it. How should I to do this?
Thank you in advance.
PD: sorry for my english
-- modified at 13:54 Tuesday 27th September, 2005
|
|
|
|
|
I'm working on an object that crosses two systems (one system uses standard CPropertyPages for all its objects, the other uses COM/ATL IPropertyPageImpl<t>)
The standard system objects simply create a property sheet and invoke DoModal() while the other uses OleCreatePropertyFrame() for its pages.
How do you launch a mixed collection of both systems? (CPropertyPages with COM/ATL ones)
Thanks in advance for advice!
|
|
|
|
|
DolphLundgren wrote:
How do you launch a mixed collection of both systems? (CPropertyPages with COM/ATL ones)
I don't know exactly how CPropertyPages work, so maybe what I'm about to suggest is just not doable. If so, then I appologize.
I suppose you could inherit a new class from CPropertyPage, in which you host the COM property page, and mediates between the COM interfaces (IPropertyPage and IPropertyPageSite) and the CPropertyPage interface.
What you need to think about when creating the COM property page is:
* Your class based on CPropertyPage must implement IPropertyPageSite
* After you've created the IPropertyPage object, call SetPageSite(this)
* Give the COM object to the prop page object by using SetObjects()
* Then call Activate(m_hWnd, rcTheRectangle, FALSE)
* Followed by Show(SW_SHOW) (I think this is necessary - I don't remember - you'll notice)
IPropertyPageSite is straightforward to implement. Please refer to the MSDN docs.
Call the prop page object's Apply() method when suitable (probably on some well defined OnApply()-event defined for CPropertyPage).
When you are closing down the CPropertyPage window, call the prop page object's Deactivate() method.
--
Keep talking! You're the fool, I'm the preacher.
|
|
|
|