|
I have an interface, I1 declared in library A, I use I1 in library B by writing code like
///////////////// begin /////////////////////
import "A.idl"
[
object,
uuid(...),
......
]
interface I2 : IDispatch{
[propget, id(1), helpstring("...")] HRESULT I1([out, retval] I1** prop);
};
///////////////// end ///////////////////
Both project A and project B built all right.
Now I import A.tlb and B.tlb in project C, and write following code
///////////////// begin /////////////////////
CComPtr < I1> spI1;
///////////////// end ///////////////////
compil failed with message error C2872 : "I1" : ambiguous symbol . While what I hope is only one I1, but now there are two.
How to resolve this problem?
|
|
|
|
|
Since you have import A.idl in B.idl, it would be enough to import only B.tlb.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Is there any other way to use I1 in B.idl except import?
What I really wonder is how to build a software structure like MS Office. In Office, the _CommandBars is in mso.dll, WinWord.Application is in WinWord.EXE, when I import MSWORD.OLB I can find there is code like "virtual HRESULT __stdcall get_CommandBars (
/*[out,retval]*/ struct Office::_CommandBars * * prop ) = 0;" in msword.tlh.
How it happens?!! In my projects, I import B.tlb, there is only "virtual HRESULT __stdcall get_I1 (
/*[out,retval]*/ struct I1 * * prop ) = 0;", while I am looking for "virtual HRESULT __stdcall get_I1 (
/*[out,retval]*/ struct A::I1 * * prop ) = 0;"
modified on Saturday, September 26, 2009 11:36 PM
|
|
|
|
|
You should use "importlib" in "library" section instead of "import" or in addition to "import".
With best wishes,
Vita
|
|
|
|
|
Make Extra Cash At Home Typing Ads for Companies. Work Part/Full-Time. Register Online Today! You are Paid per ad typed PLUS commissions. Sign up Today at http://www.clicknearn.net/3152-6.html
|
|
|
|
|
Don't post your spamming crap here, thank you very much!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
I've been experimenting with this for weeks with no success. Basically, what I wanted to do is to use mshtml to render a html page in an ordinary window (form, or control), but I don't want to create a webbrowser object (from the shdocvw.dll or anywhere else)! MSHTML is claimed to be a html parser, renderer, and editor, I think it'd be neat and beautiful to just use it to render a html page in any winodw without the extras from a webbrowser object. I've tried over ten example projects from this website and they all need to create a webbrowser object one way or another, which seems redundent or which is a necessary step? Any ideas from you all?
|
|
|
|
|
I'm pretty sure you would need a control which is capable of rendering HTML like the web browser control or a word document object.
I believe MSHTML is a parser of HTML and not a renderer.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I am not sure about what you believed since according tp msdn:
"Mshtml.dll is at the heart of Internet Explorer and takes care of its HTML and Cascading Style Sheets (CSS) parsing and rendering functionality. "
|
|
|
|
|
Rendering is always done by a control. Examples.... web browser control, media player control, a view, edit box.... Something that is visible.
Does MDHTML have any such visible views?
You certainly will not able to render HTML in an edit box.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hello everyone,
I am creating the ATL COM project using VC++ in VS2008.
My project need to access the database from the mysql.
I have installed the mysql ODBC connector.
Please tell me how to connect to mysql through
my ATL COM project and how to insert , delete data from the tables present in my database.
|
|
|
|
|
Now i am able to do that.
i can connect to mysql,edit,delete and insert a
new record in the database.
|
|
|
|
|
how to write corba application from java to java????????
|
|
|
|
|
This looks like a java question; I would suggest you post it to the Java forum.
|
|
|
|
|
Hi,
Again I am here with new one.
Following is the code , I am attaching the instance of excel to active excel.
Excel::_ApplicationPtr XL;
Excel::_WorkbookPtr book;
string XLWBName;
try
{
CoInitialize(NULL);
HRESULT hr = XL.GetActiveObject(_T("Excel.Application"));
book = XL->;Workbooks->;Item[1];
XLWBName = book->Name;
return true;
}
catch(_com_error &error)
{
cout << "COM error"<< endl;
return false;
}
I implemented this in two applications:
In 1st application it is working perfectly , after coinitialize i kept the breakpoint then it is called 2 methods from comip.h
1st is:HRESULT GetActiveObject(const CLSID& rclsid) throw()
2nd is: HRESULT GetActiveObject(LPCWSTR clsidString) throw()
In 2nd application it is not working and checked the sequence of methods calling from comip.h, its calling only one method that is :
HRESULT GetActiveObject(LPCWSTR clsidString) throw()
Checked the value of book and other instances:
((*(IUnknown*)(&(*(IDispatch*)(&*((book).m_pInterface)))))).__vfptr
__vfptr = CXX0030: Error: expression cannot be evaluated
[0] = 0x0046d5b0 _com_error::`scalar deleting destructor'(unsigned int)
__vfptr = 0x004f5af4 const _com_error::`vftable'
please give me clue where I am doing wrong or something need to be added?
Regards,
Gtag
|
|
|
|
|
Is the second application compiled with Unicode turned on? Because your passing an LPCTSTR (which can be ASCII or Unicode, depending on pre-processor macro settings) to GetActiveObject, where you are meant to pass an LPCWSTR
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Sorry I am new to this, I searched for this option, i didn't find it?
Please tell me where I can find this option in Microsoft visual studio 2008(Professional edition).
Regards,
gtag
|
|
|
|
|
Don't worry too much about that - just make sure you use
L"Excel.Application"
instead of
_T("Excel.Application")
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I changed it , but same issue.
Is there any other way?
Regards,
Gtag
|
|
|
|
|
What HRESULT was returned from GetActiveObject?
Was Excel running when you did the GetActiveObject call?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hr = 0x800401e3 Operation unavailable
Excel was running.
With other application I can attach with both option s _T or L.
Even can read xlworksheet names and all.
Regards,
Gtag
|
|
|
|
|
gtag wrote: hr = 0x800401e3 Operation unavailable
Right - well that explains why you weren't getting a pointer to the Excel application. Doing a quick Google (you know, like you could have done) brings up this MS support page[^] which deals with your scenario.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Surely I will check out the blog u mentioned.
After doing little analysis on both the applications I have got few inputs for not getting attached to active object, but solution I couldn't?
Following are the functions called from comip.h
HRESULT GetActiveObject(const CLSID& rclsid) throw()
{
_Release();
IUnknown* pIUnknown;
HRESULT hr = ::GetActiveObject(rclsid, NULL, &pIUnknown);
if (SUCCEEDED(hr)) {
hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface));
pIUnknown->Release();
}
if (FAILED(hr)) {
// just in case refcount = 0 and dtor gets called
m_pInterface = NULL;
}
return hr;
}
// Attach to the active object specified by clsidString.
// First convert the LPCWSTR to a CLSID.
//
HRESULT GetActiveObject(LPCWSTR clsidString) throw()
{
if (clsidString == NULL) {
return E_INVALIDARG;
}
CLSID clsid;
HRESULT hr;
if (clsidString[0] == '{') {
hr = CLSIDFromString(const_cast<LPWSTR> (clsidString), &clsid);
}
else {
hr = CLSIDFromProgID(const_cast<LPWSTR> (clsidString), &clsid);
}
if (FAILED(hr)) {
return hr;
}
return GetActiveObject(clsid);
}
Of these functions one func is having "_Release();" . This is not getting called in one of my application and error is which i mentioned in previous post.
I wonder that same code works perfectly in one application on same pc and in other it's not.
Anyway I will check the workaround thing which u mentioned.
Thank you
Regards,
Gtag.
|
|
|
|
|
Read the page I pointed you at. Don't bother digging through the Microsoft library code - the error is not in that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|