PDF Gallery – freeware JPEG to PDF converter

PDF Gallery is a freeware images to PDF converter. PDF Gallery is a very simple to use, but powerful file conversion tool designed to convert the JPEG, PNG and BMP images into PDF files.
Running PDF Gallery does not require any Adobe or image processing programs installed on your computer. It has no extra dependencies and can work in portable mode.
PDF Gallery can convert every image to a separate PDF file or combine multiple images to one PDF file in portrait or landscape layout. It works very fast the size of the resulting PDF file and its quality can be controlled by the user. PDF Gallery supports drag and drop, image stretch, page orientation and offset, images order and other useful features.
It is compatible with Windows XP, Windows Vista and Windows 7.

If you like this tool, please help me by link back to this site on your blog or your friend site.

You can download more freeware applications from http://delphi32.blogspot.com/p/freeware-downloads.html

FindMysoft.com - Fast and free software download directory
Advertisements

Adding Windows 7 Jump List to a Delphi 2010 application

Recently I decided to update one of my Delphi applications and make it more shiny when running on Windows 7. I looked up in the list of the new Windows 7 features and selected the Windows 7 taskbar Jump List as a nice feature for my application. As of Windows 7, the taskbar has been extended with a possibility to create a list of destinations and common tasks associated with an application.This is the application’s Jump List. The Jump List is available whether the taskbar button is in a launcher state (the application isn’t running) or whether it represents one or more windows.

As a result of this work I made a Delphi 2010 library for easy manipulating of Windows 7 Jump List.
You can download the full source code here:
http://1drv.ms/1iWeIDJ

The Jump List class is similar to Microsoft .NET 4.0 JumpList class

TJumpList = class sealed
...
public
constructor Create;
destructor Destroy; override;
procedure Clear;
procedure AddToRecentCategory(ItemPath: string); overload;
procedure AddToRecentCategory(JumpPath: TJumpPath); overload;
procedure AddToRecentCategory(JumpTask: TJumpTask); overload;
function AddJumpPath : TJumpPath;
function AddJumpTask : TJumpTask;
function AddJumpSeparator : TJumpSeparator;
function AddJumpItem : T;
procedure Apply;
procedure DeleteList;
property ShowFrequentCategory : boolean read FShowFrequentCategory write FShowFrequentCategory;
property ShowRecentCategory : boolean read FShowRecentCategory write FShowRecentCategory;
property JumpItems : TList read FJumpItems;
property ApplicationId : string read FApplicationId write SetApplicationId;
end;

and can handle 3 types of items: Tasks, Paths and Separators. In case if you wish to add Path item to the list you have to register your application as a file type handler for the specific file extension you are going to use.
For more details see my previous post.

The library is simple enough. Here is a short sample how to use it in your application.

First step is to provide an application id

JumpList := TJumpList.Create;
JumpList.ApplicationId := 'TaskbarDemo.Unique.Id';

Then you can add some items to the Jump List and apply your changes.

var
Item : TJumpTask;
begin

Item := TJumpTask.Create;
Item.Title := 'Custom Task';
Item.ApplicationPath := ParamStr(0);
Item.Arguments := '/doit';
Item.CustomCategory := 'Custom Category';

JumpList.JumpItems.Add(Item);

JumpList.Apply;
end;

That’s all. Just download and use it. But if you want more details here is the advanced version of the story.

When I decided to add the Jump List to my application I checked VCL first hoping that the Jump List class or component is already available. Unfortunately I found only some interfaces and type definitions of Windows API ported to Delphi, but not a complete ready to use class. The second step was searching Google. I found some examples how to make a Jump List in Delphi, but most of them were quite incomplete.
There was almost no information how to handle ShellItem items or how to properly register the application as a file type handler. Finally I decided to create the Jump List class by myself.

The first important point was usage of the Application User Model Id. Application User Model IDs (AppIDs) are used extensively by the taskbar in Windows 7 and later systems to associate processes, files, and windows with a particular application.

An application must provide its AppID in the following form. It is limited to 128 characters.

CompanyName.ProductName.SubProduct.VersionInformation

