Forum > Windows

COM library once again

(1/1)

korba812:
I am playing around with creating a COM library and have some questions/ doubts.

1. The dispinterface generated with "Import Type Library" tool contains methods from parent interfaces.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---// IDemo : IDemo - demo interface  IDemo = interface(IDispatch)   ['{B621769D-04FD-420C-AFDD-35227C29B9BF}']    // DoSomething : Do something with DemoEmu1    function DoSomething(SomeValue:DemoEnum1): WideString;safecall;  end;  // IDemo : IDemo - demo interface  IDemoDisp = dispinterface   ['{B621769D-04FD-420C-AFDD-35227C29B9BF}']    // QueryInterface :     procedure QueryInterface(var riid:{!! GUID !!} OleVariant;out ppvObj:{!! Ppointer !!} OleVariant);dispid 1610612736;    // AddRef :     function AddRef: LongWord;dispid 1610612737;    // Release :     function Release: LongWord;dispid 1610612738;    // GetTypeInfoCount :     procedure GetTypeInfoCount(out pctinfo:UInt);dispid 1610678272;    // GetTypeInfo :     procedure GetTypeInfo(itinfo:UInt;lcid:LongWord;out pptinfo:{!! Ppointer !!} OleVariant);dispid 1610678273;    // GetIDsOfNames :     procedure GetIDsOfNames(var riid:{!! GUID !!} OleVariant;var rgszNames:{!! PShortInt !!} OleVariant;cNames:UInt;lcid:LongWord;out rgdispid:Integer);dispid 1610678274;    // Invoke :     procedure Invoke(dispidMember:Integer;var riid:{!! GUID !!} OleVariant;lcid:LongWord;wFlags:Word;var pdispparams:{!! DISPPARAMS !!} OleVariant;out pvarResult:OleVariant;out pexcepinfo:{!! EXCEPINFO !!} OleVariant;out puArgErr:UInt);dispid 1610678275;    // DoSomething : Do something with DemoEmu1    function DoSomething(SomeValue:DemoEnum1): WideString;dispid 0;  end; Are they needed? I get warnings during compilation.

--- Code: ---comdemo_1_0_tlb.pas(68,14) Warning: An inherited method is hidden by "QueryInterface(var OleVariant;out OleVariant);"
comdemo_1_0_tlb.pas(74,14) Warning: An inherited method is hidden by "GetTypeInfoCount(out LongWord);"
comdemo_1_0_tlb.pas(76,14) Warning: An inherited method is hidden by "GetTypeInfo(LongWord;LongWord;out OleVariant);"
comdemo_1_0_tlb.pas(78,14) Warning: An inherited method is hidden by "GetIDsOfNames(var OleVariant;var OleVariant;LongWord;LongWord;out LongInt);"
comdemo_1_0_tlb.pas(80,14) Warning: An inherited method is hidden by "Invoke(LongInt;var OleVariant;LongWord;Word;var OleVariant;out OleVariant;out OleVariant;out LongWord);"

--- End code ---

2. When compiling methods that are in safecall convention, I get a warning that the function result is not set. I understand that such a method is converted to a function resturned of type HRESULT, is wrapped in try..except, etc. So why this warning?

--- Code: ---udemo.pas(43,16) Warning: Function result does not seem to be set

--- End code ---
Same warning occurs when compiling:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1; procedure Foo; safecall;beginend; beginend. 
--- Code: ---project1.lpr(3,11) Warning: Function result does not seem to be set

--- End code ---

3. Is there a generally accepted way to communicate additional information about failure/error/exception of a method call? The information provided by IErrorInfo is insufficient and I would like to provide more information. Probably this can be done in many ways.

Navigation

[0] Message Index

Go to full version