Reinventing the wheel
March 28, 2024, 01:40:29 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Members Tags Login Register  
Del.icio.us Digg FURL FaceBook Stumble Upon Reddit SlashDot Ask Google Bookmarks MSN Live Spurl Technorati Yahoo My Web

Pages: [1]
  Print  
Author Topic: How to  (Read 11161 times)
rionroc
Good users
*
Posts: 26


View Profile
« on: May 13, 2009, 07:11:57 PM »

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.htm


This 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.

====================================
Logged

(^_^)
Reinventing the wheel
« on: May 13, 2009, 07:11:57 PM »

 Logged
ciuly
Administrator
Good users
*****
Posts: 235



View Profile WWW
« Reply #1 on: May 15, 2009, 06:20:22 PM »

lets continue our PM conversation here:

so what you say is that in
function TInfoTip.Load(pszFileName: POleStr; dwMode: Integer): HResult;
the parameter pszFileName does not contain the path, only the filename?

also you have a bug. in
function TInfoTip.GetCurFile(out pszFileName: POleStr): HResult; export;
you need to change the parameters amongs them. it must be
WideCharToStrVar(finfo, pszFileName);
Logged
rionroc
Good users
*
Posts: 26


View Profile
« Reply #2 on: May 15, 2009, 09:50:13 PM »

Thank you Sir

Actually the code runs fine,  InfoTip can get the path and filename.

function TInfoTip.Load(pszFileName: POleStr; dwMode: Integer): HResult;
begin
WideCharToStrVar(pszFileName, fName);
Result := S_OK;
end;

function TInfoTip.GetInfoTip(dwFlags: DWORD; var ppwszTip: PWideChar): HResult;
begin
ppwszTip := StringToOleStr('The infotip3 for: ' + #13 + fName);
Result := S_OK;
end;

//fName RETURNS the path and the filename.

For my question1:
What I'm asking for the infoTip display [if mousedown] was press and not the mouseover, that if is possible.   But if that is impossible,   how about displaying the infoTip on a Delphi form.
------------------------------------------------------------------------------
//end question1



//begin question2
------------------------------------------------------------------------------
>>does not contain the path, only the filename?
That is about my other post that I deleted(the question2), and I hope you have the copy.   The function selectedfilename only gets the filename anywhere inside desktop windows explorer,  but does not include the path.

This is the output of the project I made:
http://www.mediafire.com/?nufzry0o4nj

Please see it Sir,  to understand this issue
Sorry for the mix questions.
Logged

(^_^)
ciuly
Administrator
Good users
*****
Posts: 235



View Profile WWW
« Reply #3 on: May 16, 2009, 02:51:28 PM »

I am not executing any compiled binaries on my PC that come sfrom untrusted sources. dont' take this personally, but you're not exactly a trusted source Tongue
so either post the code and I'll compile or...
and no, I don't have any copy of the code.

regarding click instead of mouseover, I can't say. what about trying it?
Logged
rionroc
Good users
*
Posts: 26


View Profile
« Reply #4 on: May 17, 2009, 11:51:21 AM »

Hello Sir Ciuly

I hope you can add it with the path of the filename selected.

Regarding to change infoTip from mousedown to mouseover (my first choice), and hoping you can find a way using your creative ideas.

Cheers!
Logged

(^_^)
rionroc
Good users
*
Posts: 26


View Profile
« Reply #5 on: May 17, 2009, 11:53:19 AM »

Quote from: "rionroc"
mousedown to mouseover

Ops!
It's mouseover to mousedown
Logged

(^_^)
Reinventing the wheel
   

 Logged
Tags:
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!
Page created in 0.04 seconds with 27 queries.