|
juz go thru the links below..
1[^]
2[^]
rgds..mil10
|
|
|
|
|
I am a newbee on .Net C++. Just bought it.
Reading the book. Read the (short) chapter
on COM. Basically it said, one can keep ones
COM code. My question... Is there a BETTER
way in .Net?
I have a application with COM supplied solutions
to common user needs.
As I am moving to .Net -- I have the opportunity
to provide those solutions through .Net rather
than via COM servers.
A recommendation of where to read would be
appreciated.
WedgeSoft
|
|
|
|
|
Good Question. My impression is that .NET took the best concepts that COM developed and incorporated them into it's internal structure. There are profound differences, though. In his book, ".NET and COM: The Complete Interoperability Guide", Adam Nathan describes the .NET Framework as an evolution of COM. I recommend you read that book, it thoroughly describes writing code that understands how to interoperate in both the 'COM world' and the '.NET world'. The engineers at Microsoft put alot of work into making COM type libraries operate in managed applications as if they were .NET components.
There are some HUGE differences, though. You'll notice immediately that the types are considerably different, and marshaling data between two disparate types is difficult. The .NET compiler includes some excellent utilities to help the developer with COM interop. Check out the The OLE/Object Viewer, the Type Library Importer (TypImp.exe) and the IL Disassembler.
|
|
|
|
|
need to know some COM stuff, can someone kindly recommend a good/popular COM/COM+ book?
|
|
|
|
|
I got a good deal out of Developers's Workshop to
COM and ATL 3.0 by Andrew W. Troelsen. I knew
nothing about COM -- read the book and did the
exercises. Now my project has COM support.
(This is a beginners COM book; but not for
beginner C++ programmers.)
Modified:
(And read the reply to my question about a
.Net alternative to COM -- there Zeta makes
a recommendation to me.)
WedgeSoft
|
|
|
|
|
One of the principal references for COM is: "Essential COM", by Don Box, published in 1998. He writes for the C++ developer (all the code examples are C++). But, he explains everything clearly and thoroughly. Retails for $45.
|
|
|
|
|
I wrote a COM Server using ATL wizard, so i made a DLL, and want to use it on another machine - but, when i try to register my server using regsvr32 i have next message:
"LoadLibrary("the way to my dll") failed. The specified module could not be found".
Where the problem is???
|
|
|
|
|
Simply it tries to say, that some library your dll depends on is missing. I would suspect, that you built your dll with dependency on msvcrt libraries that are supplied with VC.
You can either redistribute the dlls or you can build it with no dependency using static linking - see project settings of your project.
Anyway, you can check the dependency with the depends tool from the SDK.
|
|
|
|
|
Yes, i built my programm with static linking method. And i noticed one thing, if Visual Studio and Active Sync installed on machine, my dll registers successfully, but if one of theme is apsent it writes an error. I tried to use dependecy utility, found all the dlls and copied them with my COM dll on another machine, and still have error.
|
|
|
|
|
Well, simply, if the LoadLibrary function in the regsvr utility failed, there's still something missing - did you copied all the dlls your library depends on into the same path, or somewhere where it can be found by LoadLibrary ?
Or possibly, there can be dll missing that is required by some of the dlls you are depending on.
By static linking in VC I mean what you find in Project properties , C++/Code Generation and Runtime Library setting.
Here should be /MT or /ML .
|
|
|
|
|
Thanks!
I've been having the same problem and it's been driving me
nuts for a week. I could not figure out what was going on.
My new dll made use of other dll's, and I didn't have them
in the path.
|
|
|
|
|
Hi,
This following code in a console application:
CoInitialize(0);
HRESULT hr;
SHDocVw::IShellWindowsPtr spSHWinds;
hr = spSHWinds.CreateInstance (__uuidof(SHDocVw::ShellWindows));
====> Returns 0x0x80040154 - Class not registered.
Can someone please help me why I am getting this error?
Any help would be greatly appreciated.
SenPy
|
|
|
|
|
hm. try to specify as argument ProgId. smth like, "SHDocVw.SHDocVw" or "{A21A4187-5A86-4E26-B40A-856F9035D93B}" - clsid of your component.
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
I have an ActiveX control which displays models containing a huge number of facets in OpenGL. I use recursion during the building of the models and unfortunately am overflowing the stack.
How does one increase the size of the stack in a COM/ATL dll?
I've tried the compiler option '/F' and linker option '/STACK' without any luck. Is there a way to do this programmatically?
Thanks in advance!
Emil
|
|
|
|
|
As far as i recall, the stack size is not related to a DLL, its the process including the DLL that is deciding on its stack size.
Depending on the amount of information stored on the stack, it would probably be better if you kept only a pointer to a struct with the info you need at each level of recursion. You could event count the recursion level and keep some information into an array that is dependant on the recursion level.
Here are a few points you might want to investigate too.
How many levels deeps are you getting into ?
Are you sure you're not simply entering an infinite recursion which does overflow the stack.
Is the recursive function having too many parameters, could you simplify these parameters and pass in a struct pointer ?
Are there too many local variables in my recursive function ?
Every time you enter a function, there is a number of bytes being reserved in the stack, each parameter passed to a function could be taking some stack space so if you recurse on a function that requires 40 bytes for its parameters it can add up quickly. Also, local variables do take space on the stack.
Having a recursive function with "char somearray[512]" isnt convenient in a recursive function since on each recursion level, 512 bytes will be reserved for that level.
|
|
|
|
|
Hello I'm new to COM and ATL. I need some help regarding add-ins. I want to make an add-in for the Visual Basic Editor, displayed as a dialog-style window, using Visual C++. I know that COM and ATL are used, but I have no idea how to start.
Also, the displayed dialog needs to keep track of the currently selected item (i.e. a Form, or a control within a Form) and read it's properties (color, text, etc.).
I have looked over the articles discussing add-ins, but they don't address my situation. Any help would be greatly appreciated.
Thanks.
|
|
|
|
|
Hi,
Here is the part of the EXE code:
if (FAILED (CoInitialize (NULL)))
{
return FALSE;
}
...
...
HRESULT hr;
IWebBrowser2* pWebBrowser = NULL;
hr = CoCreateInstance (CLSID_InternetExplorer, NULL,
CLSCTX_LOCAL_SERVER, IID_IWebBrowser2,
(LPVOID*)&pWebBrowser);
====> hr is 0x80070005 - Access is denied.
This is happening only with Windows XP/SP2. On the same PC with SP1, it works fine also it works fine on W2K.
Can someone PLEASE help me to solve this issue?
Thanks
SenPy
|
|
|
|
|
Maybe you now need to CoInitializeSecurity() ?
XP2 now has a more secure web browser system and this is a good thing.
|
|
|
|
|
|
Hi
I have handle to window to activeX control i want to get Idispatch of
this control in other thread. I use following code in same thread to
get interface pointer but when i call same function in other thread
it does not work
void fn(HWND *h)
{
::CoInitialize(NULL);
CWnd *c=CWnd::FromHandle(h1);
LPUNKNOWN pUnk =c->GetControlUnknown();
::wsprintf(a,"%p",pUnk);
::AfxMessageBox(a,0,0);
if(pUnk)
{
LPDISPATCH pDisp=NULL;
pUnk->QueryInterface(IID_IDispatch, (LPVOID*)&pDisp);
//doing some function with idispatch
}
}
this function works fine in one thread but in other thread it return
Iunknown pointer NULL. If any body knows solution plz reply me as
soon as possible. Remember i am not working with control that
register themselves i mn working with MSFlexGrid control.
Thanx in advance
Danish Ali
|
|
|
|
|
in one thread all is fine because u are in one apartament. to access interface in another thread i use COM marshaling. CoMarshalInterThreadInterfaceInStream<->CoGetInterfaceAndReleaseStream functions or GIT table.
but i didn't use it on remote threads. hm. maybe this is the part of sollution.
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
thnx for reply but what u r saying is good when i m creating
my own controls but i m not creating new ActiveX control. I m using the one that already exsist like MSFLEXGRID and others......... it is not necessary that i should access it from other thread but if i can access from the same thread it is also fine i m basicaly injecting code in running process to get the properties of activeX control ......... Recently i got succeded it through subclssing but the code i use was of MFC so it was working fine on applications build in MFC but it is not working on other application like the ones build through VB I was accessing the same control MSFlexGrid but it doesnot work there.....
Plz reply ASAP
|
|
|
|
|
Hi, I am a little new to the code project. Any way, I have Windows ME and do not have the Microsoft .Net FrameWork. I was wondering if their is a program that can notify me when i get new mail. I would like it if it can surport 2 gmail acounts(My Father and I have one gmail account each and we share the same computer). I would like it to stay in the System tray. I will give a gmail invite to the one you can find a program that I can use. Thanks
|
|
|
|
|
Wrong forum ?
I believe this should be going in the lounge, no?
|
|
|
|
|
may be he like to go for GMAIL forum
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|