How to change from mouseover to mousedown using the infotip?
Or
How to put ActiveX infoTip to Form?
Here are sample code, that I applied to mix, but I'm lost.
http://www.delphi3000.com/articles/article_950.asp?SK=http://delphi.about.com/library/weekly/aa121404b.htmThis is also the code that I updated, but I failed to fix it.
====================================
//Edited by me, but failed.
unit Unit1;
// Project to create a very basic infotip shell extension using IQueryInfo and IPersistFile
// By: Greg Kempe (
greg@kempe.net) -- 27 April 2000
// Article available at:
http://www.delphi3000.com/interface
uses
ComObj, ShlObj, ActiveX, Windows;
const
// GUID for our object
CLSID_InfoTip : TGUID = '{088FB88B-09E0-4a8d-BF9A-EDCD8041EA1E}';
xCLSID_InfoTip : TGUID = '{098FB88B-09E0-5a8d-BF9A-DDCD8041EA1F}';
type
itip = interface
['{098FB88B-09E0-5a8d-BF9A-DDCD8041EA1F}']
function dfname:string; stdcall;
end;
type
titip = class(TComobject, itip)
private
dinfo:string;
protected
function dfname:string; stdcall;
end;
type
TInfoTip = class(TComObject, IQueryInfo, IPersistFile)
private
fName : string;
protected
{ IQueryInfo }
function GetInfoTip(dwFlags: DWORD; var ppwszTip: PWideChar): HResult; stdcall;
function GetInfoFlags(out pdwFlags: DWORD): HResult; stdcall;
{ IPersistFile }
function IsDirty: HResult; stdcall;
function Load(pszFileName: POleStr; dwMode: Longint): HResult; stdcall;
function Save(pszFileName: POleStr; fRemember: BOOL): HResult; stdcall;
function SaveCompleted(pszFileName: POleStr): HResult; stdcall;
function GetCurFile(out pszFileName: POleStr): HResult; stdcall;
function GetClassID(out classID: TCLSID): HResult; stdcall;
end;
implementation
uses ComServ;
var finfo:string;
{ TInfoTip }
function TInfoTip.GetClassID(out classID: TCLSID): HResult;
begin
Result := E_NOTIMPL;
end;
function TInfoTip.GetCurFile(out pszFileName: POleStr): HResult; export;
begin
//Result := E_NOTIMPL;
WideCharToStrVar(pszFileName, finfo);
Result := S_OK;
end;
function TInfoTip.GetInfoFlags(out pdwFlags: DWORD): HResult;
begin
Result := E_NOTIMPL;
end;
function TInfoTip.GetInfoTip(dwFlags: DWORD; var ppwszTip: PWideChar): HResult;
begin
// show a very basic infotip
ppwszTip := StringToOleStr('The infotip3 for: ' + #13 + fName);
finfo:=fName;
Result := S_OK;
end;
function TInfoTip.IsDirty: HResult;
begin
Result := E_NOTIMPL;
end;
function TInfoTip.Load(pszFileName: POleStr; dwMode: Integer): HResult;
begin
// save the filename for later use
WideCharToStrVar(pszFileName, fName);
WideCharToStrVar(pszFileName, finfo);
Result := S_OK;
end;
function TInfoTip.Save(pszFileName: POleStr; fRemember: BOOL): HResult;
begin
Result := E_NOTIMPL;
end;
function TInfoTip.SaveCompleted(pszFileName: POleStr): HResult;
begin
Result := E_NOTIMPL;
end;
function titip.dfname:string; export;
begin
dinfo:=finfo;
Result := dinfo;
end;
initialization
TComObjectFactory.Create(ComServer, TInfoTip, CLSID_InfoTip, '', 'Test Info Tip', ciMultiInstance, tmApartment);
TComObjectFactory.Create(ComServer, titip, xCLSID_InfoTip, 'Just a test1', 'Just a test11', ciMultiInstance, tmApartment);
end.
-------------------------------------------------------
And my Form to show the Filename and Path::::
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComObj, ActiveX, ExtCtrls;
const
xCLSID_InfoTip : TGUID = '{098FB88B-09E0-5a8d-BF9A-DDCD8041EA1F}';
type
itip = interface
['{098FB88B-09E0-5a8d-BF9A-DDCD8041EA1F}']
function dfname:string; stdcall;
end;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
tiptip : itip;
tt: IPersistFile;
finfo:string;
pszFileName:PwideChar;
hr:Hresult;
begin
OleCheck(CoCreateInstance(xCLSID_InfoTip,
nil,
CLSCTX_ALL,
itip,
tiptip));
Form1.Caption := tiptip.dfname;
end;
end.
====================================