Randomize |
07.08.2011 14:42 |
Ответ: Пути к системным директориям.
Прошу простить, что не написал своё решение ранее (меня долго не было в сети):
Используемый DECLS файл "shell32.decls"
PHP код:
.lib "shell32.dll" api_CommandLineToArgv% (lpCmdLine$, pNumArgs%) : "CommandLineToArgvW" api_DoEnvironmentSubst% (szString$, cbString%) : "DoEnvironmentSubstA" api_DragAcceptFiles (hwnd%, fAccept%) : "DragAcceptFiles" api_DragFinish (hDrop%) : "DragFinish" api_DragQueryFile% (HDROP%, UINT%, lpStr$, ch%) : "DragQueryFileA" api_DragQueryPoint% (HDROP%, lpPoint*) : "DragQueryPoint" api_DuplicateIcon% (hInst%, hIcon%) : "DuplicateIcon" api_ExtractAssociatedIcon% (hInst%, lpIconPath$, lpiIcon%) : "ExtractAssociateIconA" api_ExtractIcon% (hInst%, lpszExeFileName$, nIconIndex%) : "ExtractIconA" api_ExtractIconEx% (lpszFile$, nIconIndex%, phiconLarge%, phiconSmall%, nIcons%) : "ExtractIconExA" api_FindEnvironmentString$ (szEnvVar$) : "FindEnvironmentStringA" api_FindExecutable% (lpFile$, lpDirectory$, lpResult$) : "FindExecutableA" api_Shell_NotifyIcon% (dwMessage%, lpData*) : " Shell_NotifyIconA" api_ShellAbout% (hwnd%, szApp$, szOtherStuff$, hIcon%) : "ShellAboutA" api_ShellExecute% (hwnd%, lpOperation$, lpFile$, lpParameters$, lpDirectory$, nShowCmd%) : "ShellExecuteA" api_SHAppBarMessage% (dwMessage%, pData*) : "SHAppBarMessage" api_SHFileOperation% (lpFileOp*) : " SHFileOperationA" api_SHFreeNameMappings (hNameMappings%) : "SHFreeNameMappings" api_SHGetFileInfo% (pszPath$, dwFileAttributes%, psfi*, cbFileInfo%, uFlags%) : " SHGetFileInfoA" api_SHGetNewLinkInfo% (pszLinkto$, pszDir$, pszName$, pfMustCopy%, uFlags%) : "SHGetNewLinkInfoA" api_SHGetFolderPath%(hwnd, p1, p2, p3, out*) : "SHGetFolderPathA" api_WinExecError (hwnd%, error%, lpstrFileName$, lpstrTitle$) : "WinExecErrorA"
Код Blitz3D:
Код:
Function GetMyDocumentsPath$()
Local bank = CreateBank(256)
Local s$ = ""
api_SHGetFolderPath(0, $5, 0, 0, bank)
For i = 0 To 255
b = PeekByte(bank, i)
If b = 0 Then Exit
s$ = s$ + Chr$(b)
Next
FreeBank(bank)
If Right$(s$, 1) <> "\" Then s$ = s$ + "\"
Return s$
End Function
Print GetMyDocumentsPath$()
WaitKey()
End
|