![]() |
Desktop Development »
Shell and IE programming »
General
Intermediate
CShellLink & CUrlShellLink v1.1By PJ Naughter2 Freeware MFC classes to encapsulate shell shortcuts. |
VC6, MFC, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
CShellLink and CUrlShellLink, 2 freeware MFC wrapper classes
to encapsulate shell shortcuts.
| Features |
| Usage |
| History |
| API Reference |
| Contacting the Author |
#include ShellLink.h in which ever of your modules needs to make calls to
the classes.
main() in the module
main.cpp.
History
v1.0 (10 December 1998)
V1.1 (12th December 1998)
ShelLink.
CUrlShellLink::Save() where m_sTarget was not
being set.
API Reference
The API consists of the following:
CShellLinkInfo::m_sTarget
CShellLinkInfo::m_pidl
CShellLinkInfo::m_sArguments
CShellLinkInfo::m_sDescription
CShellLinkInfo::m_wHotkey
CShellLinkInfo::m_sIconLocation
CShellLinkInfo::m_nIconIndex
CShellLinkInfo::m_nShowCmd
CShellLinkInfo::m_sWorkingDirectory
CShellLink::Create
CShellLink::Load
CShellLink::Save
CShellLink::Resolve
CUrlShellLink::Create
CUrlShellLink::Load
CUrlShellLink::Save
CUrlShellLink::Invoke
Notes:
CShellLink class also includes simple Set and Get functions which modify the
CShellLinkInfo data which the class contains.
CUrlShellLink is derived from CShellLink, you can call all of
the standard Get and Set functions which it inherits from CShellLink.
m_sTarget is of type CString.
m_pidl is of type
LPITEMIDLIST. This value is not valid In the case of an internet shortcut.
m_sArguments is of
type CString.
m_sDescription is of type CString.
m_wHotkey is of type WORD. The
virtual-key code is in the low-order byte, and the modifier flags are in the high-order byte.
The modifier flags can be a combination of the following values:
| HOTKEYF_ALT | ALT key |
| HOTKEYF_CONTROL | CTRL key |
| HOTKEYF_EXT | Extended key |
| HOTKEYF_SHIFT | SHIFT key |
m_sIconLocation
is of type CString.
m_sIconLocation of the icon for the shortcut.
m_sIconLocation is of type int.
m_nShowCmd
is of type int. For a list of the show commands, see the description of the
ShowWindow() function in books online.
m_sWorkingDirectory is of type CString.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
Remarks:
Call this member function to initialise the shortcut with initial values.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
Remarks:
Call this member function to load up a shortcut from disk.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
Remarks:
Call this member function to save a shortcut to disk. Prior to calling this function you would
normally call CShellLink::Create() method.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
| SLR_ANY_MATCH | Resolves the link, displaying a dialog box if the system needs information from the user. |
| SLR_NO_UI | Prevents the shell from displaying a dialog box if it cannot resolve the shell link. When this flag is specified, the high-order word of fFlags specifies a timeout duration, in milliseconds. The function returns if the link cannot be resolved within the timeout duration. If the high-order word is set to zero, the timeout duration defaults to 3000 milliseconds (3 seconds). |
| SLR_UPDATE | Directs the shell to update the path to the link and the list of identifiers if the
link object has been changed. If this value is used, it is not necessary to call the
IPersistFile::IsDirty() method to determine whether the link object has
changed. |
Remarks:
Call this member function to ensure that a shortcut is pointing to valid data. This is known as
"resolving" a shortcut. For those who frequently move files from volume to volume, the Searching
for Shortcut dialog should be familiar.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
Remarks:
Call this member function to initialise the shortcut with initial values.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
Remarks:
Call this member function to load up a shortcut from disk.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
Remarks:
Call this member function to save a shortcut to disk. Priot to calling this function you would
normally call the CUrlShellLink::Create() method.
Return Value:
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE.
Parameters:
IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB, this member is ignored.
IUniformResourceLocator::InvokeCommand() method will execute. This value can
be a combination of the following:
| IURL_INVOKECOMMAND_FL_ALLOW_UI | Interaction with the user is allowed and the pParentWnd parameter is valid. If this is not set, interaction with the user is not allowed and the pParentWnd member is ignored. |
| IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB | Default verb for the Internet Shortcut's protocol is to be used and the sVerb parameter is ignored. If this bit is not set, the verb is specified by sVerb. |
IUniformResourceLocator::InvokeCommand(). If dwFlags is set to
IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB, this parameter is ignored.
Remarks:
Call this member function to perform an action on a URL. The most common action would be to open
it, which will open it up in your default web browser. You could also use the "edit" verb assuming
you had a HTML editor open.
Contacting the Author
PJ Naughter
Email: pjn@indigo.ie
Web: http://www.naughter.com
12th December 1998
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 3 Mar 2000 Editor: Valerie Bradley |
Copyright 2000 by PJ Naughter Everything else Copyright © CodeProject, 1999-2010 Web18 | Advertise on the Code Project |