????? ?????? ??? ???? ?????? ??? ????? DLL

?????? ????????? ?????? ?????????
???? ???????: 241733 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

??????

????? ????? ?? ???? ??????? Windows 95 ?? Windows 98 ??? Windows 2000 Professional ? ??????? DLL ?? ????? ??? ?????? ??? ???????? ??????? ??? ???? ??????? ???? ?? ???? ??? ??????. ?? ???? ????? DLL ????? ?? ??? ???????? ?????? ?????????? ?????. ????? ?? ???? ??? ???????? SHGetSpecialFolderPath ?? SHGetFolderPath.

??????? ????

??? ???? SHGetSpecialFolderPath ??? ??? Windows 95 ??? ?? ????? Internet Explorer 4.0 ?? ????? ??? ??????. ??? ???? ??????? Windows 2000 ?????? SHGetSpecialFolderPath ?????. ??? ???? ?? ???? ????????? ??? ?????? ??????? API SHGetFolderPath ???? ??? ?????? ????? ?? SHGetSpecialFolderPath. ???????? SHGetFolderPath ??? ???? ??????? Windows 95 ?? Windows 98? ??? ????? ????? ????? SHFolder.dll ?? ??????? DLL.

???? ?????? ??? SHFolder.dll ?? Platform SDK ????. ?????? Platform SDK ???? ???? ?????? ??? ?????:
http://www.microsoft.com/msdownload/platformsdk/setuplauncher.htm
??? ????? Platform SDK ? ???? ?? ????? ???????? ??????? ?????? ??????? ???? ???????. ?????? ?????? ??? Platform SDK ?? Microsoft Visual C++ ??? ????????. ??? ??? ??????? ????? ??? SHFolder.h ?????. ????? ????? Platform SDK ????? ???? ??????? SHFolder.exe ?????? ??????? ??????? ?????? ???????. ????? ??? ????? SHFolder.dll ? ???? ????????? ?????? ???????? ??????? ??? Windows 95 ?? Windows 98. ??? ????? ??? ????? ?????? ??????? ??? ????????? ????? ????????? ????? ??? ???????? DLL ??????? ??? ?????????. ???? ????? ?? ?????? ????? ????? ???????.

???? ???????? ???????? ??????? ????? ?????? ??? ???? API SHGetFolderPath:
#include <windows.h>
#include <shfolder.h>

PFNSHGETFOLDERPATHA GetFuncPtr_SHGetFolderPathA()
{
   static HMODULE hMod = NULL;
   PFNSHGETFOLDERPATHA pSHGetFolderPath = NULL;

   // Load SHFolder.dll only once
   if (!hMod)
      hMod = LoadLibrary("SHFolder.dll");

   if (hMod)
      // Obtain a pointer to the SHGetFolderPathA function
      pSHGetFolderPath = (PFNSHGETFOLDERPATHA)GetProcAddress(hMod, 
         "SHGetFolderPathA");

   return pSHGetFolderPath;
}
				

???? ????? ???????? ???????? ??????? ??????? ??? ?????? ???????? ????. ????? ????? ??? Windows 2000 ? ?? ????? ??? ??? ??????? ?????? ?? Windows 2000 ???????? ?? ?????? ???????? ????? ??? ?????????? ?? ??????? ??? ??????? ???? ???????. ??? ??? ?????? ???? ??? ?????????, ????? ??????? DLL ????? ?????? ??? ??????? ???? ????? ?????????. ?????? ??? ????? "??? ??????" ? ???? ?????? MigrateUserNT ?? ???? ???? ?????? ??? ??????.

???? ?????? ??????? ???????? ??????. ??????? ?????? ?? ?????? ??? ????? ?????? ???????. ??????? ??????? ????? ?? ???. ??????? ??????? ?? ???? ???? ???? ???? ??????? ?? ???? ??????? ??????? ????. ??? ???? ????? ????????.
#include <windows.h>
#include <objbase.h>
#include <shlobj.h>
#include <shfolder.h>

HRESULT CreateUserStartMenuShortcut(LPSTR pszShortcutFile,
            LPSTR pszDescription, LPTSTR pszRelativeFolder)
{
   HRESULT hr;
   PFNSHGETFOLDERPATHA pSHGetFolderPath = NULL;
   TCHAR pszLink[MAX_PATH];
   BOOL bFound = FALSE;

   pSHGetFolderPath = GetFuncPtr_SHGetFolderPathA();

   // Find the current user's Start Menu Programs folder
   if (pSHGetFolderPath)
      bFound = SUCCEEDED(pSHGetFolderPath(NULL, CSIDL_PROGRAMS, 
                           NULL, SHGFP_TYPE_CURRENT, pszLink));

   if (bFound)
   {
      // Proceed to create the shortcut
      IShellLink *pIShellLink = NULL;
      IPersistFile *ppf = NULL;
      WCHAR pLinkUnicode[MAX_PATH];

      CoInitialize(NULL);

      // Get a pointer to the IShellLink interface.
      hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
                            IID_IShellLink, (void **)&pIShellLink);

      if (SUCCEEDED(hr))
      {
         // Get a pointer to IPersistFile interface for saving shortcut
         hr = pIShellLink->QueryInterface(IID_IPersistFile, (void **)&ppf);

         if (SUCCEEDED(hr))
         {   
            hr = pIShellLink->SetPath(pszShortcutFile);
            hr = pIShellLink->SetDescription(pszDescription);

            if (SUCCEEDED(hr))
            {
               // Add the target folder to the Start Menu Programs path
               lstrcat(pszLink, "\\");
               lstrcat(pszLink, pszRelativeFolder);
               lstrcat(pszLink, "\\");

               // Create the directory if it does not exist
               CreateDirectory(pszLink,NULL);

               // Add the file name for the shortcut
               lstrcat(pszLink, pszDescription);
               lstrcat(pszLink, ".lnk");

               // Convert string to Unicode, and call IPersistFile::Save()
               MultiByteToWideChar(CP_ACP, 0, pszLink, -1, pLinkUnicode, MAX_PATH);
               hr = ppf->Save(pLinkUnicode, TRUE);
            }
            ppf->Release();
         }
         pIShellLink->Release();
      }
      CoUninitialize();
   }

   return hr;
}
				
???? ????? SHGetSpecialFolderPath ? SHGetFolderPath ?????? ????? ???? ?? ???????? ?????? ???? ???? ?????? ??? ??? ???????. ?????? ?? ?????? ???? CoInitialize ? CoUnitialize ??? ??? ??????. ??? ?? ??????? COM ?? ??????? ??????, ??? ?? ??? ??? ??? ??????????? ??? ???? DllMain DLL ???????. ??????? CoInitialize ??????? DLL_PROCESS_ATTACH ? CoUninitialize ????? DLL_PROCESS_DETACH.

?????

?????? ??? ???? ?? ????????? ??? ??????? DLLs ???? ??????? ?????? ?? ????? MSDN:
?????? ??????? SDK ";" ????? ????? ";" ??????? ";" ????? ???? ???????

???????

???? ???????: 241733 - ????? ??? ??????: 11/???/1428 - ??????: 3.4
????? ???
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows 98 Standard Edition
  • Microsoft Windows 95
????? ??????: 
kbmt kbfaq kbhowto kbmigrate kbsetup KB241733 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????241733

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com