[Oberon] [BlackBox] Recent Files Link

Koen Desaeger koen.desaeger at antwerpen.be
Fri Feb 23 13:39:15 MET 2007


On Sat, 17 Feb 2007 20:06:58 -0600, you wrote:

>I want to create a windows shortcut from within BlackBox.
>
>I have read the MSDN information on SHAddToRecentDocs, which is a
>WinAPI call to add a shortcut to the recent documents list.  I cannot
>find any evidence of this in the (Win)API.odc file.
>
>I have also found a C++ entry for IShellLink::GetDescription that is a
>more general way to make windows shortcuts.  There is a C++ utility
>using this described at
>http://www.flexhex.com/docs/articles/hard-links.phtml#softlinks and
>the source is available.  I read C++ much more slowly than Oberon, and
>haven't digested this yet.
>
>I have also noticed that when I go to the Files menu and select open,
>then doubleclick on a file name to open it in blackbox, the recent
>files list is updated.  I can't find anything in HostFiles that seems
>at all related to this, so I wonder if it is some side-effect buried
>deep in windows.
>
>I don't know how to access a C++ method in Blackbox, and I haven't dug
>through to find out how to modify WinAPI to have this call available.
>
>Has anyone else worked on this?
>
>
>-- 
>-- Aubrey McIntosh, Ph.D.

Hello,

I guess the Shell32 functions are not in Winapi.odc because this dll is distributed with Internet
Explorer. POW does not include them either.
For cases like this, I have a recent lcc distribution installed from
http://www.cs.virginia.edu/~lcc-win32/ . I look up the constants in it's header files, which are
always up to date.
Here is one way to do it:

MODULE PrivShell32 ["SHELL32.dll"];
IMPORT WinApi;
		
CONST
	SHARD_PIDL = 1;
	SHARD_PATHA  = 2;
	SHARD_PATHW = 3;
	SHARD_PATH* = SHARD_PATHA;
		
PROCEDURE SHAddToRecentDocs* ( uFlags: INTEGER; pv: WinApi.PtrSTR );
	
END PrivShell32.
-----------------------------------------------------------------------
The uFlags parameter defines the type of the pv parameter; for best compatibility I chose a
non-unicode string; (pidl is more complicated but allows to specify folders like 'My Documents')
The function has to be called with path + filename of an existing file; on my system both the file
and the folder are added to my recent documents list.
-----------------------------------------------------------------------
MODULE PrivRecent;
IMPORT PrivShell32;

PROCEDURE Do*;
	VAR name: ARRAY 256 OF SHORTCHAR;
BEGIN
	name := "C:\Oberon\BlackBox 1.5\Xy\Rsrc\IFSPlugin.odc";
	PrivShell32.SHAddToRecentDocs(PrivShell32.SHARD_PATH, name)
END Do;

END PrivRecent.Do

Brgds,
Koen.



More information about the Oberon mailing list