snoopy_Spy
asked on
Add to "Send to"
How can i add a folder to the "Send To" ?
MAkeing a new Folder in the "Send to" and from each new item in send to execute the same progrmm with different folders (How can i extract the files the user selected)
And how can i make a new "Send to" (for Example "My Send To")
How putting a small picture on the left of the menu items ?
It should work for all Windows Versions (95, 98, NT 2000)
MAkeing a new Folder in the "Send to" and from each new item in send to execute the same progrmm with different folders (How can i extract the files the user selected)
And how can i make a new "Send to" (for Example "My Send To")
How putting a small picture on the left of the menu items ?
It should work for all Windows Versions (95, 98, NT 2000)
what send to are you speaking about
Send to is just a folder in the Windows directory...
\Windows\SendTo
or
\WinNT\Profiles\All Users\SendTo
So you should be abole to use the shellAPI to create a shortcut and add it into this folder (I think)
Tim.
\Windows\SendTo
or
\WinNT\Profiles\All Users\SendTo
So you should be abole to use the shellAPI to create a shortcut and add it into this folder (I think)
Tim.
Here is the code to create a shortcut (In C) from the WinAPI help file...
OOps, no, you don't use the ShellAPI functions, but it does tell you how to do it (in C) in the WinAPI help file using IDispatch...
The directory bit was right, anyways...(heh) ;OD
Good luck
Tim.
PS: I am sure some nice soul will put the Delphi cade to do it up here for you...
OOps, no, you don't use the ShellAPI functions, but it does tell you how to do it (in C) in the WinAPI help file using IDispatch...
The directory bit was right, anyways...(heh) ;OD
Good luck
Tim.
PS: I am sure some nice soul will put the Delphi cade to do it up here for you...
ASKER
With a "New Send To" I mean, a new Folder like th "Send to" or "ICQ Send To".
Is there a way to make a folder in the "Send To" Folder ?
How can i get the correct path to it (Is there a way to find the path wich should work on all Windows systems !)
Is there a way to make a folder in the "Send To" Folder ?
How can i get the correct path to it (Is there a way to find the path wich should work on all Windows systems !)
Use:
var
PIDL: PItemIDList;
Buffer: array[0.2569 of Char;
SHGetSpecialFolderLocation (0, CSIDL_SENDTO, PIDL);
SHGetPathFromIDList(PIDL, Buffer);
to get the file name of the "Send To" folder. Then use
ChDir(Buffer);
MkDir('your folder here');
to create the new folder. Concatenate the "Send To" folder string and your new name to a valid path and use this to place links in.
Ciao, Mike
var
PIDL: PItemIDList;
Buffer: array[0.2569 of Char;
SHGetSpecialFolderLocation
SHGetPathFromIDList(PIDL, Buffer);
to get the file name of the "Send To" folder. Then use
ChDir(Buffer);
MkDir('your folder here');
to create the new folder. Concatenate the "Send To" folder string and your new name to a valid path and use this to place links in.
Ciao, Mike
thanks for your explanation
ASKER
Lischke do you know how i can make a folder parallel to the "Send To" and "ICQ Send to" Folder ?
I mean the folder should be in the main menu (after pressing Shift-F10)
I mean the folder should be in the main menu (after pressing Shift-F10)
Snoopy, some additional comments. The buffer declaration should of course be:
Buffer: array[0..MAX_PATH] of Char;
You need also to retrieve a shell allocator to free the PIDL memory you got by SHGetSpecialFolderLocation :
var
Malloc: IMalloc;
begin
SHGetMalloc(Malloc);
:
:
Malloc.Free(PIDL);
end;
You don't need to free Malloc as this is an interface which is automatically free when it gets out of scope (the routine).
To create a link in a folder use:
function MakeLinkWithArguments(Name , Folder, ExeName, WorkingDir, Argument: String): Integer;
// Name: name of the link without the ".lnk"
// Folder: folder where the link should be placed in
// ExeName: filename and path of the executable (can also be a document etc.)
// WorkingDir: working directory of the program
// Argument: all arguments for the link, note: if there are spaces in an argument then it should be surrounded with ""
var
AObject: IUnknown;
ASLink: IShellLink;
APFile: IPersistFile;
WFileName : WideString;
R: HRESULT;
begin
Result := erOK;
AObject := CreateComObject(CLSID_Shel lLink);
ASLink := AObject as IShellLink;
APFile := AObject as IPersistFile;
with ASLink do begin
SetArguments(PChar(Argumen t));
SetPath(PChar(ExeName));
SetWorkingDirectory(PChar( WorkingDir ));
end;
if not DirectoryExists(Folder) then Result := erDirectory;
if (Length(Name) > 0) and (Name[Length(Name)] = '\') then Delete(Name, Length(Name), 1);
WFileName := Folder + '\' + Name + '.lnk';
R := APFile.Save(PWChar(WFileNa me), False);
if R = E_FAIL then Result := Result or erFile;
end;
Placing a new folder into the shell's context menu is somewhat harder as you have to write a context menu handler I guess. Unfortunately, I cannot tell you how to add another folder...
Ciao, Mike
Buffer: array[0..MAX_PATH] of Char;
You need also to retrieve a shell allocator to free the PIDL memory you got by SHGetSpecialFolderLocation
var
Malloc: IMalloc;
begin
SHGetMalloc(Malloc);
:
:
Malloc.Free(PIDL);
end;
You don't need to free Malloc as this is an interface which is automatically free when it gets out of scope (the routine).
To create a link in a folder use:
function MakeLinkWithArguments(Name
// Name: name of the link without the ".lnk"
// Folder: folder where the link should be placed in
// ExeName: filename and path of the executable (can also be a document etc.)
// WorkingDir: working directory of the program
// Argument: all arguments for the link, note: if there are spaces in an argument then it should be surrounded with ""
var
AObject: IUnknown;
ASLink: IShellLink;
APFile: IPersistFile;
WFileName : WideString;
R: HRESULT;
begin
Result := erOK;
AObject := CreateComObject(CLSID_Shel
ASLink := AObject as IShellLink;
APFile := AObject as IPersistFile;
with ASLink do begin
SetArguments(PChar(Argumen
SetPath(PChar(ExeName));
SetWorkingDirectory(PChar(
end;
if not DirectoryExists(Folder) then Result := erDirectory;
if (Length(Name) > 0) and (Name[Length(Name)] = '\') then Delete(Name, Length(Name), 1);
WFileName := Folder + '\' + Name + '.lnk';
R := APFile.Save(PWChar(WFileNa
if R = E_FAIL then Result := Result or erFile;
end;
Placing a new folder into the shell's context menu is somewhat harder as you have to write a context menu handler I guess. Unfortunately, I cannot tell you how to add another folder...
Ciao, Mike
ASKER
OK
This was the two options i had to write this prog and i want to know which is best (in proportion to the time for writting it) and now i have the right one !
Please post an answer !
This was the two options i had to write this prog and i want to know which is best (in proportion to the time for writting it) and now i have the right one !
Please post an answer !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
many questions in one :-)
1) Simply create a folder in the Sent To folder.
2) Create links in the new folder which all point to the same program. Set different working directories for each link. The files are passed as command line parameters.
3) New Send To? What do you mean?
4) No way to put own icons into the menu unless you overwrite the context menu handler and supply your own (MUCH work).
Ciao, Mike