|
Somewhat linked.
I managed to get ahead with this:
I created a completely new server with different interface names
and new GUIDs under VC6.
I got it to work on my client's app as long as I make a call to
CoCreateInstance(). Also worked on my VC7 client.
The only thing (though I dont need to use) is that if I make a call
to the CF directly and the try to CreateInstance() it fails.
and it still doesnt work with wih _com_ptr_t<>.
Another curiosity:
Even though my server tlb and dll are registered and they work, when
I try to access the object using the OLE/COM View->All Objects it crashes
the utility program.
Other objects listed allow me to click on them and see the interfaces.
Not mine. but I am getting there little by little
Thanks again for your help
Odie
|
|
|
|
|
odiesback wrote: when
I try to access the object using the OLE/COM View->All Objects it crashes
the utility program.
This sounds like you have contaminated the registry with incorrect and/or obsolete information.
Does the viewer crash when you're expanding the leaf in the tree view, or does is crash when you select your server? Describe it some more.
Is it a new behaviour or has the viewer crashed whenever you've tried to browsing your COM servers?
However, it should be fairly certain that the error is connected to the server and not the client.
Try and search the registry for CLSID values, ProgIDs, TLIDs etc generated for your server(s).
First you may want to try to unregister your server and fire up the OLE/COM viewer again to verify that the "contaminating information" is still making the viewer crash. If not, then you know its in the information that gets registered with your current server.
Your first aim to shoot for would be not to crash the OLE/COM viewer while browsing/viewing your server and its type library.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Hi Roger,
I started on a brand new lib and interfaces, coclasses, .idl etc.
I manage to trace the error to my DllGetClassObject() implementation
where I improved the code a little.
Then I created three clients: one using CoCreateObject(), the other using
CoGetClassObject()->CreateInstance() and lastly one using _com_ptr_t<>.
:-DALL WORKED GREAT
The only thing remaining:
On the OLE/COM Viewer now I can open my object under "All Object" (my constructor
MessageBox kicks in) but it shows me the "IUnknown" interface (It might be that
my reg file does not carry info for the other ifaces)
When I double click on my Type Lib icon I get this error:
LoadRegTypeLib({C3CA0811-45B1....},1,0,1033,...) failed.
Error loading type library/DLL
TYPE_E_CANTLOADLIBRARY($80029C4A)
Other than that all is fine (for now )
Thanks again
Odie
|
|
|
|
|
odiesback wrote: Other than that all is fine
That's nice to hear(read?!?)
Regarding your typelib...
Have you verified that the path to your typelib is correct?
Open the registry and have a look at the value of HKCR\CLSID\<yourserverclsid>\TypeLib and verify its existance. Open the typelib key under HKCR\TypeLib\YourTypeLib\1.0\0\win32 and verify that the path given in the default value is correct. If the path points out your server you have to verify that you have included the typelib information in the server.
In VC6 you do this by adding a 'TEXTINCLUDE 3' resource in the .rc file looking similar to 1 TYPELIB "server.tlb" . I suspect it would be same in VC7.
Any errors when you're building the typelib (MIDL compiler)?
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Roger Stoltz wrote: Any errors when you're building the typelib (MIDL compiler)?
No, no erros there
Roger Stoltz wrote: HKCR\TypeLib\YourTypeLib\1.0\0\win32 and verify that the path given in the default value is correct
I had registered the .dll and changed to .tlb and WHOA!!!
My Type Lib icon opens great and displays my .idl and all
interfaces. (it made my day at 7:00am PST)
I will frame my code to the wall
Thanks for your time in helping me with this
Odie
|
|
|
|
|
How to get the right URL before navigating the web page in the CHtmlView?
Class CHTMLControl derived from CHtmlView, and over load the virtual function OnBeforeNavigate2.
I Navigate an URL as following:
CHTMLControl* pHTMLControl;
…
pHTMLControl->Navigate2(strURL);
In the opened web page, there is a link whose html code is below:
<A href='javascriptclickProcess("search");'>Free Search</A>
After clicking on this link in the html view, the following function is called
void CHTMLControl::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel)
But in this function, the value of lpszURL is "javascriptclickProcess("search");"
How can I get the right URL of the next page before navigating it?
Thanks
|
|
|
|
|
Hi superhandwolf,
You can get the actual URL in the event "DocumentComplete", in your perticular
case it will search for the given text and then gives you the actual URL for
search result page...
If you try to get the URL in OnBeforeNavigate2(...) using the 1 param i.e.
IDisp. it would return you the current page's URL (i.e. page currently rendered
)
"DocumentComplete" OR "DownloadComplete" can give you the URL...
Cheers,
Vishal
-- modified at 6:19 Thursday 20th October, 2005
|
|
|
|
|
I am new to COM so which book is better to learn.
Thank you CodeProject
|
|
|
|
|
|
Perhaps more information on the nuts and bolts of how one actually *writes* this software may be helpful.. I have a step-by-step DCOM tutorial, where I build a simple server which says "Hello, world!" back to the client, may help put some of this in practical perspective...
The tutorials are written as a series of separate articles, called Steps, which cover the major breakpoints in the development of the system.
Step 1 of the tutorial for VC 6 is at
http://www.codeproject.com/com/HelloTutorial1.asp[^]
And Step 1 of the turtorial for Visual C++.NET 2003 is at
http://www.codeproject.com/useritems/HelloTutorial1NET.asp[^]
I tried to write the tutorials in Microsoft-ese, so you can follow along as if you were reading the Scribble tutorial. The VS.NET version is still a work in progress; that's why it's still in "Unedited User Constributions."
Not all the Steps have been written for the VS.NET version yet. But I am working on it!
Stay tuned!
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Hi,
How to Create DLL. Pls can u explain?
Thank you CodeProject
|
|
|
|
|
Hi,
Pls give me Answer this question.
What is TypeLibrary(tlb)? When it is used? why it is used?
Thank you CodeProject
|
|
|
|
|
Santosh Kumar79 wrote:
What is TypeLibrary(tlb)? When it is used? why it is used?
Please first try google before posting here... this willsave your lot of time
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I Want some Information.
What is IDisptch?Why this is used?
Thank you CodeProject
|
|
|
|
|
Santosh Kumar79 wrote: What is IDisptch?Why this is used?
IDispatch Interface[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
What is CoCreateInstance and
What is deifference between CoCreateInstance and CoCreateInstanceEx. Pls Explain?
Thank you CodeProject
|
|
|
|
|
Santosh Kumar79 wrote:
CoCreateInstance
CoCreateInstance[^]
Santosh Kumar79 wrote:
What is deifference between CoCreateInstance and CoCreateInstanceEx
See Remark [^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Perhaps more information on the nuts and bolts of how one actually *writes* this software may be helpful.. I have a step-by-step DCOM tutorial, where I build a simple server which says "Hello, world!" back to the client, may help put some of this in practical perspective...
The tutorials are written as a series of separate articles, called Steps, which cover the major breakpoints in the development of the system.
Step 1 of the tutorial for VC 6 is at
http://www.codeproject.com/com/HelloTutorial1.asp[^]
And Step 1 of the turtorial for Visual C++.NET 2003 is at
http://www.codeproject.com/useritems/HelloTutorial1NET.asp[^]
I tried to write the tutorials in Microsoft-ese, so you can follow along as if you were reading the Scribble tutorial. The VS.NET version is still a work in progress; that's why it's still in "Unedited User Constributions."
Not all the Steps have been written for the VS.NET version yet. But I am working on it!
Stay tuned!
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Hi, Some one can help/guide me how to debug the COM C++ DLL. I built both DLL and EXE, which is using this DLL, in debug mode. My main COM/MFC application (EXE) loads/uses this DLL. I tried specifying my executable in "Project Settings -> Debug -> General -> Executable for Debug session" of COM C++ DLL project and with putting breakpoint in DLL. But unfortunately the execution didn't stop at my breakpoint and continues to execute my application.
Any help will be appreciated in this regard.
|
|
|
|
|
Make sure you are in "DEBUG" mode. And that the debug version of your dll not the release verions is registered.
|
|
|
|
|
Hi ,
I have developed one dll and it is working fine in debug build however it is giving me following below error in ReleaseUMinSize build. Can you help me to resolved this issue.
Linking...
Creating library ReleaseUMinSize/PLUManager.lib and object ReleaseUMinSize/PLUManager.exp
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseUMinSize/PLUManager.dll : fatal error LNK1120: 1 unresolved externals
Thanks
Pankaj
|
|
|
|
|
Excel enables the creation of user-defined functions that can be used in Excel formulas. So I use these code to create a COM introp.
-------------------------------------------------
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace AutomationAddin {
[ClassInterface(ClassInterfaceType.AutoDual)]
public class MyFunctions {
public MyFunctions() {
}
public double MultiplyNTimes(double number1,
double number2, double timesToMultiply) {
double result = number1;
for (double i = 0; i < timesToMultiply; i++) {
result = result * number2;
}
return result;
}
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type type) {
Registry.ClassesRoot.CreateSubKey(
GetSubKeyName(type));
}
[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type type) {
Registry.ClassesRoot.DeleteSubKey(
GetSubKeyName(type), false);
}
private static string GetSubKeyName(Type type) {
System.Text.StringBuilder s =
new System.Text.StringBuilder();
s.Append(@"CLSID\{");
s.Append(type.GUID.ToString().ToUpper());
s.Append(@"}\Programmable");
return s.ToString();
}
}
}
-----------------------------------------------------
And set project build property,checked output item,register COM interop.
Building the project,that's success.
Launch Excel and choose Add-Ins from the Tools menu to display the Add-Ins dialog. In the Add-Ins dialog, click the Automation button. But I can't find the class I created by looking for AutomationAddin.MyFunctions in the list of automation servers.
What's wrong? Please help me !Thanks,by the way,My development tool is VS2005 ,Office 2003 (sp2)simply chinese.
|
|
|
|
|
We have a product that does the following:
* starts up as service
* spawns of n threads that actually do work. All of these threads do the same thing, which is to automate a COM server to produce a result.
After about 1000 transactions have run through the process, it starts to get the hexadecimal value above as a return code. This is not always the case, and the error is in fact quite intermittent.
The call that fails is a very simple call on a smart pointer to a home-grown DCOM object.
Anyone run into this before? Any thoughts?
My first instinct is that it's one of those bizarre interplays between threads and memory and that at some point some thing just loses it's mind (very technical, I know
Thanks.
Also, please forgive me if this should be in the threading forum. I thought I'd start here since I KNOW that COM is involved, and only suspect threading.
Joe Hayes
|
|
|
|
|
Well, if the return code could be interpreted as an error code it would be CO_E_OBJNOTREG meaning that the object is not registered.
I suspect that the smart pointer call creates an object, or in this case tries to create an object.
Hope this helps
--
Roger
|
|
|
|