|
Thanks for your response. But The interface, that I want to design must have
an aggregation relation ship with some other interface.
How to do this ?
Hara
|
|
|
|
|
Can you give a little more info? 1) Do you mean your COM object will be aggregated or that your COM object will aggregate the other COM object?; 2) Are you using ATL?
things could always be worse...
|
|
|
|
|
Hi
I would like to describe the problem refering a picture in my word document.
Neither, I could insert my document nor even the picture.
Can you please send me your E-mail ID , so that I can mail you my document with detailed problem description of the problem.
Regards
Hara
Hara
|
|
|
|
|
I've downloaded http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=midi in order to implement a midi song in my app.
But the play(midi) command only works in a [STAThread] model and it stop my app until the music end.
I've few experience in C#.
Any way to fix it??
Any clue???
|
|
|
|
|
Hi, I read the articles about COM basic and still have problems. I try to write a simple console application in vc++ 6.0. I want to use ActiveDesktop componet to handle some info about wallpaper and patern. Also I have an example code. But there is no info about following thing.
In the code there are some variables like CLSID_ActiveDesktop or CLSCTX_INPROC_SERVER.
in which header they are defined. If your answer is comdef.h I include it and it only have some structs IActiveDesktop. Also I found that CLSCTX_INPROC_SERVER is defined in objbase.h but it still get error when I use CLSCTX_INPROC_SERVER. When I write 1 it is ok.
Another thing I could not get last parameter of CoCreateInstance.
here what I try to work and it gives 4 error.
<br />
<br />
#include<iostream.h><br />
#include<objbase.h><br />
#include<comdef.h><br />
<br />
HRESULT hr;<br />
int main()<br />
{<br />
IActiveDesktop *pIActiveDesktop;<br />
<br />
CoInitialize ( NULL ); <br />
<br />
hr = CoCreateInstance( CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,<br />
IID_IActiveDesktop, &pIActiveDesktop);<br />
<br />
cout<<hr<<"\n";<br />
<br />
return 0; <br />
}
karanba
|
|
|
|
|
check if you have correctly set the switches or how it is called.
for example if it is defined in your stdafx.h (or simply before you include any of windows/com headers):
#ifndef _WIN32_WINNT<br />
#define _WIN32_WINNT 0x0400<br />
#endif
Possibly you will need to define also version of your explorer etc.
This is because some definitions in standard windows headers are conditionally compiled and if you do not define correct switches, some functions and constants are simply ommited by the compiler - even if you can see it in headers....
|
|
|
|
|
Ok well this is the code and it gives only error at the line which I put a confused face image near it. VC++6.0 says that
\selman\desktop\workarea\comclienta\cpp1.cpp(27) : error C2664: 'CoCreateInstance' : cannot convert parameter 1 from 'char [37]' to 'const struct _GUID &'
Reason: cannot convert from 'char [37]' to 'const struct _GUID'
No constructor could take the source type, or constructor overload resolution was ambiguous But I check many things that I could not found the reason. please give me an explanation
#include<iostream.h>
#include<objbase.h>
#include<comdef.h>
HRESULT hr;
int main()
{
IActiveDesktop *pIActiveDesktop;
CoInitialize ( NULL );
hr = CoCreateInstance( "75048700-ef1f-11d0-9888-006097deacf9",
NULL,
CLSCTX_INPROC_SERVER,
"f490eb00-1240-11d1-9888-006097deacf9",
(void**) &pIActiveDesktop);
cout<<hr<<"\n";
cout<<hr;
return 0;
}
karanba
|
|
|
|
|
I see. The problem is in parameter "f490eb00-1240-11d1-9888-006097deacf9", this and "75048700-ef1f-11d0-9888-006097deacf9". The CoCreateInstance is not designed to handle GUIDs in such a way.
It expect pointer/reference to some memory where GUID is stored in numeric format.
For calls to functions you can use the symbolic names like
CLSID_ActiveDesktop instead of "75048700-ef1f-11d0-9888-006097deacf9"
and IID_IActiveDesktop instead of the second one.
Then the call should looks like that (I hope so):
hr = CoCreateInstance( CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER, IID_IActiveDesktop,(void**) &pIActiveDesktop);
But for easier coding I would recomend you to use smart pointers from ATL, then the code will looks like this one:
<br />
CComPtr<IActiveDesktop> spActDesktop;<br />
spActDesktop.CoCreateInstance( CLSID_ActiveDesktop );
which is much easier to read, and also the smart pointer takes a care about reference counting.
|
|
|
|
|
thax geo_m it works now
I add following to the code and you are true
DEFINE_GUID( CLSID_ActiveDesktop, 0x75048700L, 0xEF1F, 0x11D0, 0x98, 0x88, 0x00, 0x60, 0x97, 0xDE, 0xAC, 0xF9);
DEFINE_GUID( IID_IActiveDesktop, 0xF490EB00L, 0x1240, 0x11D1, 0x98, 0x88, 0x00, 0x60, 0x97, 0xDE, 0xAC, 0xF9);
Now I will try to write my own com component there I want to ask a new questions.
There must be an IDL file for every COM componets or when they are needed
karanba
|
|
|
|
|
Hi,
I'm working on a C# Winform application to manage content in a electronical schoolbook. One of the key feautures is a WYSIWYG HTML editor, where the author can format the output text on her own.
At the moment I don't quite know where to start building this feauture. I've done some research, and figured out that there are two components i could use, a) the DHTMLEdit ActiveX component, or b) the MSHTML COM objecct (correct me if I'm wrong). Most of the information i could find about the DHTMLEdit is datet 1998/1999, and is "old". I've allso seen some newsgroup post saying that Microsoft is outfasing DHTMLEdit, and are suggesting you to use the MSHTML object.
What i wan't to know, is witch one of these two components i should use to build my WYSIWYG HTML Editor. What's the main differences, and how could i as easy as possible implement the feauture in my application. The best thing whould be if i could buy a out of the box editor, witch I could include in my project. I know there are plenty of webbased editors out there, but i wan't something that's winforms.
I would allso appreciate any kind of good information about witch path to take.
Thank you
Jonas Follesø
Developer, GreIT AS
http://www.greit.no
|
|
|
|
|
Hello,
I created a COM DLL. (with VC++.NET but this is not important).
And created some assembly the has a function, that create instance from the
COM class, and call some function from the COM object.
When I call the functions of the assembly as simple as possible, from some
console app, this is work.!
But if I do it via remoting, it isn't work!! and give this exception:
Unhandled Exception: System.InvalidCastException: QueryInterface for
interface ScreenCamaraASM.IScreenCapturing failed.
Server stack trace:
at ScreenCamaraASM.CScreenCapturingClass.GetNumber()
at RCServerNP.RCServer.GetScreenPicture() in d:\mydocs\visual studio
projects
\remotecommunication\rcserver\rcserver.cs:line 24
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(M
ethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInC
ontext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMes
sage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgDa
ta, Int32 type)
at RCServerNP.RCServer.GetScreenPicture() in d:\mydocs\visual studio
projects
\remotecommunication\rcserver\rcserver.cs:line 21
at Testing.Class1.Main(String[] args) in D:\MyDocs\Visual Studio
Projects\Rem
oteCommunication\Testing\Class1.cs:line 36.
Please, any solution?
Thank's, Itay.
|
|
|
|
|
Hello guys,
Where can I find a good implementation of IClassFactory2, whitout using that DECLARE_CLASSFACTORY2(CMyLicense) macro, to perform licensing capabilities to my software?
Thanks in advance,
Raphael Amorim Dantas Leite
VC++, VB, Java, .NET and eMbedded Programmer
|
|
|
|
|
Hello,
I had a problem in registering a sink I made.I made the dll and
make a client com to test that the dll is registerd correctly
then I register the sink using the smtpreg.vbs
but when I send an e-mail from another terminal my sink wasnot called
I donot know why??Could you help??
By the way I have a network 2 pcs I installed win2000 Advanced server
and Exchange 2000 server on one and made it the server and installed
win2000 professional on the other and I use visual studio.net to make
the sink ATL Project.
|
|
|
|
|
Hi everybody,
I've asked this question before, and I'M NOW WILLING TO PAY (with PayPal) for a solution that fits my needs because time is not a thing I have in abundance and I need this thing quickly!
Here's, from a user point of view, what I want the resulting solution app to do:
####
When pressing a modifier key (ctrl for example), clicking (right or left mouse) ANY text-based string in ANY application or object (folder names, titles, list items, etc) in the operating system (win95+), a small window should appear next to the clicked-on text informing the user what text he/she has clicked on.
####
Two approaches (as far as I know) are possible: Either you can go the OCR (Optical Character Recognition) way where you actually capture and analyze what the screen pixels look like. An OCR engine is hard to develop yourself and expensive to license or buy. Or you can use the MS Accessibility API to do this... (fairly undocumented but supposed to do the trick). This is an API used for developing apps that for instance can read text on the screen out loud.
Anyone with the appropriate knowledge and skills who want to take this on?
We can discuss the details more privately when a first contact has been established. Thx everybody and thx for a great forum!
/Tommy
|
|
|
|
|
I've already posted this on the main c++ forum. I didn't notice this COM forum first. Sorry for that.
I want to use the internet explorer inside my application. This works fine:
AtlAxWinInit();
HWND hwndChild=::CreateWindow( "AtlAxWin",
"Shell.Explorer.1",
WS_CHILD|WS_VISIBLE,
0,0,0,0,
hwnd,NULL,
::GetModuleHandle(NULL),
NULL);
IUnknown *pUnk=NULL;
AtlAxGetControl(hwndChild,&pUnk);
CComPtr<IWebBrowser2> spBrowser;
pUnk->QueryInterface(IID_IWebBrowser2,(void**)&spBrowser);
if(spBrowser)
spBrowser->put_Visible(VARIANT_TRUE);
But, I want this to be more abstract. How can I use the interface IDispatch instead.
My attempt to abstract it returned a DISP_E_UNKNOWNNAME while calling GetIDsOfNames with "Visible" and VARIANT_TRUE.
It has to be something like that...
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
We have a COM+ server application that runs under a local user account. The application is marked as queued which automatically creates some MSMQ private queues. However the system does to add the required permissions for the user (Full Control) to the queues. Is this a bug? Or do we have to set these permissions ourselves? Can this be done programatically?
|
|
|
|
|
As part of our installation we programatically create serveral COM+ applications one of which is marked as queued. When marked as queued the system automatically creates several private MSMQ queues. However during un-installation when we remove the COM+ applications the queues are left. Is this be design? What is the best way to delete this queues?
|
|
|
|
|
helo
i have an COMserver-app and now i will speak with them over ASP.....
i will get returns from COM with ASP. how i can get them?
is there anywhere a link or some tutorials or so?
thanky a lot
|
|
|
|
|
Hi there
I have to test the Windows Messenger 4.7 API for Add-Ins. Actually, i fail at the first step of the getting-started instruction of the API:
1. Create a Component Object Model (COM) component. Your add-in component should be implemented as a COM component. The classes in your add-in component that implement specific add-in features should inherit the interfaces that describe the feature you plan to implement. When creating your COM component make sure to create it as a LocalServer and not InProc. Messenger Add-Ins are not supported as InProc COM components.
I am quite a neewbie on the subject of COM objects, so anybody got give me a hint?
I am working with .Net at the moment, maybe it would be better to change to visual c++? (i would prefer working in c++ rather than in VB)
thx a lot, Lusi
btw, here the link to get the api's, if one is interessted:
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/topic.asp?url=/msdn-files/028/001/359/topic.xml
|
|
|
|
|
Hi, all!
Would you like to help me, plz?
Have the folow:
I want to create COM+ component with help c#, so, it will use the external(usual) dll-file(my.dll), where contents some logic (com-objects).
This dll good work in usual application, when add it as reference - all ok.
(a have not source for this dll file)
But when i try to link up it in my developed com+ app., - got folow answer from compiler:
"Assembly generation failed -- Referenced assembly 'name of my.dll' does not have a strong name"
is it have not 'strong name'????
i try the next:
al /out:my.dll "?" /keyfile:my_dll.snk
but it don't want to work... i do not understand want is this "?"
and is it right way to solve this problem? and what i must do in this case?
in any case thx.
|
|
|
|
|
hi,
I am new to COM,but i want to learn it completely.when i start searching for the tutorials,i am very much confused which is better than what.Can any one of u please guide me how to go forward,so that i can learn COM better in steps without any confusion.I know VB and C++.
Thanks for all in advance
|
|
|
|
|
|
Developers guide to ATL and COM
http://www.amazon.co.uk/exec/obidos/ASIN/1556227043/202-2451278-4678239[^]
This book is the best by a long shot.
It takes you though what com is about - interfaces, and before you even touch com works you though making interfaces in pure C++. Later you make a com dll in pure c++, and its not hard once its explained well. Then it moves on to using IDL(interface definition language) and how ti helps. Then finanlly once you know the fundamantals, it shows you how to use ATL properly, from In process DLL's to out of process objects in an EXE possibly even on another machine with DCOM. As well as that it clearly explains call backs and connection points, COM error handling.
If you want to learn COM get this. It has to be one of my best all time buys.
Don't be put off by the version. ATL skipped from 3.0 to 7, but there is no difference in the COM area of ATL. The main only thing I see in ATL7 that is not the same with ATL3 is NT Services, and all they have done there is make it easier.
Hope this helps.
|
|
|
|
|
"Developer's Workshop to COM and ATL 3.0"
I fully agree that it's a great book. As Giles says, the approach it takes is what makes it so good. Probably one of the best Technical books I've ever bought
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
I have encapsulated a "view" into an ActiveX control.
I realized that if my testers ran the production version of my program they might get the test version of my control or vice-versa. In order to fix the problem, I re-register all .ocx and .dll files found in the program directory.
The problem is... When a user launches the production version, then the test version, then opens the "view" in production they get the test version (registered last)
Do I need to constantly be updating GUIDs or is there an easier way to do this with a compile time switch?
|
|
|
|
|