InfoTip Shell Extension

From: Damjan Vengušt (damjan.vengust_at_guest.arnes.si)
Date: 01/14/05


Date: Fri, 14 Jan 2005 22:49:51 +0100

Hey !

I know how to make and run InfoTip Shell extension, but...

I have created new dll project(InfoTipEx.dll) and add another unit
(InfoTip_Impl.pas)

In project file we need to export some functions which are called by
windows Shell. Those functions are:

exports
   DllGetClassObject,
   DllCanUnloadNow,
   DllRegisterServer,
   DllUnregisterServer;

OK. Lets focus to the problem now. There is a TMyInfoTip class defined
in unit mentioned before (InfoTip_Impl.pas). This class implements
IQueryInfo interface. According to the IQueryInfo interface
specification there are two functions (GetInfoTip And GetInfoFlags) that
need to be implemented.

GetInfoTip has a PWideChar parameter passed by reference. This parameter
contains the actual string that would appear when this extension is lunched.

Ok. My extension works fine, when I set this parameter inside the
function GetInfoTip.
!!!!!! Pay attention to comments inside the function.!!!!!!!

// --------------------------------------------------------------------
function TMyInfoTip.GetInfoTip ( dwFlags : DWORD; var ppwszTip :
PWideChar) : HResult; stdcall;
Var
   sInfoText : String;
begin
   Result := S_OK;

   sInfoText := 'Testing my extension';
   // sInfoText is now fixed.
   // Here I would like to implement some sort of CallBack function which
   // would return string to display as InfoTip.
   // I would like to create a non-visual component. The programmer
   // should be able to set file extension this extension is registered
   // to AND a callback function which will produce the infotip string.

   // Something like this:
   // if Assigned( FMyBuildInfoTipString ) Then
   // sInfoText := FMyBuildInfoTipString();

   ppwszTip := pMalloc.Alloc( sizeof(WideChar)*(Length(sInfoText)+1) );
   if ( ppwszTip <> nil ) Then
     ppwszTip := StringToWideChar(sInfoText, ppwszTip,
sizeof(WideChar)*Length(sInfoText)+1 );

end;
// --------------------------------------------------------------------

OK. My idea may be very bad, but I really don't know how to do it.

Let's make a short summary of text above.
I would like to create a component which represents Infotip shell
extension. User should be able to set filetype (e.g. TXT) this extension
is registered to. The most important part is that the user is able to
write his own code to produce InfoTip String. Keep in mind that user can
  register several filetypes (TXT, PAS, DFM, EXE,...) so there should be
implemented BuildString function for each extension.
Also possible: One component - one extension.

I hope you understand my problem and have an Idea of solving it.

Thanks,
Damjan



Relevant Pages

  • Re: Open files from a file register
    ... The filesystemobject makes it fairly simple to determine the file extension ... Sub OpenDoc() ... Dim strFullName As String ... I want to be able to open the selected file - I am using some code in ...
    (microsoft.public.excel.programming)
  • Re: Running other applications
    ... associated with a file type (extension). ... file and calling FindExecutable: ... ByVal lpDirectory As String, ByVal lpResult As String) As Long ... > The app is a program called Data Junction. ...
    (microsoft.public.vb.general.discussion)
  • Re: CCertAdmin.SetCertificateExtension
    ... IntPtr instead of string. ... > CCertAdminClass admin = new CCertAdminClass; ... > But the problem is that you pass string as a value to an extension ... When the certificate is issued, ...
    (microsoft.public.platformsdk.security)
  • Re: FileInfo, Getting File properties, particularly File TYPE
    ... the concept of this description string it would not make alot of sense to ... extension of .tif, based on what application is associated with the ... Remember also that your code will need registry permissions to access the ... FileInfo object does not seem to expose some of ...
    (microsoft.public.dotnet.general)
  • Re: Save text from CList into file
    ... Why NULL for the default extension when you clearly meant _T? ... That is, first, use CStdioFile. ... Note that in a Unicode app, text.GetLengthwould write only HALF your string; ... See my articles on using FormatMessage in MFC on my MVP Tips site ...
    (microsoft.public.vc.mfc)