|
Thanks Mike.I have done this. But when i include the Plateform 2000 SDK files in Visul C++ setting i have other error of in
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_TryAsync, CTryAsync)
END_OBJECT_MAP()
Error: Can not access private member
Now i tried to simply replace the objidl.idl file of Visual studio with that of SDK. After This i havenot get any error in IDL File But it gives the following error if i try to make my object class inherit from IClassFactory.
error C2504: 'ICallFactory' : base class undefined
Thirdly when i include
async_uuid(06896d00-fb66-4222-8991-eb85c11720f9),
in IDL and my declaration of Interface is this
interface ITryAsync : IUnknown
{
[id(1), helpstring("method Add")] HRESULT Add [in] int a, [out, retval] int* b);
};
It gives Followin error
error MIDL2021 : duplicate id : [ Procedure 'Finish_Add' ( Interface 'AsyncITryAsync' ) ]
It will be so kind of you if you can help me in this regard.
If u have some useful sample then Please send me or give me its link.
|
|
|
|
|
hi,
i want to develop an application in which com client can call methds of COM Server asynchronously. For this i have gone through non-blocking method calls" article from microsoft. But there are some problems. i m getting error on adding this line to IDL file.
[
object,
uuid(637D4FFD-3DBB-4783-B2A3-196AC10FF804),
// async_uuid(6847c7fb-15fc-4638-b403-779d654d90e2),
dual,
helpstring("IAsync Interface"),
pointer_default(unique)
]
interface IAsync : IUnknown
{
[id(1), helpstring("method add")] HRESULT add([in] int a, [ out ] int * b);
It gives the following error
error MIDL2021 : duplicate id : [ Procedure 'Finish_add' ( Interface 'AsyncIAsync' ) ]
Secondly if i wnt to make it server for VB Client i made the following change to the code
coclass Async
{
[default] interface IAsync;
interface ICallFactory;
};
and it return following error
error MIDL2337 : unsatisfied forward declaration : ICallFactory [ Coclass 'Async' ]
it will be so kind of u if u can help me in this regard. By giving any link or help
|
|
|
|
|
Using P/Invoke how would i know that i should be passing "by value" or "by reference" to the arguments of a method or function of the DLL?
2. Equivalent type in .Net of the used data type for each variable (e.g what's the equivalent type of BSTR in VB.Net/C#?
3. In the type library it says:
VARIANT_BOOL _stdcall NE_QueryElementByID(
[in] long net,
[in] ElementTypeEnum eltype,
[in, out] IDAttRec* id,
[in, out] HandleAttRec* h);
This is the way i called it in VB.Net...is this correct?
...
<dllimport("neteng.dll")> _
Public Shared Function NE_QueryElementByID(ByRef net As Long, ByRef eltype As ElementTypeEnum, ByRef id As IDAttRec, ByRef h As HandleAttRec) As Boolean
End Function
...
Dim h1 As HandleAttRec
hi.Handle = 0
Dim id1 As IDAttRec
Dim m_startid As Int32 = 4424
id1.UserID = 99
id1.LayerKey = 1
dim bol as Boolean = NE_QueryElementByID(net, ElementTypeEnum.NE_EDGE, id1, h1)
Tnx a lot!
|
|
|
|
|
COM's IDL follows C's convention: arguments are always copied (pass-by-value). Where it gets tricky is that the value copied might be a pointer, simulating pass-by-reference.
In this case, you'll want to pass net and eltype ByVal , while id and h should be passed ByRef .
However, if you have a type library, why aren't you using tlbimp ?
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I'm trying to write my own customer SyncMgr component. I'm having some trouble loading up the ISyncMgrRegister object. I'm a little new to COM so I'm probably missing osmething obvious here. This is MC++ code. Can someone point me in the correct direction.
<br />
#include "stdafx.h"<br />
#include "mobsync.h"<br />
#using <mscorlib.dll><br />
<br />
using namespace System;<br />
<br />
int _tmain()<br />
{<br />
HRESULT hr = CoInitialize(NULL);<br />
<br />
if ( FAILED(hr) )<br />
{<br />
Console::WriteLine(S"Cannot Initilaize com");<br />
goto error;<br />
}<br />
<br />
ISyncMgrRegister *reg = NULL;<br />
<br />
hr = CoCreateInstance(<br />
CLSID_SyncMgr,<br />
NULL,<br />
CLSCTX_LOCAL_SERVER,<br />
IID_ISyncMgrRegister,<br />
reinterpret_cast<void**>(reg));<br />
if ( FAILED(hr) )<br />
{<br />
Console::WriteLine(S"Could not create an instance of the Sync Mgr");<br />
goto error;<br />
}<br />
<br />
reg->Release();<br />
<br />
Console::WriteLine(S"Press Enter to Exit");<br />
Console::ReadLine();<br />
return 0;<br />
<br />
error:<br />
<br />
Console::WriteLine(S"Press enter to exit");<br />
Console::ReadLine();<br />
return 1;<br />
}
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
reinterpret_cast<void**>(®)
The rest looks fine.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Hi Jared,
I saw your post and was looking for some help, I am trying to write a Sync Manager component as well and I am having great difficulty with this as I am fairly new to C++ mostly VB, but I really need to hook into this interface, I to start with just wanted to get a hook in working, i.e register for synchronization and that sort of thing, do you have good samples you could share or point me in the right direction ?
Cheers
Michael
|
|
|
|
|
Hi guys. I am having trouble in using a ATL Component interface (Activex Server component created in VC++) with vbscript on a ASP page. I can successfully create the interface in the asp page and successfully set & retrieve property values and call some methods. However, when one particular method is called i get the following error "Error in loading .dll : " followed by the appropriate method name.
This method returns a Recordset and uses ADO to query a table in a SQL database. This method works fine when called from within vba,VB or C++, it only complains when being called in VBscript in an asp page. I have checked the permissions of the .dll and all seems ok. Does anyone have any ideas about what could be causing this? Any help is gratefully received.
Thanks,
Peter G Welch
|
|
|
|
|
hi all i am facing a problem in Com+ transaction
i have 3 classes 1 main class , others classes are a, b.
all these classes are derived from servicedcomponent and have required transaction attribute.
in a method of main class i am calling fuctions of class a and class b.
i want these to be in transaction
when i am using contecxtutil.setComplete and setabort in main class method and also in class a and class b method i get error saying something like this
"Transaction explicitly or implicitly committed or aborted".
am i doing it in a right way or am i missing something.
i am bit new in com+ app.
please guide me in this problem
best regards and thanx
jignesh
|
|
|
|
|
Hi guys,
an application we're developing load COM objects during its execution. These COMs can be found in any location (local PC or remote PC). Now my question is, there will be problems on doing that?
Should I add the linker option /SWAPRUN:NET when linking the COM project to allow Windows load the COM from the remote PC without paging?
Thanx for your reponses,
Fabio
|
|
|
|
|
Hi all
I have created a ATL com which runs all the machines. but faisl on one which is a Windows 2003 server. But it functions on another 2003 server.
When I call CreateDispatch("name",NULL); its showing error access denied.
Dont know whats happening
Please help me
|
|
|
|
|
Hi all,
Can anybody suggest some online reference to start learning COM using MFC>
|
|
|
|
|
How would i exposs a class library as a COM object. i look through the SDK Docs and still a little lost.
[ ...what to put in here? ]
public class MediaStatusSink : IMediaStatusSink
{....
}
I just need help setting up the class attributes,
here is what im trying to do:
A sink is a COM component that supports the IMediaStatusSink interface and is registered as a member of the CATID_MediaStatusSink {FCB0C2A3-9747-4C95-9D02-820AFEDEF13F} component category.
in the registry editor at
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Component Categories\{FCB0C2A3-9747-4c95-9d02-820AFEDEF13F} i have:
(default) REG_SZ (value not set)
409 REG_SZ Media Status Sink
modified 16-May-21 21:01pm.
|
|
|
|
|
I'm using a COM API for a VoIP Voice phone. I can interrogate it fine using the following code...
IVOIPDevice* pISL = NULL;<br />
HRESULT hr;<br />
<br />
hr = CoCreateInstance(<br />
CLSID_VOIPDevice,
NULL,
CLSCTX_INPROC_SERVER,<br />
IID_IVOIPDevice,
(void**) &pISL);
<br />
if (SUCCEEDED(hr))<br />
{<br />
TRACE("SUCCEED!!!!\n");<br />
}<br />
else<br />
{<br />
TRACE("SUCCEED NOT!!!!\n");<br />
return;<br />
}<br />
<br />
pISL->etc etc etc
The interface for the events is _IVOIPDeviceEvents. How can I act on these events? I'd rather not use ATL if at all possible.
I feel like I'm diagonally parked in a parallel universe
Jerry Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
You'll need to implement _IVOIPDeviceEvents as a dispatch interface by implementing IDispatch . If you create a dual interface, you can get the OS to implement IDispatch for you by calling CreateStdDispatch .
You then need to give your dispatch pointer to the object by asking it for the appropriate connection point - an object that implements IConnectionPoint . First you QueryInterface for IConnectionPointContainer , then use that interface's FindConnectionPoint method to get the IConnectionPoint . You can then call Advise , passing in your dispatch interface pointer. Remember the returned cookie, so that you can later call Unadvise to clean up.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi everyone,
I m a beginner in COM.
I have created one .idl file. while compiling it with midl.exe, I m getting the error as :MIDL1001 : cannot open input file oaidl.idl
I have no idea, why it can't open the oaidl.idl file. can anyone, please help me on this...
here is the code of my .idl file:
import "oaidl.idl";
[
object,
uuid(1E2F24ED-0317-4990-A29D-55FB73908C68)
]
interface IFirstInterface : IUnknown
{
HRESULT DoSomething();
};
[
uuid(4619C849-67DC-4f24-B5D2-0E215B1DBD6A),
version(1.0)
]
library FirstTypeLib
{
importlib("stdole32.tlb");
[
uuid(C69DA526-39B4-4810-803B-43A9F9AC5376)
]
coclass FirstComponent
{
[default] interface IFirstInterface;
};
};
Expecting some early reply.
thanks,
Ashok
|
|
|
|
|
What's your MIDL command line, and your INCLUDE environment variable?
It looks like it can't find the imported IDL file, which is normally in the INCLUDE directory, by default \Program Files\Microsoft SDK\Include or in the VC include directory, \Program Files\Microsoft Visual Studio\VC98\Include.
Steve S
|
|
|
|
|
yeah, for tht I have set the environment variable too.
now if I type PATH in DOS prompt, following is the output:
PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Microsoft Visual Studio\VB98;C:\Program Files\Microsoft Visual Studio\VC98\Bin;C:\Program Files\Microsoft Visual Studio\VC98\Include;
but still the same problem.
thanks,
Ashok
|
|
|
|
|
But it isn't meant to go in PATH, it's meant to go in INCLUDE...
|
|
|
|
|
You can either set the INCLUDE environment variable as appropriate, or use the /I option to indicate directories to be searched.
If you're launching MIDL as part of a Visual C++ project build, it should inherit the same include directories settings from Tools > Options > Directories (VC6) or Tools > Options > Projects > VC++ Directories (VS.NET). These are usually set correctly.
VC6 configures the include directories (the INCLUDE environment variable) for the copy of the Platform SDK that it installs, when it installs, if requested. VS.NET does not automatically do this - to set the appropriate directories, run vsvars32.bat (in Common7\Tools under the VS.NET directory), or use the "Visual Studio .NET Command Prompt" shortcut in the start menu (under Visual Studio .NET Tools).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have done tht too. but still the problem exists.
I am giving everything in details, I have done here. please let me know, if you can find out, where I have gone wrong.
1. in VC++6.0, I have created a text file and saved it as FirstSrv.idl. content of the file is:
import "oaidl.idl";<br />
[<br />
object,<br />
uuid(1E2F24ED-0317-4990-A29D-55FB73908C68)<br />
]<br />
interface IFirstInterface : IUnknown<br />
{<br />
HRESULT DoSomething();<br />
};<br />
<br />
[<br />
uuid(4619C849-67DC-4f24-B5D2-0E215B1DBD6A),<br />
version(1.0)<br />
]<br />
library FirstTypeLib<br />
{<br />
importlib("stdole32.tlb");<br />
[<br />
uuid(C69DA526-39B4-4810-803B-43A9F9AC5376)<br />
]<br />
coclass FirstComponent<br />
{<br />
[default] interface IFirstInterface;<br />
};<br />
};
2. in Tools->Options->Directories
i. under include files
C:\PROGRAM FILES\DXSDK\INCLUDE
C:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\PRERELEASE
C:\PROGRAM FILES\MICROSOFT SDK\INCLUDE
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\INCLUDE
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC\INCLUDE
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\ATL\INCLUDE
C:\WIN32
ii. under library files
C:\PROGRAM FILES\DXSDK\LIB
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\LIB
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC\LIB
C:\WIN32
C:\PROGRAM FILES\MICROSOFT SDK\LIB
C:\PROGRAM FILES\MICROSOFT SDK\LIB\PRERELEASE
C:\PROGRAM FILES\MICROSOFT SDK\INCLUDE
3. I have 3 copies of oaidl.idl in my system. they are under the following directories:
i. C:\Program Files\Microsoft Visual Studio\VC98\Include
ii. C:\Program Files\Microsoft SDK\Include\prerelease
iii.C:\Program Files\Microsoft SDK\Include
Hope, I have made everything clear on whtz goin on this side. and when I try the following:
MIDL FirstSrv.idl
result comes as:
Microsoft (R) MIDL Compiler Version 5.01.0164
Copyright (c) Microsoft Corp 1991-1997. All rights reserved.
Processing .\FirstSrv.idl
FirstSrv.idl
midl : command line error MIDL1001 : cannot open input file oaidl.idl
Hope u r clear now on whtz goin this side.
Expecting ur kind response.
regards,
Ashok
|
|
|
|
|
In your command window, have you run VCVARS32.BAT ?
This will set stuff like LIB and INCLUDE for you, although it may not be 100% correct, it will have all the VC++ directories.
Steve S
|
|
|
|
|
Ohhhhhh.... really I m very very thankful to you Steve...
it works now...
Once again Thank you very much.
regards,
Ashok
|
|
|
|
|
Hi All,
I have a windows service installed on Machine having XP2 Service pack 2 OS.
I am using this call in Run() Method,
hr = CoInitializeSecurity(NULL, -1, NULL, NULL,
RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL,
EOAC_NONE, NULL);
If i access this service from other computer it gives access denied error.
If i disable Firewall security from Control Panel->Windows Firewall,and in Dcomcnfg add ANONYMOUS user and give it full access,
access denied problem goes.
Why do i want to add ANONYMOUS in Dcomconfg even i disable Firewall security??
if i dont want to do all above settings but still my service should be accessed from other computer ,what should i do,is there any way for this??
Any help is appreciated.
Thanks
Tushar Mahajan.
|
|
|
|
|