---------------------------------------------------------------------------
| 931 | #endif |
| 932 | //--------------------------------------------------------------------------- |
| 933 | HRESULT CreateLink(LPCSTR lpszPathObj, LPCSTR lpszWorkDir, |
| 934 | LPSTR lpszPathLink, LPSTR lpszDesc, LPSTR lpszArgument) |
| 935 | { |
| 936 | HRESULT hres; |
| 937 | IShellLink *psl; |
| 938 | CoInitialize(NULL); |
| 939 | hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); |
| 940 | |
| 941 | if( SUCCEEDED(hres) ) |
| 942 | { |
| 943 | IPersistFile *ppf; |
| 944 | // ���� � ��������� |
| 945 | psl->SetPath(lpszPathObj); |
| 946 | // ������� ������� ��� �������� |
| 947 | if( lstrlen(lpszWorkDir) > 0 ) |
| 948 | { |
| 949 | psl->SetWorkingDirectory(lpszWorkDir); |
| 950 | } |
| 951 | else |
| 952 | { |
| 953 | psl->SetWorkingDirectory(AnsiString(ExtractFilePath(lpszPathObj)).c_str()); |
| 954 | } |
| 955 | // �������� ������ |
| 956 | psl->SetDescription(lpszDesc); |
| 957 | // ��������� ������ ��� �������� |
| 958 | psl->SetArguments(lpszArgument); |
| 959 | hres = psl->QueryInterface(IID_IPersistFile, (void**)&ppf); |
| 960 | if( SUCCEEDED(hres) ) |
| 961 | { |
| 962 | wchar_t wsz[MAX_PATH]; |
| 963 | MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH); |
| 964 | hres = ppf->Save(wsz, true); |
| 965 | ppf->Release(); |
| 966 | } |
| 967 | psl->Release(); |
| 968 | } |
| 969 | CoUninitialize(); |
| 970 | return hres; |
| 971 | } |
| 972 | //--------------------------------------------------------------------------- |
| 973 | //--------------------------------------------------------------------------- |
| 974 | //--------------------------------------------------------------------------- |