Usually when describing the usage of the Jump List the authors pay not too much attention to it, but without providing an Application User Model Id not all features of the Jump List work properly.
Id must be provided at the start of the application and before to call any other methods of the Jump List class.

If you are planning to use the Recent or Frequent categories in your Jump List do not forget to associate the file extensions of the files which can be opened by your application with the application executable.
If this step is not done and you try to add a ShellItem item to the Jump List then it fails. The file registration helper class is also included in the library.

var
F : TFileRegistrationHelper;
begin
F := TFileRegistrationHelper.Create('Microsoft.Samples.TaskbarDemo', ParamStr(0),
'TaskbarDemo Document', 'TaskbarDemo.AppID.1.0.0.0', '.w7c');
F.RegisterToHandleFileType(True);
end;

Delphi class for managing file associations

File associations provide a straightforward and useful way for users and developers to customize the Shell’s treatment of defined file types.

Application developers can use file associations to link an application to one or more desired file types, and customize the Shell’s treatment of that application’s file type. For example, when the application installs, it can check for the existence of the appropriate file associations, and either create or override them as appropriate. The file association can then cause the Shell to display custom icons for files of the given types. The file association can also control how the Shell interprets user input for a file of a given type. For example, when a user double-clicks a file, the Shell launches the application and uses it to open the file.

The following Delphi class can be used to associate the application with the given file extension and compatible with Windows XP, Vista and Windows 7.

// ----------------------------------------------------------------------------------
// Windows 7 Delphi interface
//
// Serhiy Perevoznyk
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// ----------------------------------------------------------------------------------

unit FileRegistrationHelper;

interface

uses
Windows,
SysUtils,
ShlObj,
ShlWApi;

type
// Provides a straightforward and useful way for users and developers to
// customize the Shell's treatment of defined file types.
// Use file associations any time you need to control, extend, or modify the
// Shell's treatment of certain file types.
TFileRegistrationHelper = class
{$REGION 'Private'}
private
FProgID : string;
FAppPath : string;
FFriendlyName : string;
FAppUserModelID : string;
FExtToRegister : string;
function RegisterProgid(DoRegister : boolean) : HRESULT;
function RegisterToHandleExt(pszExt : string; fRegister : boolean) : HRESULT;
function RegSetString(Key : HKEY; pszSubKey : string; pszValue : string; pszData : string) : HRESULT;
{$ENDREGION}
public
constructor Create(const ProgramId, Path, FriendlyName,
AppUserModelID, Extension : string);
function RegisterToHandleFileType : HRESULT;
function IsFileTypeRegistered : boolean;
function UnRegisterFileTypeHandler : HRESULT;
end;

implementation

{ TFileRegistrationHelper }

function TFileRegistrationHelper.IsFileTypeRegistered: boolean;
var
hkeyProgid : HKEY;
begin
Result := false;
if (SUCCEEDED(HResultFromWin32(RegOpenKey(HKEY_CLASSES_ROOT, PWideChar(FProgID), hkeyProgid)))) then
begin
Result := true;
RegCloseKey(hkeyProgid);
end;
end;

constructor TFileRegistrationHelper.Create(const ProgramId, Path, FriendlyName,
AppUserModelID, Extension: string);
begin
FProgID := ProgramId;
FAppPath := Path;
FFriendlyName := FriendlyName;
FAppUserModelID := AppUserModelID;
FExtToRegister := Extension;
end;


