|
Anyone knows what message ids com use for marshaling calls??
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
In a MS Word automating program, I want to get a ShapeRange from a Shapes object, which need a SafeArray parameter. I wrote the following code:
------------------------------------------
COleSafeArray sa;
DWORD bounds=1;
sa.Create(VT_VARIANT,1,&bounds);
COleVariant v_ind((long)1,VT_I4);
long ind=0;
sa.PutElement(&ind,&v_ind);
//sa.Detach();
CShapes shapes(doc.GetShapes());
CShapeRange sr(shapes.Range(sa));
-------------------------------------------
It just throws an exception saying that the parameter has an invalid value. If I Detach the array before passing it to the Range method, the array becomes empty. Another exception is thrown out saying that out of bound.
Anyone can tell me how can I get it right?
Thx
|
|
|
|
|
Don't know about Word automation, but maybe it expect different type of SAFEARRAY - now you are passing to him an array of VARIANT s of type VT_I4 , maybe he want's to accept only array of VT_I4 directly.
Or another possibility is, when I did something small with Word, he expected some number, but because it was optional, it had to be stored in VARIANT , so I feed him with VARIANT with VT_I4 , but it failed with 'Bad parameter'. After playing a bit I found, that the beest expect to be filled with type set to VT_I2 and suddenly everything worked...
Hope this helps.
|
|
|
|
|
Have I understood this correctly, you want to receive a SafeArray from your call to shapes.Range ()? And this SafeArray will be populated with ULONGS?
Have a look at Chris Sells' SAFEARRAY Wrapper class:
http://www.sellsbrothers.com/tools/comvector.h
You should use it like this, where Size is the number of elements you are expecting back:
<br />
CComVector<ULONG> v (Size);<br />
CComVectorData<ULONG> rg (v);<br />
SAFEARRAY* sa = 0;<br />
v.DetachTo (&sa);<br />
<br />
CShapes shapes(doc.GetShapes());<br />
CShapeRange sr(shapes.Range(sa));<br />
<br />
for (int i = 0; i < rg.Length (); i++)<br />
{<br />
DWORD Value = rg[i];<br />
}<br />
Hope this helps
Jon
|
|
|
|
|
Hi
How to detect, if EXE COM is running form other application via COM call?
I 'd like to disable running executable COM as standalone application.
Thx 4 hlp
|
|
|
|
|
Running COM objects are registered in the ROT (Running Object Table). To get the ROT, just use the GetRunningObjectTable(...) WIN32 API function.
|
|
|
|
|
What language are you using? If VB6 then:
>The App.StartMode property will tell you whether you are running in standalone mode
>You can disable stand-alone execution by setting the start mode option to "ActiveX Component" in the Component tab of the Project Properties.
>VB objects are not registered in the running object table unless you register them there.
|
|
|
|
|
I use C/C++ in the executable COM and in the client.
|
|
|
|
|
If EXE server starts by COM system, his command line contains the "Embedding" keyword.
OTOH, you can specify the necessary keyword(s) in .rgs file under "LocalServer32" key. E.g.
LocalServer32 = s '%MODULE% -Automation'
With best wishes,
Vita
|
|
|
|
|
I want to pass a SafeArray to a VB Client but I can't seem to get the right syntax for the IDL.
Can someone please help me.
Forever Developing
|
|
|
|
|
[attributes] LPSAFEARRAY *varname
|
|
|
|
|
I should have been more clear.
I want to pass the SafeArray pointer out to VB 6 in ATL 3.0.
I used to be able to do this with the following code.
foo(SAFEARRAY(long) *psa);
However the same thing in ATL 7.0 won't compile
NOTE: I am using an emedded idl VS.NET
//Actual code
#define _ATL_ATTRIBUTES 1
#include "stdafx.h"
#include "resource.h"
#include "atlbase.h"
#include "atlcom.h"
#include "oleauto.h"
#include "atlsafe.h"
#include "oaidl.h"
// The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you
[ module(dll,name="ATL7TEST")];
[object, dual, uuid(4D9BCA91-2F02-4cee-A589-2CC4D9821156)]
__interface IATL7TEST
{
HRESULT TestRaiseEvent();
};
[object,uuid("8D0F6D5E-DDC3-4371-BB08-49864F5DE356")]
__interface _IATL7EVENTS
{
HRESULT MyFirstEvent(SAFEARRAY(long*) *varname );
};
[coclass, uuid(EBAA6CB2-ED31-4e08-8DF8-068B2978C3F7),event_source(com)]
class TESTING :
public IATL7TEST
{
public:
__event __interface _IATL7EVENTS;
HRESULT TestRaiseEvent()
{
CComSafeArray<long> Test;
SAFEARRAY *psa;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 10;
psa = SafeArrayCreate(VT_INT, 1, rgsabound);
long test;
test = 1234;
LPSAFEARRAY lpsa;
lpsa = psa;
__raise MyFirstEvent(psa);
return S_OK;
}
};
//compilation errors
//v:\ATL7TEST\ATL7TEST.cpp(33): error C2061: syntax error : identifier 'tagSAFEARRAY'
//v:\ATL7TEST\ATL7TEST.cpp(33): error C2059: syntax error : ')'
//v:\ATL7TEST\ATL7TEST.cpp(33): error C2143: syntax error : missing ')' before ';'
Forever Developing
|
|
|
|
|
I am developing a COM dll that includes 3rd party dll in MFC 6.0. This 3rd party DLL reaches back into a java layer within itself via JNI(Java Native Interface). At my project level, I am getting
the following compile-time link time errors:
error LNK2001: unresolved external symbol "__declspec(dllimport) ?$S494@?1??IteratorClass@?$Iterator@VObservable@immaccs@@@util@@CAPAV_jclass@@XZ@4EA" (__imp_?$S494@?1??IteratorClass@?$Iterator@VObservable@immaccs@@@util@
@CAPAV_jclass@@XZ@4EA)
What is interesting is if I put the 3rd party stuff into a regular MFC exectuable project, the compile works fine. Projects are being compiled in release mode. Are there any known problems associated with a COM dll linking in another dll that has jni signatures in it?
Thank you for your time!
|
|
|
|
|
How do I connect to the interface of a component, without importing the type library (dont want to include header either) ? Is there anyway I can get the information from the registry, given the fact that I know the prototypes for the methods present in that interface ?
Basically, I want to access a new component without changing my client app. (Again, the new component's interface methods are known).
Thanks
<marquee>. . . Humans do it better . . .
|
|
|
|
|
Hello,
I'm an experienced programmer, but new to COM. I'd like to add a new option to the 'right-click' menu in internet explorer so rather than performing a 'save as' command I can send GIFs and JPEGs directly to an art program I've written. Is this possible? It seems possible, I just can't find the info I need.
thanks.
|
|
|
|
|
From Microsoft:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/wbcustomization.asp
|
|
|
|
|
I am trying to get access to DataGrid control placed on a Dialog box but without using MFC enviroment (since the code I have is designed this way), and I wondered why the ActiveX DataGrid placed on a Dialog breaks in the callback where WM_INITDIALOG is never called. I needed this because it is the only way I know of to then initialize the DataGrid control with my recordset object.
Any pointers or suggestions?
Thanks--
|
|
|
|
|
I have a task to do: I need to add virtual drive to the system that will display some virtual folders and files. Can somebody help me to start - how to create virtual drive?
Thank you in advance
Stas
|
|
|
|
|
I'm writing a com component that has two interfaces that derive from IDispatch. When I compiled the project I got the error:
error C2594: 'static_cast' : ambiguous conversions from 'class CExplorerBar *' to 'struct IDispatch *'. So I changed the COM_INTERFACE_ENTRY to COM_INTERFACE_ENTRY2, so I could specify the IDispatch. Now I have 1 error and 3 warning (I'll just post the error):
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1827) : error C2259: 'CComObject<class cexplorerbar="">' : cannot instantiate abstract class due to following members:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cexplorerbar=""> >::CreateInstance(void *,const struct _GUID
&,void ** )'.
Any ideas about what's going on?
Thanks.
Melinda.
|
|
|
|
|
You cannot inherit from two interfaces derived from IDispatch, because the IDispatch is not a virtual base class ( as the error message is saying, the compiler cannot decide which base class to consider for casting).You can disambiguate the cast by specifying which base class to consider ( (IDispatch*)(IInterface1*)this).
Another issue is that you will have DISPID clashes from the two interfaces ( id 1 assigned to method "test" in iface 1, and for method "clone" for iface2). The solution is dispid encoding ( you can find an article on codeguru about this), manually implementing IDispatch or using tear-off objects.
|
|
|
|
|
Hi All,
How do we handle dual LAN in DCOM.
Suppose I have two machines which are connected to two networks say network A & network B. Each machine has two IP addresses.
My Server is running on one machine & Client on another.
First of all when my Client makes a call to connect to the Server through which network will it get connected ? A or B ?
Moreover suppose the connection was established through network A. Now I want that when someone pulls out the network A LAN cable from Client's or Server's machine then the Client automatically gets connected to the Server through netwrok B.
Does DCOM has a solution for this ?
Please note that the Networks cards installed in the machines are normal cards. They do not form a team.
Best Regards,
Deepak
|
|
|
|
|
You get to decide to which machine the client will connect, by specifying the remote server name in COSERVERINFO structure when calling CoCreateInstanceEx ( or by setting the appropriate value for RemoveServerName into the registry for the server component). DCOM does not have such failsafe mechanisms - if you cannot use the primary server anymore try to switch to the other one.
|
|
|
|
|
Hi All,
How do we handle dual LAN in DCOM.
Suppose I have two machines which are connected to two networks say network A & network B. Each machine has two IP addresses.
My Server is running on one machine & Client on another.
First of all when my Client makes a call to connect to the Server through which network will it get connected ? A or B ?
Moreover suppose the connection was established through network A. Now I want that when someone pulls out the network A LAN cable from Client's or Server's machine then the Client automatically gets connected to the Server through netwrok B.
Does DCOM has a solution for this ?
Please note that the Networks cards installed in the machines are normal cards. They do not form a team.
Best Regards,
Deepak
|
|
|
|
|
Hi all,
I have the following code called from a worker thread in a DLL
HRESULT hRes = CoCreateInstance(CLSID_ToPickReg1,NULL,CLSCTX_INPROC_SERVER,__uuidof(IMyInterface),(void**)&m_pRegInterface);
and then I issue a call to a function like this
hRes = ((IMyInterface*)m_pRegInterface)->GetBinDir(&pChar,&errorCode);
where pChar is of type unsigned int * and the function signture is
CMyInterface::GetBinDir(unsigned char **ppuchBinDir, long *plErrorCode)
What I am getting is error 1783 or "The stub received bad data" in Win98 first edition with or without DCom98 installed, while in Win2000 everything works like a peach.
Any ideas?
Thanks in advance.
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
This is more Word related than COM related, so I hope you don't mind me asking...
I am using automation of MS Word to build a Word document, and would like to add footers which contain the page number, in the format [some text] [page number] [some text].
It seems to be that you can set the text of the header and footer using HeaderFooter::GetRange() and then Range::SetText(), and you can add a page number to the footer using HeaderFooter::GetPageNumbers() and then PageNumbers::Add() , but you can't marry up the text and page number.
Any ideas on how I can tackle this. Alternatively, does anyone know of any good books that cover word automation to this sort of depth?
Thanks in advance!
|
|
|
|