Click here to Skip to main content
15,885,546 members
Home / Discussions / COM
   

COM

 
GeneralRe: Convert document to PDF format Pin
Nitin K. Kawale12-Jul-11 0:34
professionalNitin K. Kawale12-Jul-11 0:34 
QuestionGetting an access to idispatch member of idispatch interface Pin
Altankhuu11-Sep-10 21:25
Altankhuu11-Sep-10 21:25 
AnswerRe: Getting an access to idispatch member of idispatch interface Pin
«_Superman_»12-Sep-10 19:21
professional«_Superman_»12-Sep-10 19:21 
GeneralRe: Getting an access to idispatch member of idispatch interface Pin
Altankhuu19-Sep-10 21:56
Altankhuu19-Sep-10 21:56 
Hi. Thanks for your reply. Actually the activex control is a third-party visual component for plotting some 3d graphics. When I import the ocx file into Delphi, it appears on the ActiveX tab of the Component Palette. I just drag it with mouse and put on a form and an object
Graph1:  TGraph;

is automatically added to my code. Its properties and events become visible in the Object Inspector window. Now I want to get an access to the control’s axes from my code. As you can see, the property <Idispatch * IGraphAxes> represents coordinate axes. Also I guess that IGraphAxes’ XAxis/YAxis/ZAxis members are idispatch pointers of type IGraphAxis. I wrote the following procedures to access an idispatch interface:

procedure TForm2.GetProperty(dispobj: IDispatch; PropertyName: WideString;
                                var retvalue: Variant; Sender: TObject);
var hr: HRESULT;
    DispId: integer;
    value: Variant;
    params: TDispParams;
begin
  hr:=dispobj.GetIDsOfNames(GUID_NULL,@PropertyName, 1, LOCALE_SYSTEM_DEFAULT, @DispId);
  Label1.Caption:=inttostr(DispId);
  hr:=dispobj.Invoke(DispId,GUID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_PROPERTYGET,
                  Params,@Value,nil,nil);
  Retvalue:=Value;
  Label2.Caption:=inttostr(value);
end;

procedure TForm2.SetProperty(dispobj: IDispatch; PropertyName: WideString; Value: OLEVariant;
                                Sender: TObject);
var 
    hr: HRESULT;
    DispId: integer;
    params: TDispParams;
begin
   hr:=dispobj.GetIDsOfNames(GUID_NULL,@PropertyName,1, LOCALE_SYSTEM_DEFAULT, @DispId);
  Label1.Caption:=inttostr(DispId);
  params.rgvarg:=@Value;
  params.rgdispidNamedArgs:=@DispIDArgs;
  params.cArgs:=1;
  params.cNamedArgs:=1;
  hr:=dispobj.Invoke(DispId,GUID_NULL,LOCALE_SYSTEM_DEFAULT,
                  DISPATCH_PROPERTYPUT,Params,nil,nil,nil);
 end;

They work fine with Color and Style properties of IGraphAxes:
GetProperty(Graph1.GraphAxes, 'Color', retvalue, Sender);

Or
SetProperty(Graph1.GraphAxes, 'Color',value,Sender);


But how to get full access to XAxis/YAxis/ZAxis members of IGraphAxes?
AnswerRe: Getting an access to idispatch member of idispatch interface Pin
Lim Bio Liong26-Oct-10 1:38
Lim Bio Liong26-Oct-10 1:38 
QuestionreportAppFactory.OpenDocument throws Invalid Cast exception (No such interfaces supported) [modified] Pin
amitcoder836-Sep-10 17:54
amitcoder836-Sep-10 17:54 
AnswerCrosspost - ignore Pin
Richard MacCutchan6-Sep-10 21:37
mveRichard MacCutchan6-Sep-10 21:37 
QuestionHow to send NULL to a IUnknown** parameter when COM object is surrogate hosted Pin
Per Nilsson2-Sep-10 19:58
Per Nilsson2-Sep-10 19:58 
AnswerRe: How to send NULL to a IUnknown** parameter when COM object is surrogate hosted Pin
tolw2-Sep-10 20:33
tolw2-Sep-10 20:33 
GeneralRe: How to send NULL to a IUnknown** parameter when COM object is surrogate hosted Pin
Per Nilsson2-Sep-10 20:42
Per Nilsson2-Sep-10 20:42 
AnswerRe: How to send NULL to a IUnknown** parameter when COM object is surrogate hosted [modified] Pin
tolw2-Sep-10 21:16
tolw2-Sep-10 21:16 
GeneralRe: How to send NULL to a IUnknown** parameter when COM object is surrogate hosted Pin
Per Nilsson2-Sep-10 23:07
Per Nilsson2-Sep-10 23:07 
QuestionWSACancelBlockingCall Pin
Bedke2-Sep-10 1:51
Bedke2-Sep-10 1:51 
QuestionHow to deal with such situation?(Need pass STL vector to dll under vs2008) [modified] Pin
fantasy121523-Aug-10 17:04
fantasy121523-Aug-10 17:04 
AnswerRe: How to deal with such situation?(Need pass STL vector to dll under vs2008) Pin
KingsGambit23-Aug-10 21:00
KingsGambit23-Aug-10 21:00 
QuestionQuestion about IOleObject::GetClipboardData Pin
edward barbu18-Aug-10 0:51
edward barbu18-Aug-10 0:51 
QuestionObject Initialization Problem Pin
pjdriverdude6-Aug-10 4:17
pjdriverdude6-Aug-10 4:17 
AnswerRe: Object Initialization Problem Pin
Sauro Viti6-Aug-10 4:42
professionalSauro Viti6-Aug-10 4:42 
GeneralRe: Object Initialization Problem Pin
pjdriverdude6-Aug-10 5:17
pjdriverdude6-Aug-10 5:17 
GeneralRe: Object Initialization Problem Pin
pjdriverdude6-Aug-10 5:28
pjdriverdude6-Aug-10 5:28 
GeneralRe: Object Initialization Problem Pin
Sauro Viti6-Aug-10 5:45
professionalSauro Viti6-Aug-10 5:45 
QuestionError in Excel Add in Pin
gahlawat5-Aug-10 20:01
gahlawat5-Aug-10 20:01 
QuestionHow to call C# function from unmanaged C++ code.? Pin
deadlyabbas20-Jul-10 19:59
deadlyabbas20-Jul-10 19:59 
AnswerRe: How to call C# function from unmanaged C++ code.? Pin
Sauro Viti21-Jul-10 20:50
professionalSauro Viti21-Jul-10 20:50 
QuestionWhy CreateWindowEx() function failed on 64 Bit window XP Pin
am 200920-Jul-10 6:02
am 200920-Jul-10 6:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.