|
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.
|
|
|
|
|
Hi,
I have developed an application, which supports File save / read logic using Structure Storage (mentioned on this site). I am storing very complicated structure in the file. Now I want to support typical file versioning system. So that even if I changed (add new elements in present structure), till it should be able to support backward file reading capabilities.
Does anyone has come accross such senario? How the design was done in this senario? My present design is - It will call say GetDataFor130() or GetDataFor100() (where 130 means ver 1.30, 100 means ver 1.00.) GetDataFor130() will internally call GetDataFor100() and then read or write the additional elements. So backward compatibility is maintained with minimum code complexity.
Thanks & Regards,
Anonymous
|
|
|
|
|
I learning to make a COM dll, I want convert a a sample in C++ (or C i dont know) I just need help with the
[odl,
uuid(A70D81F2-C9D2-4053-AF0E-CDEA39BDD1AD),
helpstring("IMediaStatusSession Interface"),
dual,
oleautomation]
the best i could do so far learing from the SDK is:
[Guid(A70D81F2-C9D2-4053-AF0E-CDEA39BDD1AD),
InterfaceType(ComInterfaceType.????????),
helpstring("IMediaStatusSession Interface")]
I just need help with the "dual" and "oleautomation"?
where can i find info about this in the SDK Documentation? or even better can some one fix what i done so far.
modified 16-May-21 21:01pm.
|
|
|
|
|
Please any body tell me How to minimize the size of ATLCOM DLL. I have made dll which is MTS supported + Asp intrinsic objects. I have made 5 functions in One interface. and the size of dll is 1.04 MB...
Please tell me how could i minimize the size of the dll.
Thanks in advance...
|
|
|
|
|
Visual C++ 6.0's ATL wizard creates two different release configurations: ReleaseMinSize and ReleaseMinDependency. The minimum dependency version links to the C run-time statically and includes the ATL registration code. The minimum size version links to the DLL version of the C run-time and links to atl.dll for registration.
In the second case, you would have to distribute msvcrt.dll (installed by default on Windows 2000 and later, so you can skip it if you're targetting one of these systems) and atl.dll.
You can select different combinations by defining (or not defining) the symbols _ATL_MIN_CRT , _ATL_STATIC_REGISTRY , and changing the C run-time library version you're using. If you're not using the C run-time at all, you can define _ATL_MIN_CRT .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi all,
I have created a simple FULL control, also i have registered a new MIME type for it.
Now, When i create a new file say test.myext and open it with IE. it show the Control taking full page on IE Window and spying these window -
It looks something like this
---C:\temp.bisfext
|---Other Windows
|---Other Windows
|--- Shell DocObject View
|-Internet Explorer_Server
But I have seen some few application where in if you embed you control in IE Window then IE Show something Like
---C:\temp.bisfext
|---Other Windows
|---Other Windows
|--- Shell DocObject View
|-Internet Explorer_Server
|-ATL:XXXXXXXX
Can anyone please explain me what is the difference between the two?
Thanks in Advance
Abhishake
|
|
|
|
|
Hi,
How do I find out the the path of the .exe or script file (.vbs, .js) which is trying to use my ActiveX server exe?
Any VB or VC++ code will be helpful.
Thanx
|
|
|
|
|
Hi,
I am student. Right now i am learning on COM+. And doing one on course project in VC#.NET and COM + component. This is distributed application.
In that there is server on one machine and client on other. But i am little bit confused in that server client techonlogy. I have to make database connectivity for validating users and other inforamation. That time i creat on clint and one server and one component for connecting client to server. But if i want to make one more form can i use same server that i already created for the login. and how to use many forms to connect server and then connect to database i am confused in this stuff.
Please Help me.
I hope someone help me for that
Thanking You,
(Hemant Uttam Mane)
|
|
|
|
|
I am a COM newbie, and I would like to use the MAPI address book in one of my apps.
According to the documentation I got, the function I want is IAddrBook::Address .
Now IAddrBook is declared as IAddrBook : IMapiProp which tells me it is derived from IMapiProp .
My question is how do I get an instance of IAddrBook into my MFC app so that i can use it?
The interface ID is IDD_IAddrBook and the pointer type is LPADRBOOK which are declared in in the file "MAPIX.h" which is all fine, but to use CoCreateInstance() to create an instance of IAddrBook I need a class ID. What is, or where do I find, the CLSID for IAddrBook . Or is there an other way to load an instance of IAddrBook ?
Please do not point me to WABOPen as that function will return Internet Explorer's cutdown subset of MAPI's IAddrBook interface. I want to gain access to MAPI's full featured IAddrBook .
Also, if anyone can recommend some good books on COM basics for beginners, I would be greatful
Thanks.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
__uuidof(IAddrBook)
will this work for you?
Have you considered using smartpointers, since you are a newbie as you said, it would be helpful for you.
God is Real, unless declared Integer.
|
|
|
|
|
Thanks for the pointer, but unfortunately it does not work
LPADRBOOK pa = NULL;
HRESULT hr = CoCreateInstance(__uuidof(IAddrBook), NULL, CLSCTX_INPROC_SERVER, IID_IAddrBook, &pa); gives me
error C2787: 'IAddrBook' : no GUID has been associated with this object Surely there must be a way to load an IAddrBook object
It can't be that difficult, all I need is point in the right direction
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I am not that expert in com either, but i guess this should work.
HRESULT hr = CoCreateInstance(IDD_IAddrBook, NULL, CLSCTX_INPROC_SERVER, IID_IAddrBook, &pa);
before that , did you import the tlb file ?
God is Real, unless declared Integer.
|
|
|
|
|
hi
clsid for IAddrBook is {4D2F086C-6EA3-101B-A18A-00AA00446E07}. I just took it from the registry. but it seems mapi.dll is supposed to use by calling the exported mapi functions in that dll. Even if the dll is com compliant, it is not iDispatch impliemnted and also it exports a large number of functions for varuois kind of operations with outlook. So it better to go for that built in functions than the com functions. So to get the IAddrBook pointer u can use pSession -> OpenAddressBook . This will return LPADRBOOK . To get a valid pSession variable, call MAPIInitialize and MAPILogonEx .
rgds...mil10
|
|
|
|
|