|
I am new in COM programming so I have a question that is maybe very simple for you, but I do not know the answer.
My client and server applications are running on two different PC's, so I have a remote connection. I want to implement the client in such a way that the user can change the name of the PC where the server is running. I want this to be flexible for future changes if the server has to be installed on another PC.
Can someone explain me how to solve this? Do you have an URL where I can find an example with the solution for my problem.
Thanks.
MauriceMG
|
|
|
|
|
See the answer to "DCOM & Dual Lan" below [^]
|
|
|
|
|
My problem is solved now.
Thanks for your reaction.
MauriceMH
|
|
|
|
|
Does anyone know if there is a function I can call to determine if I an inside a STA or a MTA (apart from calling CoInitializeEx and checking for RPC_E_CHANGED_MODE).
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Looking for "DebugCoQueryApartmentID" word in MSDN's Bugslayer 1998[^].
With best wishes,
Vita
|
|
|
|
|
|
HI all,
I need to pass safearray of user defined data type( my structure ConInfoStruct) from the COM server dll to MFC client. I declared my structure in IDL file like this:
typedef [uuid(F5C2F02A-09D3-4fca-B5A9-5413009F6365)] struct tagConInfoStruct
{
ULONG m_ipAddress;
USHORT m_appType;
ULONG m_appID;
}ConInfoStruct;
when i build this code, MIDL doesnt generate GUID for the above structure. So Retrieving IRecordInfo pointer using UUID_ConInfoStruct from the client failed as UUID_ConInfoStruct is an undeclared identifier. Has anyone faced this problem before. Please let me know a solution for this problem.
thanks
bharani
|
|
|
|
|
Remove the "tag" part from "tagConInfoStruct"! Also you should use OLE Automation types if you want use this structure in OLE client. Both ULONG and USHORT are incompatible with OLE. Use signed long and short types.
typedef [uuid(F5C2F02A-09D3-4fca-B5A9-5413009F6365)]
struct ConInfoStruct
{
LONG m_ipAddress;
SHORT m_appType;
LONG m_appID;
}ConInfoStruct;
With best wishes,
Vita
|
|
|
|
|
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--
|
|
|
|