|
Another way is the looking at implementation of ATL :: CStockPropImpl :: put_Picture property.
Server old_Object -> quering IPersistXXXX interface -> making and fillng IStream object -> passing IStream to client -> loading client's new_Object from IStream.
I hope you are able to divide the CStockPropImpl code into server and client codes.
With best wishes,
Vita
|
|
|
|
|
Hi All,
I am working on a project(.dsp in Visual C++ 6.0) which
has multiple .idl files, many of these .idl files has
cross reference. Actually what I mean is, a function
inside file1's interface(interface_of_file1) takes a
parameter of file2's interface(interface_of_file2). Plus,
a function in interface_of_file2 takes parameter of
interface_of_file1. I hope you people got the idea that
both files need the other file to be compiled. In this
situation, if I import file2 in file1 and compile file1,
compiler tries to compile file2 first and gives error
that:
error MIDL2025 : syntax error : expecting a type
specification near "interface_of_file1" .
Now this is a kind of Dead Lock. I did Forward declaration
instead of importing the file(I do not exactly know the
method offorward declaration in MIDL). I did it in file1
like:
interface interface_of_file2;
Now this gives a different error and a warning:
==============================================
error MIDL2011 : unresolved type declaration :
interface_of_file2 [ Parameter 'parameter1' of
Procedure 'get_CashPeriod' (
Interface 'interface_of_file1' ) ]
warning MIDL2039 : interface does not conform to
[oleautomation] attribute : [ Parameter 'parameter1' of
Procedure 'get_CashPeriod' (
Interface 'interface_of_file1' ) ]
==============================================
Now please tell me, whether I'm doing forward declaration
wrongly? or can anyone suggest some other solution to this
problem?
I will be really thankful for any good answer.
Regards,
Ahsan
Ahsan
|
|
|
|
|
i think what you can do is to compile the first idl file using midl compiler and then include the generated files into the 2nd midl and then compile it..in this way hopefully u wont come across this problem again..
regards
safee
|
|
|
|
|
I am doing the same thing. What I do is that I right click the .idl file and compile only that file from there. Do you want me to specifically do it from command prompt? Btw, I have tried this as well But this gives the same problem.
What do you suggest now?
Ahsan
|
|
|
|
|
oh ok...i think then there is some problem in:
1. either the dependencies settings
2. the header files..
regards
|
|
|
|
|
hi there...
first of all ..thanks for ur time..
i wanted to know if you have any idea about MsOCF or any Place where i can find some information on the MsOCF Framework..or any help on how to map it to the now used OLE 2.0...
thanks..
|
|
|
|
|
If MsOCF maps to MS OLE CF, then this library is part of OLE and implements the compound document model (IStream/IStorage interfaces).
|
|
|
|
|
good to hear from you Rod..and after readin your profile i think you are the guy after all whom i can talk with about reverse engineering and stuff...
for the last one year i have been doing reverse engineering.
the project which i have got is an old but decent sized spread sheet..
the thing is it was built in 1995..with MSOCF framework(i dont know what it means.. completely) but that it was used before OLE 1 came to being..
so the thing is that once i have opened the code now the problem is of mapping the old framework to the new OLE2 and MFC..
there are many classes which are merged now and many methods which are no longer there..
please advise me how do i proceed with this strange problem?
i mean there is no reference material that i may refer to interms of MSOCF..and no mapping from it to the new OLE2..
please suggest something..
thanks
safee
|
|
|
|
|
safeeullah wrote:
MSOCF framework(i dont know what it means.. completely)
MS Ole Compound Framework. Again, it's a unit library which implements stream/storage, the basic elements of a compound document.
You can find equivalent implementations for this library in several places including :
- OpenOffice (that was required to read Word/Excel/... files)
- WINE32 (winehq)
- some simple implementations on the net
safeeullah wrote:
i mean there is no reference material that i may refer to interms of MSOCF..and no mapping from it to the new OLE2..
There is but you have to dig old MSDN papers (prior 1997). I believe that books like Inside OLE should provide good support for it.
Or may be an MS pal which advertedly would read this thread could forward you a couple white papers.
Large software companies that require extensive stream/storage support usually buy the code library from Microsoft. So in practice, this is not an issue.
|
|
|
|
|
thanks for the reply rod..
do u mean the book inside OLE by brockshmidt?
but it contains hardly anything that relates to any thing this prehistoric
the thing is if u can help me in locating some of the white papers that MS may have published at the time when they were abandoning msocf and moving on to atl and stuff..that would be most instrumental..
please rod, do look into this as it is something very important..
Peace!
regards
safee
|
|
|
|
|
thanks for the reply rod..
do u mean the book inside OLE by brockshmidt?
but it contains hardly anything that relates to any thing this prehistoric
the thing is if u can help me in locating some of the white papers that MS may have published at the time when they were abandoning msocf and moving on to atl and stuff..that would be most instrumental..
please rod, do look into this as it is something very important..
Peace!
regards
safee
|
|
|
|
|
What about ordering old MSDN CDs? That's what I would do.
|
|
|
|
|
ahaaa..thanks a lot..Rod..though i have already got msdn for 1996 but there is no mention of this framework in there..so i am on to look for even older versions..
btw ne advice whether other then MS, any other vendor u may know of can provide me with these cds..?
|
|
|
|
|
That's your fifth post, and you still haven't told me (or the audience) what you meant behind the OCF acronym. Looks like I have time to waste.
|
|
|
|
|
sorry sir,
by MS OCF we mean Microsoft Ole Control Framework..
sorry for my mistake..
thanks
|
|
|
|
|
Hello,
I have purchased a Verisign Authenticode Digital Id and have successfully signed my MFC ActiveX control. However, when I use it in an ASP file in Internet Explorer I still get an error that says the object does not support that method (that the VBscript is calling).
If I comment out the script code then it displays the control ok, but does not do much. I did some searching and found some information on MSDN about needing to mark the control as safe for scripting. I added the code to do this, but it still does not work.
Has anyone of you successfully done this? Can you provide some information to help me in the right direction? Thanks.
Ted
|
|
|
|
|
I have found some code in the MSDN to mark a control as safe for scripting. Here it is (slightly modified):
HRESULT CreateComponentCategory(CATID catid, WCHAR* catDescription)
{
ICatRegister* pcr = NULL ;
HRESULT hr = S_OK ;
hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
if (FAILED(hr))
return hr;
CATEGORYINFO catinfo;
catinfo.catid = catid;
catinfo.lcid = 0x0409 ;
int len = wcslen(catDescription);
if (len>127)
len = 127;
wcsncpy(catinfo.szDescription, catDescription, len);
catinfo.szDescription[len] = '\0';
hr = pcr->RegisterCategories(1, &catinfo);
pcr->Release();
return hr;
}
HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
{
ICatRegister* pcr = NULL ;
HRESULT hr = S_OK ;
hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
if (SUCCEEDED(hr))
{
CATID rgcatid[1] ;
rgcatid[0] = catid;
hr = pcr->RegisterClassImplCategories(clsid, 1, rgcatid);
}
if (pcr != NULL)
pcr->Release();
return hr;
}
HRESULT CYourActiveXControl::RegisterSafetyCategories()
{
HRESULT hr = S_OK;
hr = CreateComponentCategory(CATID_SafeForInitializing, L"Controls safely initializable from persistent data!");
if (FAILED(hr))
return hr;
hr = RegisterCLSIDInCategory(IID_YourActiveXControlHere, CATID_SafeForInitializing);
if (FAILED(hr))
return hr;
hr = CreateComponentCategory(CATID_SafeForScripting, L"Controls safely scriptable!");
if (FAILED(hr))
return hr;
hr = RegisterCLSIDInCategory(IID_YourActiveXControlHere, CATID_SafeForScripting);
if (FAILED(hr))
return hr;
return hr;
}
Then you can just call the static member "CYourActiveXControl::RegisterSafetyCategories()" in your app's InitInstance function.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
Chris,
I added these and some AfxMessageBox calls for debugging. The OCX is in a cabinet file which is called by the HTML:
<br />
<OBJECT ID=fevis CLASSID="clsid:383680F6-54B7-4970-BB12-A41E7AC0B94B"<br />
HEIGHT=400 WIDTH=680 CODEBASE="http://localhost/controls/fevisactivex.cab#version=1,0,0,2"><br />
</OBJECT><br />
The AfxMessageBox's are never displayed when IE loads the control and tries to execute the VBscript:
<br />
<script language="vbscript"><br />
fevis.OpenFromURL "http://localhost/gallery/connectingrod.fvs"<br />
</script><br />
Any ideas?
Ted
|
|
|
|
|
I'm not sure. What you've done looks exactly like what I've done to host an ActiveX control in the browser, with the exception that my control was not in a CAB file, it was just in an OCX. Have you tried doing this:
<br />
Call fevis.OpenFromURL( "http://localhost/gallery/connectingrod.fvs" )<br />
That's how I wrote the calls into my OCX from the VBScript. Other than that, I can throw together a small sample of hosting a really simple control if it would help.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
Hello ! I have a simple COM component with an interface that exposes the following method:
[id(2), helpstring("method GetString2")] HRESULT GetString2([in] BSTR in, [out] BSTR* out, [out,retval] BSTR* ret);
The implementation :
STDMETHODIMP CTest::GetString2(BSTR in, BSTR* out, BSTR* ret)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
*out=in;
*ret=in;
return S_OK;
}
I call this method from asp:
Set business = CreateObject("COMTest.Test")
result=business.GetString2("Something", cstr(out))
Response.Write cstr(result)+cstr(out)
So result and out should be identical. ("Something") But out=="";
Any ideeas ?
|
|
|
|
|
I mean... how can I return two or more parameters from a method ?
|
|
|
|
|
A COM interface method can only have one [out, retval] parameter and it has to be the last parameter in the method. Your method could return a number of [out] only parameters but not all COM language mappings support [out] only parameters.
The solutions to your problem include the following:
1. Defining an IDL array as a method parameter or use a SAFEARRAY to be variant compliant.
2. Use a structure as a method parameter (define it in your IDL).
3. Use a COM interface as a method parameter
4. Use a COM enumerator - these provide a pattern to allow a client to get batches of items. Alternatively, use a COM collection if you need it to work with VB/VBS.
Best of luck
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
ASP as well as VBS has the basic type of parameter as VARIANT.
I suggest you to make some test:
[id(2), helpstring("method GetString2")]
HRESULT GetString2([in] BSTR inStr, [out] BSTR* outStr, [out] VARIANT* outStr2, [out,retval] BSTR* retStr);
and
STDMETHODIMP CTest::GetString2( BSTR inStr, BSTR* outStr, VARIANT* outStr2, BSTR* retStr)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
*outStr = SysAllocString(inStr);
*retStr = SysAllocString(inStr);
outStr2->vt = VT_BSTR;
outStr2->bstrVal = SysAllocString(inStr);
return S_OK;
}
and
Set business = CreateObject("COMTest.Test")
result=business.GetString2("Something", cstr(out), out2)
Response.Write "result=" & result & " out=" & out & " out2=" & out2
It's clearly that "cstr(out)" is not identical to "out".
"cstr(out)" expression means the temporary variable having the string type.
It can not be the receiver of any [out] data.
With best wishes,
Vita
|
|
|
|
|
do u really think that merely assigning/swapping the pointers would do? I think you should look into the marshalling issues.. The memory that you are returning to client needs to be marshalled and allocated...
HTH
|
|
|
|
|
Hi all,
I need to send an array of char via serial line and I have a method to do that. However the string I should send is a CComBSTR. How can I convert it into a "old C style" array of chars?
Thank you in advance.
|
|
|
|