|
actually it is a seperate class and i want to use it's object as the argument,
but it is not declared in IDL file before this statement.
This is actuall IDL file that is created in default
<br />
<br />
import "oaidl.idl";<br />
import "ocidl.idl";<br />
<br />
typedef enum<br />
{<br />
connOracle = 1,<br />
connSQLServer = 2,<br />
connAccess = 3<br />
} dbFlag;<br />
<br />
[<br />
object,<br />
uuid(6DD75115-9828-4BA0-9006-D85B1DFDA2A8),<br />
dual,<br />
helpstring("IADO_DB Interface"),<br />
pointer_default(unique)<br />
]<br />
interface IADO_DB : IDispatch<br />
{<br />
[id(1), helpstring("method ConnectDatabase")] HRESULT ConnectDatabase(BSTR sDatabase,BSTR sUserID,BSTR sPassword,BSTR sServer,dbFlag connDB);<br />
[id(2), helpstring("method DisconnectDatabase")] HRESULT DisconnectDatabase();<br />
[id(3), helpstring("method ExecuteSQL")] HRESULT ExecuteSQL(BSTR sQuery);<br />
[propget, id(4), helpstring("property DatabaseName")] HRESULT DatabaseName([out, retval] BSTR *pVal);<br />
[propget, id(5), helpstring("property SQL")] HRESULT SQL([out, retval] BSTR *pVal);<br />
[propput, id(5), helpstring("property SQL")] HRESULT SQL([in] BSTR newVal);<br />
[propget, id(6), helpstring("property RowSet")] HRESULT RowSet([out, retval] ADO_ROWSET *pVal);<br />
};<br />
<br />
[<br />
object,<br />
uuid(DEAD417C-B1EA-401D-8F8B-55A2207BDB52),<br />
dual,<br />
helpstring("IADO_ROWSET Interface"),<br />
pointer_default(unique)<br />
]<br />
interface IADO_ROWSET : IDispatch<br />
{<br />
};<br />
<br />
[<br />
uuid(440FC80A-7700-4291-B683-7B4B2BE7D9E2),<br />
version(1.0),<br />
helpstring("dbcs07 1.0 Type Library")<br />
]<br />
library DBCS07Lib<br />
{<br />
importlib("stdole32.tlb");<br />
importlib("stdole2.tlb");<br />
<br />
<br />
[<br />
uuid(2A6DE5C6-9BEC-49FE-8626-23D4C9656C93),<br />
helpstring("ADO_DB Class")<br />
]<br />
coclass ADO_DB<br />
{<br />
[default] interface IADO_DB;<br />
};<br />
<br />
[<br />
uuid(74FCF560-93D9-4F15-B477-5A62E529C567),<br />
helpstring("ADO_ROWSET Class")<br />
]<br />
coclass ADO_ROWSET<br />
{<br />
[default] interface IADO_ROWSET;<br />
};<br />
};
if it has any problem pls let me know
Thank you
Regards,
Pankaj Sachdeva
|
|
|
|
|
You could use IADO_ROWSET as argument, not it's coclass.
And need to make forward declaration for interface , before using as parameter.
Prasad
MS MVP - VC++
|
|
|
|
|
Thankx Mr. Prasad i got u it worked
Regards,
Pankaj Sachdeva
|
|
|
|
|
Hi All,
QueryInterface call is failing with RPC_E_SYS_CALL_FAILED HRESULT.
Scenario Description:
When many objects are selected, same operation is performed on those objects. For most the objects, the operation is successful. But for some, problem occurs and QueryInterface fails with RPC_E_SYS_CALL_FAILED. The objects in question are of similar sought.
Please let me know if further clarification is required. I am in a fix due to this error and unable to figure out anything on this.
Any help on this will be greatly appreciated.
Thanks,
Suraj
|
|
|
|
|
Hi
I would like to know if somebody knew how to decode the HRESULT values.
I get 2 different values of HRESULT for 2 of my methods.
There are in hexadecimal : 0x7c839aa8 and 0x7c809ba8 and I would like to know what are their meanings. I think it's not an error, else it would have been something like 0x8.......
Thanks in advance
|
|
|
|
|
Have a look at [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
Go to MSDN to this link ms-help://MS.MSDN.vAug06.en/mobilesdk5/html/mob5lrfHRESULT.htm
and you will see
modified 11-Feb-21 21:01pm.
|
|
|
|
|
hi i want to highlight some text,when the web page first loads through
toolbar, i have used Iobjectwithsite class to notify when page is about to
load etc,i have registered a event handler that notifies me that document is
completely loaded,then i hightlight some text.this solution works fine on
normal webpages, but it fails on AJax enabled wesites bcos these site are not
completed(loaded to browser at once), here is event handler which i m
using,what other event handler should i use that work with AJAX enabled site
as well.
Explorer.DocumentComplete += new
SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(Explorer_DocumentComplete);
Regards.
Tasleem Arif
|
|
|
|
|
Hi.
We're working on migrating a system from vb6 to .Net 2.0, but we've run into a problem. Calling the old vb6 com objects from the new .Net code works fine, and vice versa. However, when using one of the old com objects as parameters in calls from the new .Net code to either old vb6 com objects or the new .Net com objects, things don't work quite as well, and I get an error like this one:
System.Runtime.Remoting.RemotingException : The argument type 'System.__ComObject' cannot be converted into parameter type 'XMLEntities._IXMLEntity'.
The method signauture in this example is:
Public Overrides Function UpdateEntity(ByRef objEntity As _IXMLEntity, ByRef objParent As _IXMLEntity, ByRef ilngBrukerOrganisasjonsNr As Integer) As Object
and the call something like this:
object svar = tomtWriterNew.UpdateEntity(ref object1, ref object2, ref brukerOrganisasjonsNummer); (yeah, we're mixing vb6 and c# a bit, but hey, it's only a test project).
Have anyone ecountered a similar problem and know what happens and how to solve it? Any input would be appriciated. It is quite possible to do a workaround of the problem, but it would be nice to know what's going wrong because it's something I feel we will run into again in the future.
|
|
|
|
|
I have an application in which I want to initialize a COM object.
I have included objbase.h and ole32.lib in the workspace. I have also declared the following in the header file
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT = 0x0500
#define _WIN32_DCOM
But still I get the following errors
error C2065: 'CoInitializeEx' : undeclared identifier
error C2065: 'COINIT_MULTITHREADED' : undeclared identifier
WHY SO??
|
|
|
|
|
koumodaki wrote: I have included objbase.h and ole32.lib in the workspace
In the workplace? Have you included the headers into the proper source files?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yes I have...declarations are in stdafx.h and my applications cpp has this file included
|
|
|
|
|
koumodaki wrote: #define _WIN32_WINNT = 0x0500
The first problem is you need to remove the equals sign from the second #define .
|
|
|
|
|
Hi
I'm working on a program which connects to a machine and then has to do provisionning. For the moment the connection works. I work with an API which operates with requests and confirmations. Each composant of the API implements 3 interfaces : an interface for the request Ixxx, an interface for the events IxxxEvents and the IUnknown interface (COM/DCOM).
I can do all the requests I want. But my problem is, I have never a confirmation. The confirmations are fontions which have to be implemented but, if i do right understand, that I don't have to call.
I saw in COM/DCOM documentation that I had to create connection points in order to receive automatically the confirmations corresponding to the requests. I think my error is in the Advise() function. I don't know what I have to pass for the first parameter in this function.
I saw on internet that the first parameter is a pointer on the IUnknow interface of the sink object. But I don't really understand what is the sink object here. Do I have to create a class ? A class that inherits from something ?
I don’t understand also how I have to implement the QueryInterface method() in the case of the IID is the IUnknown identifier.
Here is a portion of my code for the connection points, the 2 interfaces are ITCSUser and ITCSUserEvents.
HRESULT hres;
IConnectionPoint* m_pITCSUserCP;
DWORD m_UserEventsCookie;
IUnknown * pIUnknown = NULL;
hres = pITCSUser->QueryInterface(IID_IUnknown, (void**)&pIUnknown);
hres = GetConnectionPoint(__uuidof(ITCSUserEvents), pITCSUser,&m_pITCSUserCP);
if (SUCCEEDED(hres))
{
m_UserEventsCookie = 0;
hres = m_pITCSUserCP->Advise(pIUnknown, &m_UserEventsCookie );
}
// Finds a connection point (riid) from an interface.
HRESULT GetConnectionPoint(REFIID riid, IUnknown* pObj,
IConnectionPoint** pCP)
{
IConnectionPointContainer* pCPC = NULL;
HRESULT hRes = pObj->QueryInterface(IID_IConnectionPointContainer,
(void**)&pCPC);
if (SUCCEEDED(hRes))
{
hRes = pCPC->FindConnectionPoint(riid, pCP);
}
pCPC->Release();
return hRes;
}
STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppv)
{
if ( iid == __uuidof(ITCSUserEvents) )
{
*ppv = static_cast<itcsuserevents*>(this);
}
else if ( iid == __uuidof(ITCSDataEvents) )
{
*ppv = static_cast<itcsdataevents*>(this);
}
else if ( iid == __uuidof(ITCSRadioSubscriberManagerEvents) )
{
*ppv = static_cast<itcsradiosubscribermanagerevents*>(this);
}
else if ( iid == __uuidof(ITCSGroupManagerEvents) )
{
*ppv = static_cast<itcsgroupmanagerevents*>(this);
}
else if ( iid == __uuidof(ITCSSystemManagerEvents) )
{
*ppv = static_cast<itcssystemmanagerevents*>(this);
}
else if ( iid == __uuidof(IUnknown) )
{
*ppv = static_cast<itcsuserevents*>(this);
}
else
{
*ppv = 0;
return E_NOINTERFACE;
}
return S_OK;
}
Thanx in advance !!
|
|
|
|
|
Nath9999 wrote: But my problem is, I have never a confirmation. The confirmations are fontions which have to be implemented but, if i do right understand, that I don't have to call.
You need to add the function declration in the component for the dispatch Interface and Click "Implement Connection Points" by right clicking on the coclass.Then you will get the Fire event for the method which calls the client function.
Nath9999 wrote: Do I have to create a class ? A class that inherits from something ?
Yes ,you need to derive a class from CCmdTarget and call the Advise and Unadvise Member functions.This class is known as sink class.You write the Fire Method implementation in the sink class(This will be called by Component).
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
I resolved the problem for reading registry (see last entry for that problem) and now I have the following error when trying to run the COM. This error occurs in main() method for my .exe project as follows:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
****HERE**** Application.Run(new FormXXXXXCS());
}
The runtime has encountered a fatal error. The address of the error
was at 0x7f5dd68b, on thread 0xdf4. The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code. Common sources of this bug include user
marshaling errors for COM-interop or PInvoke, which may corrupt the
stack.
Does anyone know what is causing this and how to solve.
Michael
|
|
|
|
|
0xc0000005 is access violation. Possibly in the COM component being accessed.
If you can post the call stack, we can find the cause. Do you have source code of COM compoent?
Also, are you using COM Events?
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
No I don't have the source code. The COM works fine if executed from an .exe project but not as a Library, why would that be.
Michael
|
|
|
|
|
If the COM wroks fine in Exe and not as a library then finger point to the marshalling problem, can you please check whether the library and the application loads in the same AppDomain
Regards,
Sunil Tonger
|
|
|
|
|
Since I am new to COM programming, I would like to know, Why we need COM? What is the advantage of using COM? And what is the difference between COM and COM+?
Please provide me if any link is avilable for the above questions.
Thanks in Adv,
Nandu
|
|
|
|
|
|
Sounds like a university project to me...
|
|
|
|
|
Wow, for your wide questions you should reed INSIDE COM to get little answer.
|
|
|
|
|
Hi,
When I am trying to automate MS Word (32 bit) from a NT Service (32 bit) using COM.
The word runs as a 64 bit application (as evident from the task manager).
But if the same code is run as a thread from a Windows application word runs as 32 bit.
How can I automate word to run as 32 bit from the NT sevice??
Thanks,
Indra
code that I am using:
VARIANT root[64] = {0}; // Generic IDispatchs
VARIANT parm[64] = {0}; // Generic Parameters
VARIANT rVal = {0}; // Temporary result holder
int level=0; // Current index into root[]
// Initialize the OLE Library...
OleInitialize(NULL);
// Line 1: Set oWord = CreateObject Word.Application
CLSID clsid;
CLSIDFromProgID(L"Word.Application", &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER|CLSCTX_INPROC_SERVER, IID_IDispatch, (void **)&rVal.pdispVal);
rVal.vt = VT_DISPATCH;
VARIANT oWord = {0};
VariantCopy(&oWord, &rVal);
VariantClear(&rVal);
// Line 2: oWord . Visible = 1
rVal.vt = VT_I4;
rVal.lVal = 0;
VariantCopy(&root[++level], &oWord);
hr = AutoWrap(DISPATCH_PROPERTYPUT, NULL, root[level].pdispVal, L"Visible", 1, rVal);
VariantClear(&root[level--]);
VariantClear(&rVal);
// Line 3: oWord . Documents . Open C:\\Test.doc
VariantCopy(&root[++level], &oWord);
hr = AutoWrap(DISPATCH_PROPERTYGET|DISPATCH_METHOD, &root[level+1], root[level++].pdispVal, L"Documents", 0);
The purpose of the AutoWrap function in this sample is to wrap the calls for GetIDsOfNames and Invoke to facilitate automation with straight C++.
|
|
|
|
|