|
Just a "quick" question on interfacing COM objects which use derived Objects based on MFC.
My understanding of COM is that if you want to stick with the rules, you usually use IDL to define your interface, and you don't pass back Objects based on any particular Library such as MFC or STL etc...
This would require alot of re-writing of my current code, so I was wondering if there is any way to keep a list of Objects derived from MFC classes in the COM DLL and all the Object method definitions and code etc.
What I want to be able to do is Create the COM object and get the required Interface to give me a pointer to the list of objects in the COM dll.
This will require me to include the definitions of the Classes etc in my application as well, but the problem I am facing it the Method Implementation Code.
Currently this is in the COM DLL, but I can't build my Application without linking the COM DLL as a standard DLL (by linking with the COM's .LIB file).
Although I can still use the COM interfaces this way, it means I have to tie the COM object to closely to my application (and defeats the purpose of using COM in the first place)
Is there any way I can instantiate the COM object as normal and pass back a list of MFC derived Objects (with my OWN Classes based on MFC ones) to my application, and then call the member functions of these Objects without linking to the COM's .LIB file?
The only way I've managed to do this, is by linking to the .LIB file, or by having to include the .CPP files for the classes in my application code as well as my COM DLL code, which I don't want to do!
Many thanks!
|
|
|
|
|
My .tlb file generated by MIDL converts the interface function parameters of type BOOL to long. So, when I'm trying to call that methode I've got a compiler error.
What's a problem ?
|
|
|
|
|
your problem is that MIDL doesn't support the BOOL data type. In your .idl or .odl file (depending on what you're using) change the BOOL to boolean and then in the actual class implementation change it from BOOL to unsigned char. Try to find a table somewhere of data type mapping from MIDL to C++. O'Reilly's DCOM book has good examples of this. Hope this helps.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I have a CGI executable (and also an ISAPI version) written in C++ which uses COM to retrieve data from another process (a voicemail server executable file running on the same machine). When I use a web server such as Xitami, it triggers the CGI and retrieves the data from the other process but when I use Microsofts IIS the CGI appears unable to use COM. I'm wondering if it's something to do with IIS preventing the CGI from accessing the system registry or GUID information?
Any ideas????
Steevie
|
|
|
|
|
I have to pass a lot of parameters to and from my COM in one function.
What would the better to use a BSTR string or to pack them into a structure?
If a structure, could anyone sent an example how to use a pointer to the structure in IDL design.
Thanks.
|
|
|
|
|
Hi,
You have an option of passing all the parameters as SafeArray of bytes or you can use the wrapper COM object for the parameters. The second approach is much easier to use but it cost time to create/destroy extra object. As for me if I don't call the function too often I prefer to use a special object for passing parameters.
There is an article in MSDN "OLE Q&A" by Don BOX which has more details on the topic...
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Can anyone point me to manual, where i can read about developing datasource?
I mean i need to implement my own datasource... where to read about?
|
|
|
|
|
Can i set a control properties dynamically? If so how can/should I?
|
|
|
|
|
Hi,
How do I determine if a folder is remote using the IShellFolder::GetAttributesOf call ?
I can determine 'Removable' easy enough, I think it is a bad omission in this interface if one cannot also check 'Remote'.
Cheers,
Liam.
|
|
|
|
|
Hi Liam
Use SHGetDataFromIDList instead, and specify SHGDFIL_DESCRIPTIONID in nFormat parameter. Network items are SHDID_NET_*.
|
|
|
|
|
Hi,
I need to know how to obtain an IShellFolder interface to a specific folder without traversing the namespace from the root.
Is this possible ?
Any thought appreciated.
Cheers,
Liam.
|
|
|
|
|
Hi
If you have the fully qualified PIDL to that folder you can use the BindToObject method. Use Desktop IShellFolder interface to do this (get it with SHGetDesktopFolder).
|
|
|
|
|
Ok, I've created a "full control" in atl object wizard.
Edit, radio, etc - ok, except listbox nd combo.
The subclassed listbox control window somehow becomes a little bit smaller, then dimensions i used in m_ctlZZZ.Create(...,rect,...)
why?
where to debug?
|
|
|
|
|
Is this interface useful? Is it implemented by shell extensions or by the shell itself?
How can I obtain the IShellIcon interface from a IShellFolder object to obtain its icon?
I haven't found any examples in the net about using this interface.
(I'm using plain C, not C++, so I treat objects as structs via lpVtbl)
Thanks
|
|
|
|
|
1. How can I create COM - server in ATL 3.0 (Visual Studio 6) for common clients resources,for example
I want to sum and save data received from any clients?
2. I create DCOM with ATL 3.0 but it begins to work only if I make mount from client-machine
(WINNT 4.0 SP. 5) on server-machine (WINNT 4.0 SP. 5) and
after that run server.exe -regserver on client-machine.
I think it is not good way and may be anybody has other decision?
Thanks in advance
O.K.
|
|
|
|
|
1. It is needed in Interface to add DECLARE_CLASSFACTORY_SINGLETON(<class name="">).
2. Instead of mount you may to register server on the client-machine in the manner:
\\server-computer-name\drive\server.exe - regserver
It is not good also, but you must not make mount.
|
|
|
|
|
I am trying to create a Database for which I am writing a function in an ATL DLL.Now , I have a doubt if ATL supports DAO.It not how can I create a Database with a ATL DLL !
Thanx in advance for help !
Y.Yamini Devi
|
|
|
|
|
I am trying to create a Database for which I am writing a function in an ATL DLL.Now , I have a doubt if ATL supports DAO.It not how can I create a Database with a ATL DLL !
Thanx in advance for help !
Y.Yamini Devi
|
|
|
|
|
In my COM object with MFC support I want to install a timer:
::SetTimer(NULL, TIMER_ID, 1000, (TIMERPROC)TimerProc);
Then I declare TimerProc() in COM class as:
VOID CALLBACK TimerProc(
HWND hwnd, // handle to window for timer messages
UINT message, // WM_TIMER message
UINT idTimer, // timer identifier
DWORD dwTime) ; // current system time
and define as:
VOID CALLBACK TimerProc(
HWND hwnd, // handle to window for timer messages
UINT message, // WM_TIMER message
UINT idTimer, // timer identifier
DWORD dwTime) // current system time
{
// Do something
}
But I've got a compiler error:
error C2440: 'type cast' : cannot convert from '' to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
None of the functions with this name in scope match the target type
What am I doing wrong ?
|
|
|
|
|
1. If you really "declare TimerProc() in COM class as:... " - this is a mistake, you cannot use in such way member fuction as a callback.
2. If not so, just
void CALLBACK TimerProcedure(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTimer)
{
//some_action;
}
STDMETHODIMP CZZZControl::SomeMethod()
{
m_nEvent = ::SetTimer(some_params);
}
3. May be you are trying to use not ::SetTimer, but CWindow::SetTimer
Wish you luck!
|
|
|
|
|
First of all Thanks for your help.
I have found at MSDN site that for MFC application it is necessary to declare a callback function as a static, so I did and now it works fine.
Dimitri.
|
|
|
|
|
Hi, friends,
Who can run the MTS sample: SampleBank provided by MTS. Whether I should create a database in SQL server first?
|
|
|
|
|
in MTS 2.0, you can not find the sample, so who can help me?
|
|
|
|
|
I deleted an interface method and and tried to add it again but I get the following errors twice when compiling:
...\include\atlcom.h(1827) : error C2259: 'CComObject<class cessunit="">' :
cannot instantiate abstract class due to following members:
...\include\atlcom.h(1823) : while compiling class-template member
function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class
cessunit=""> >::CreateInstance(void *,const struct _GUID &,void ** )'
...\include\atlcom.h(1827) : warning C4259: 'long __stdcall
IESSUnit::ClassDescription(void)' : pure virtual function was not defined
...\esscounit.h(205) : see declaration of 'ClassDescription'
...\include\atlcom.h(1823) : while compiling class-template member
function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class
cessunit=""> >::CreateInstance(void *,const struct _GUID &,void ** )'
I've tried removing every instance of 'ClassDescription', restarting DevStudio and rebuilding the entire COM. I've tried adding the method without arguments. Nothing works. Any suggestions?
Dave
Dave
http://www.unit-conversion.com
http://www.essco.co.uk
|
|
|
|
|
hey Dave,
Devstudio also generates a .rgs file, look inside and you'll find that it like a .reg file.
You can manually update this but its like modifing generated code...
If your up to it, recreate the project and re-add the methods.
Let me know how you go.
Jules
|
|
|
|