//TH-Header //***************************************************************************************** // Copyright (c) 2001 Michael Kurz // All rights reserved. // If you want to use this source in your applications conatct: // // $FileName : mAssignFilesToExecuteAble.pkg // $ProjectName : Shared Methods // $Author : Michael Kurz // $Created : 04-25-2001 @ 19:00 // // Contents: // Assigns Files (by their extentions) to an executeable // // -AssignExecutAbleToTAG // -AssignExecutAbleToTAG_OPEN // -AssignExecutAbleToTAG_PRINT // -AssignExtentionToTAG // // $Rev History // //***************************************************************************************** // Usage: // // -1st you have to create a Tag which stands for your executeable and what it is able to do // // send AssignExecutAbleToTAG_OPEN "MyProgramName" "X:\PathOfMyProgram\...." "X:\TheIcontoShow\IconName.Ico" "Description" ShowExtentions(true|false) // // -Then you need to Assign the file extentions you want to the created TAG: // send AssignExtentionToTAG ".TXT" "MyProgramName" // // -At least after some Associations for FileTypes have been changed, you need to send: // send NofityShell_AssocChanged // Informs the Shell that something has changed in that area. // // // Ready now all files with the Extention .TXT are opened with the program X:\PathofMy... Define SHCNE_RENAMEITEM For |CI$00000001 Define SHCNE_CREATE For |CI$00000002 Define SHCNE_DELETE For |CI$00000004 Define SHCNE_MKDIR For |CI$00000008 Define SHCNE_RMDIR For |CI$00000010 Define SHCNE_MEDIAINSERTED For |CI$00000020 Define SHCNE_MEDIAREMOVED For |CI$00000040 Define SHCNE_DRIVEREMOVED For |CI$00000080 Define SHCNE_DRIVEADD For |CI$00000100 Define SHCNE_NETSHARE For |CI$00000200 Define SHCNE_NETUNSHARE For |CI$00000400 Define SHCNE_ATTRIBUTES For |CI$00000800 Define SHCNE_UPDATEDIR For |CI$00001000 Define SHCNE_UPDATEITEM For |CI$00002000 Define SHCNE_SERVERDISCONNECT For |CI$00004000 Define SHCNE_UPDATEIMAGE For |CI$00008000 Define SHCNE_DRIVEADDGUI For |CI$00010000 Define SHCNE_RENAMEFOLDER For |CI$00020000 Define SHCNE_FREESPACE For |CI$00040000 Define SHCNE_EXTENDED_EVENT For |CI$04000000 Define SHCNE_ASSOCCHANGED For |CI$08000000 Define SHCNE_DISKEVENTS For |CI$0002381F Define SHCNE_GLOBALEVENTS For |CI$0C0581E0 Define SHCNE_ALLEVENTS For |CI$7FFFFFFF Define SHCNE_INTERRUPT For |CI$80000000 Define SHCNEE_ORDERCHANGED For |CI$00000002 Define SHCNE_RENAMEITEM For |CI$00000001 Define SHCNE_CREATE For |CI$00000002 Define SHCNE_DELETE For |CI$00000004 Define SHCNE_MKDIR For |CI$00000008 Define SHCNE_RMDIR For |CI$00000010 Define SHCNE_MEDIAINSERTED For |CI$00000020 Define SHCNE_MEDIAREMOVED For |CI$00000040 Define SHCNE_DRIVEREMOVED For |CI$00000080 Define SHCNE_DRIVEADD For |CI$00000100 Define SHCNE_NETSHARE For |CI$00000200 Define SHCNE_NETUNSHARE For |CI$00000400 Define SHCNE_ATTRIBUTES For |CI$00000800 Define SHCNE_UPDATEDIR For |CI$00001000 Define SHCNE_UPDATEITEM For |CI$00002000 Define SHCNE_SERVERDISCONNECT For |CI$00004000 Define SHCNE_UPDATEIMAGE For |CI$00008000 Define SHCNE_DRIVEADDGUI For |CI$00010000 Define SHCNE_RENAMEFOLDER For |CI$00020000 Define SHCNE_FREESPACE For |CI$00040000 Define SHCNE_EXTENDED_EVENT For |CI$04000000 Define SHCNE_ASSOCCHANGED For |CI$08000000 Define SHCNE_DISKEVENTS For |CI$0002381F Define SHCNE_GLOBALEVENTS For |CI$0C0581E0 Define SHCNE_ALLEVENTS For |CI$7FFFFFFF Define SHCNE_INTERRUPT For |CI$80000000 Define SHCNEE_ORDERCHANGED For |CI$00000002 // Flags // uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean Define SHCNF_IDLIST For |CI$0000 // LPITEMIDLIST Define SHCNF_PATHA For |CI$0001 // path name Define SHCNF_PRINTERA For |CI$0002 // printer friendly name Define SHCNF_DWORD For |CI$0003 // DWORD Define SHCNF_PATHW For |CI$0005 // path name Define SHCNF_PRINTERW For |CI$0006 // printer friendly name Define SHCNF_TYPE For |CI$00FF Define SHCNF_FLUSH For |CI$1000 Define SHCNF_FLUSHNOWAIT For |CI$2000 Define SHCNF_PATH For SHCNF_PATHW Define SHCNF_PRINTER For SHCNF_PRINTERW Define SHCNF_PATH For SHCNF_PATHA Define SHCNF_PRINTER For SHCNF_PRINTERA External_Function SHChangeNotify "SHChangeNotify" Shell32.DLL Integer wEventID Integer uFlags Pointer pItem1 Pointer pItem2 Returns Integer // Creates a ProgrammTag with the commandline to start for the given action. // Open, Print // Also an Icon for Displaying can be assigned. Procedure AssignExecutAbleToTAG Global String sTag String sAction String sPath String sIconPath String sDescription Integer iShowExtention Integer iRoot String sBranch c34 Move (Character(34)) To c34 get_Registry_Root To iRoot sBranch set_Registry_Root To HKEY_CLASSES_ROOT sTag Set_Foreign_Profile_String (Append("Shell\",sAction))"Command" "" To (sPath+ " "+c34+"%1"+c34) If sIconPath Ne "" ; Set_Foreign_Profile_String "DefaultIcon" "\" "" To sIconPath If sDescription Ne "" Set_Foreign_Profile_String "\" "\" "" To sDescription If iShowExtention Set_Foreign_Profile_String "\" "\" "AlwaysShowExt" To "" set_Registry_Root To iRoot sBranch End_Procedure // For creating an Open Tag. Procedure AssignExecutAbleToTAG_OPEN Global String sTag String sPath String sIconPath String sDescription Integer iShowExtention Send AssignExecutAbleToTAG sTag "Open" sPath sIconPath sDescription iShowExtention End_Procedure // For creating a Print Tag. Procedure AssignExecutAbleToTAG_PRINT Global String sTag String sPath String sIconPath String sDescription Integer iShowExtention Send AssignExecutAbleToTAG sTag "Print" sPath sIconPath sDescription iShowExtention End_Procedure // Assigns an Exention to a created TAG Procedure AssignExtentionToTAG Global String sExt String sTag Integer iRoot String sBranch get_Registry_Root To iRoot sBranch set_Registry_Root To HKEY_CLASSES_ROOT sExt Set_Foreign_Profile_String "\" "\" "" To sTag set_Registry_Root To iRoot sBranch End_Procedure // Need to be sent to inform the System that these things have changed. Procedure NofityShell_AssocChanged Global Integer iRet Move (SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,0,0)) To iRet End_Procedure