|
You cannot pass pointers between COM-objects.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
The variant, which contains the pointer to long value, has .vt==VT_BYREF|VT_I4 and .plVal==&long_variable.
long i = 77;
VARIANT vi;
vi.vt = VT_BYREF | VT_I4;
vi.plVal = &i;
With best wishes,
Vita
|
|
|
|
|
We got old COM component and it's used to retrieve ASP built-in objects. The COM component is using IScriptingContext interface. As per MSDN, it's an obsolete[^] interface and it suggest to use the IObjectContext interface.
Anybody know more about this. In meanwhile I will continue my search on MSDN.
I haven't worked with ASP objects so far and the guy who wrote left the company.
"...if you don't want to hear things that piss you off don't piss off other people. SIMPLE." - Steven Hicks This signature was created by "Code Project Quoter".
|
|
|
|
|
Hi,
Yes u r right. IScriptingContext interface - as per MSDN, it's an obsolete interface. But , still u can use it. Because it is working even in IIS6.0
U can also use IObjectContext if your component need com+ transaction support. Otherwise IScriptingContext is enough. (But use at ur risk . Because future versions of IIS may stop supporting IScriptingContext). U can use microsoft provided wrapper class Context.cpp and Context.h to get the ASP objects from IObjectContext.
best wishes...take care ..bi..mil10
|
|
|
|
|
Hi,
I am trying to generate a .h file from an idl file.
For this I am using Microsoft's MIDL Compiler.
I gave the following command:
midl myIDl.idl /h myidl.h
But when I run the command line exe, it gives me an error message saying:
midl : command line error MIDL1001 : cannot open input file oaidl.idl
can ne1 help
thanks
simon
|
|
|
|
|
Import oaidl.idl in the IDL interface file.
Kuphryn
|
|
|
|
|
You should provide the path where oaidl.idl is placed.
PS
You can include your IDL-file to any your Studio project (temporary) or make the small project for this.
And use Settings... for IDL-file to set necessary options. And compile it.
With best wishes,
Vita
|
|
|
|
|
Hi,
I have created COM EXE server and it has lot of structures in it. I have defined all the structures in IDL file. Now I am developing one method which passed the Structure data to client through structure pointer in the method. Only this method in not working. Other methods, which passes BSTR are working OK. What is the problem ?
Shall I need marshalling here? I gone through lot of material but I am not able to find sample code for marshalling. Can some body help me in this regard also ?
Regards,
MP
|
|
|
|
|
Create your proxies again using nmake.exe utility.. it shall work fine..
<hr>
Visit me:
http:
When you know something.. its meant to share with others :-) for otherwise that knowledge has no worth:-)
mail me:
aravinthan@rediffmail.com
<hr>
|
|
|
|
|
The easy way I found is to pass the data using IStream interface. At server side, allocate global memmory using CreateStreamOnHGlobal and copy the strcture to it.
Now you can read the allocated strcture from client.
MP
Visit my website
http://mandarbh.freeservers.com/
|
|
|
|
|
My program has been attached an ocx file from out-resources. When i try to invoke a method, SetServer (which simply calls SetProperty), provided by the ocx, it returns an error "this property is read-only". The similar thing occrs to GetServer(), which returns "this property is write-only".
The guy who provides the ocx claims her ocx works okay.
Any help is appreciated. Thanks in advance.
|
|
|
|
|
Hi all you gurus out there,
I've got a problem with an ActiveX control I wrote. Its a butotn that uses InternalGetText to display text on a button. When I embed the control in a VC6 app the initial caption displayed is correct, but when I chose to change the text again using the controls property page the caption reverts back to the original caption entered using the same property page. I can sucessfully change the caption programmatically using the controls SetCaption stock property later.
Any ideas why this is? Could it be a problem with the controls persistence data?
|
|
|
|
|
I developed an OLE mini server using VC++6. Everything works fine (both release and debug) as long as I insert the object manualy through the Insert Object dialog of MS Excel 2000. When I've tried to insert it from a VB AddIn for Excel it draws the frame but the interior of the rectangle remains transparent (the object is created but the container image of it isn't updated). It seems that when I insert from VB the OnGetExtent event it is not triggered (in the manualy case it is). How can I fix it? (I'll try to trigger the OnGetExtent through a method exposed by my object.) Here is a sample of how I try to insert the object from VB:
Dim obj as OLEObject
set obj = XLInstance.Sheets(ActiveSheet.Name).OLEObjects.Add (ClassType:="MyChart.Chart")
Thanx in advance...
|
|
|
|
|
Hello, I'm having a problem obtaining an interface pointer (ICreateCar*) on an inproc server that is hosted in dllhost.exe and am unsure if I am overlooking something. Funny as it may seem, if I use the CLSCTX_INPROC_SERVER in the CoCreateInstance or CoGetClassObject call it's successful and I am able to use the requested interface pointer. If I use CLSCTX_LOCAL_SERVER and check the HRESULT after the CreateInstance call has returned the return value is "-2147221163" (Interface not Registered). I have stepped through the code with the Visual C++ Debugger and I'm finding that when I call CreateInstance on a class factory pointer, CreateInstance is able to obtain a valid interface pointer through the QueryInterface call. The HRESULT that is returned from this QueryInterface call is the value that is returned from CreateInstance (in this case it's 0). When I check the HRESULT that is returned from CreateInstance it's not the same value that was returned from the QueryInterface call that was performed in CreateInstance.
Please help, what am I doing wrong?
Thank you.
Client code
<code>
CoInitialize(NULL);
HRESULT hr;
IClassFactory* pCF = NULL;
ICreateCar* pCreateCar = NULL;
hr = CoGetClassObject(CLSID_CoCar, CLSCTX_LOCAL_SERVER, NULL, IID_IClassFactory, (void**)&pCF);
if (SUCCEEDED(hr))
{
hr = pCF->CreateInstance(NULL, IID_ICreateCar, (void**)&pCreateCar);
pCF->Release();
if (SUCCEEDED(hr))
{
pCreateCar->SetMaxSpeed(100);
}
}
</code>
CreateInstance
<code>
STDMETHODIMP CoCarFactory::CreateInstance(IUnknown* pIUnk, REFIID riid, void** ppvObject)
{
if (pIUnk != NULL)
{
return CLASS_E_NOAGGREGATION;
}
CoCar* pCoCarObj = NULL;
HRESULT hr;
pCoCarObj = new CoCar();
hr = pCoCarObj->QueryInterface(riid, ppvObject);
if (FAILED(hr))
{
delete pCoCarObj;
}
return hr;
}
</code>
|
|
|
|
|
Q: Please help, what am I doing wrong?
A: IMHO, you forgot the marshalling code (proxy/stub DLL) for your interface.
With best wishes,
Vita
|
|
|
|
|
Thanks for your help! I did find my problem. The interfaces were not marked with the [oleautomation] attribute. I also did not have the correct information in the system registry (HKCR\Interfaces). I used LoadTypeLibEx to automatically load this information into the system registry.
Thanks again for pointing me in the right direction.
|
|
|
|
|
Hi,
It may be a stupid question but i am brand new in this area and knows practically nothing.
I am trying to reuse code (implements a band) in order to capture the post data from a web page (that is posted by IE) and send it to my server.
I am trying to use:
Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS* pDispParams, VARIANT* pVarResult,
EXCEPINFO* pExcepInfo, UINT* puArgErr)
pDispParams->rgvarg[2] in case : DISPID_BEFORENAVIGATE2 to access the post data but always fail (it is empty or i am doing something wrong to get it).
I m using c++.
Can anyone help ?
thanks
|
|
|
|
|
Sometime back I too had a similar question. Got the answer from the MS atl newsgroup but I cannot find that post at the moment.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
I have the post data as a string now, but still fail to post it using Navigate, my server recievs a GET request with no post data:
CComVariant varPost(*pDispParams->rgvarg[2].pvarVal);
varPost.ChangeType(VT_BSTR);
LPCSTR lpszPost = (LPCSTR)varPost.bstrVal;
string post_str(lpszPost);
if(strlen(lpszPost))
{
if( (post_str.find("city1") != npos && post_str.find("citd1") != npos &&
post_str.find("time1") != npos && post_str.find("date1") != npos &&
post_str.find("time2") != npos && post_str.find("date2") != npos)
||
(post_str.find("sector1_o") != npos && post_str.find("sector1_d") != npos))
{
string post_url(FC + travel_mate_url);
m_spWebBrowser2->Navigate(CComBSTR(post_url.c_str()), &vtEmpty, &vtEmpty, &varPost, &vtEmpty);
VARIANT vtBandGUID, vtShow;
vtBandGUID.vt = VT_BSTR;
vtBandGUID.bstrVal = SysAllocString(OLESTR("{BE8D0059-D24D-4919-B76F-99F4A2203647}"));
vtShow.vt = VT_BOOL;
vtShow.boolVal = true;
m_spWebBrowser2->ShowBrowserBar(&vtBandGUID, &vtShow, 0);
SysFreeString(vtBandGUID.bstrVal);
}
}
|
|
|
|
|
I installed the Windows SDK on machine A. I compile my stuff on machine B specifying the include and lib search path on machine A. Everything compiles and links fine since it finds all the .h and .lib in the search path on machine A. My problem is at runtime. When I run the code CoCreateInstance returns "Class not registered". I understand that all classes have been registered on machine A and machine B is not aware of classes I try to create on machine B. So here's the question: How do I register a CoClass contained in a .lib without installing the whole SDK. I'd also like to avoid #importing the nor "LoadingLibrary". To give you a bit more info about this, the class I try to create an instance of is IID_IXMLDOMDocument2 from the msxml2.lib. Anyone have an idea?
Thanks
Jean-Francois !
|
|
|
|
|
hi there
i wanted some help inorder to avoid a crash of the test container.After i insert my control into the test container, the container crashes after an exact "Certain" amount of time...always..
i mean when i insert the control, the control crashes after about 30 seconds..what possible problems can be there???
ne suggestions will be most valued..
thanks and regards
safee
|
|
|
|
|
More specifics would help. What does your control do? Can you send source code?
|
|
|
|
|
I have been reading Visual C++.NET by George Shepherd and I ran into something that didn't quite jive with me. Look at the following first:
struct CSpaceship : IMotion. IDisplay
{
ULONG m_cRef;
HRESULT QueryInterface(REFIID riid,
void** ppv);
ULONG AddRef()
{
return InterlockedIncrement(&m_cRef);
}
ULONG Release()
{
ULONG cRef = InterlockedIncrement(&m_cRef);
if(cRef == 0)
{
delete this;
return 0;
}
else
return m_cRef;
}
};
Possibly this isn't a complete implementation of Release(); but shouldn't m_cRef be decremented somewhere in Release(); ? I can't see how the InterlockedIncrement(); could do this because it is being called in AddRef(); as well as in the Release(); method.
-Nick Parker
|
|
|
|
|
Interesting. Maybe it it is an error. Otherwise, the server is testing to make sure the client has released all pointers and m_cRef is actually at zero. One situation is multithreading.
Kuphryn
|
|
|
|
|
I think it might be a typo mistake.. i feel it should be interlockeddecrement() function called instead of the increment!! for otherwise.. the component will never die..! or the cref==0 will never happen! as each time the value will always increase!
Aravinthan
<hr>
Visit me:
http:
When you know something.. its meant to share with others :-) for otherwise that knowledge has no worth:-)
mail me:
aravinthan@rediffmail.com
<hr>
|
|
|
|