function TFileRegistrationHelper.RegisterProgid(DoRegister: boolean): HRESULT;
var
hkeyProgid : HKEY;
lRes : integer;
hkeyShell : HKEY;
szIcon : string;
szCmdLine : string;
begin
if (DoRegister) then
begin
Result := HResultFromWin32(RegCreateKeyEx(HKEY_CLASSES_ROOT, PWideChar(FProgID), 0, nil, REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE or KEY_CREATE_SUB_KEY , nil, hkeyProgid, nil));
if (SUCCEEDED(Result)) then
begin
RegSetString(hkeyProgid, '', 'FriendlyTypeName', FFriendlyName);
Result := RegSetString(hkeyProgid, '', 'AppUserModelID', FAppUserModelID);
if (SUCCEEDED(Result)) then
begin
szIcon := FAppPath + ',0';
Result := RegSetString(hkeyProgid, 'DefaultIcon', '', szIcon);
if (SUCCEEDED(Result)) then
begin
Result := RegSetString(hkeyProgid, 'CurVer', '', FProgID);
if (SUCCEEDED(Result)) then
begin
Result := HResultFromWin32(RegCreateKeyEx(hkeyProgid, 'shell', 0, nil, REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE or KEY_CREATE_SUB_KEY, nil, hkeyShell, nil));
if (SUCCEEDED(Result)) then
begin
// The list of verbs provided by the ProgID is located uner the "shell" key. Here, only
// the single "Open" verb is registered.
szCmdLine := '"' + FAppPath + '" "%1"';
Result := RegSetString(hkeyShell, 'Open\Command', '', szCmdLine);
if (SUCCEEDED(Result)) then
begin
// Set "Open" as the default verb for this ProgID.
Result := RegSetString(hkeyShell, '', '', 'Open');
end;
RegCloseKey(hkeyShell);
end
end
end
end;
RegCloseKey(hkeyProgid);
end
end
else
begin
lRes := SHDeleteKey(HKEY_CLASSES_ROOT, PWideChar(FProgID));
if ( (ERROR_SUCCESS = lRes) or (ERROR_FILE_NOT_FOUND = lRes)) then
Result := S_OK
else
Result := HResultFromWin32(lRes);
end;
end;

function TFileRegistrationHelper.RegisterToHandleExt(pszExt: string;
fRegister: boolean): HRESULT;
var
szKey : string;
hkeyProgidList : HKEY;
hkeyExtension : HKEY;
begin
szKey := pszExt;
Result := HResultFromWin32(RegCreateKeyEx(HKEY_CLASSES_ROOT, PWideChar(szKey), 0, nil, REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE, nil, hkeyExtension, nil));
if Succeeded(Result) then
begin
RegSetString(hkeyExtension, '', '', PWideChar(FProgId));
RegCloseKey(hkeyExtension);
end;
// All ProgIDs that can handle a given file type should be listed under OpenWithProgids, even if listed
// as the default, so they can be enumerated in the Open With dialog, and so the Jump Lists can find
// the correct ProgID to use when relaunching a document with the specific application the Jump List is
// associated with.
szKey := szKey + '\OpenWithProgids';
Result := HResultFromWin32(RegCreateKeyEx(HKEY_CLASSES_ROOT, PWideChar(szKey), 0, nil, REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE, nil, hkeyProgidList, nil));
if (SUCCEEDED(Result)) then
begin
if (fRegister) then
begin
Result := HResultFromWin32(RegSetValueEx(hkeyProgidList, PWideChar(FProgID), 0, REG_NONE, nil, 0));
end
else
begin
Result := HResultFromWin32(RegDeleteValue(hkeyProgidList, PWideChar(FProgID)));
end;
RegCloseKey(hkeyProgidList);
end;
end;

function TFileRegistrationHelper.RegisterToHandleFileType: HRESULT;
begin
Result := RegisterProgid(TRUE);
if (SUCCEEDED(Result)) then
begin
Result := RegisterToHandleExt(FExtToRegister, TRUE);
if (SUCCEEDED(Result)) then
// Notify that file associations have changed
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;
end;

function TFileRegistrationHelper.RegSetString(Key: HKEY; pszSubKey, pszValue,
pszData: string): HRESULT;
begin
Result := HResultFromWin32(SHSetValue(Key, PWideChar(pszSubKey), PWideChar(pszValue), REG_SZ, PWideChar(pszData), (Length(pszData) + 1) * sizeof(CHAR)));
end;

function TFileRegistrationHelper.UnRegisterFileTypeHandler: HRESULT;
begin
Result := RegisterProgid(FALSE);
if (SUCCEEDED(Result)) then
begin
Result := RegisterToHandleExt(FExtToRegister, FALSE);
if (SUCCEEDED(Result)) then
// Notify that file associations have changed
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;
end;

end.