HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2017
0205
スペースフォルダ選択Dialogを表示したい。5解決


スペース

リンク

2017/2/5(Sun) 13:12:05|NO.78135

https://gyazo.com/d3729b09e5583c21863b1bd0ed90e6e6
HSPでフォルダ選択Dialogを表示する方法を調べると、この画像の右側のUIのDialogを表示する方法しか出てきません。
画像左側の「ファイルを開く」と同じUIのフォルダ選択Dialogを表示させるにはどうすればいいのでしょうか?



この記事に返信する


inovia

リンク

2017/2/5(Sun) 17:01:58|NO.78138

昔作ったもの。エラー処理が甘い気がする。

#module mFolderSelect #define CLSID_FileOpenDialog "{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}" #define IID_IFileOpenDialog "{d57c7288-d4ad-4768-be02-9d969532d960}" #usecom IFileOpenDialog IID_IFileOpenDialog CLSID_FileOpenDialog #comfunc IFileOpenDialog_Show 3 int #comfunc IFileOpenDialog_SetOptions 9 int #comfunc IFileOpenDialog_GetOptions 10 var #comfunc IFileOpenDialog_GetResult 20 var #define IID_IShellItem "{43826d1e-e718-42ee-bc55-a1e261c37bfe}" #usecom IShellItem IID_IShellItem #comfunc IShellItem_GetDisplayName 5 int, var #define FOS_PICKFOLDERS 0x20 #define SIGDN_DESKTOPABSOLUTEPARSING 0x80028000 #defcfunc FolderDialog newcom pFod, IFileOpenDialog dwOptions = 0 IFileOpenDialog_GetOptions pFod, dwOptions IFileOpenDialog_SetOptions pFod, dwOptions | FOS_PICKFOLDERS IFileOpenDialog_Show pFod, hwnd ppsi = 0 IFileOpenDialog_GetResult pFod, ppsi if ppsi == 0 { delcom pFod return "" } newcom pSi, IID_IShellItem, -1, ppsi pszPath = 0 IShellItem_GetDisplayName pSi, SIGDN_DESKTOPABSOLUTEPARSING, pszPath if pszPath == 0 { delcom pSi delcom pFod return "" } dupptr szPath, pszPath, 64, 2 path = cnvwtos(szPath) delcom pSi delcom pFod return path #global mes FolderDialog()



スペース

リンク

2017/2/5(Sun) 18:34:06|NO.78141

まさに求めていたものが・・・本当に有難うございます。



まーる

リンク

2017/2/11(Sat) 13:01:24|NO.78223

私もこのダイアログを使いたいですが
初期フォルダを指定できるように、できませんか?



inovia

リンク

2017/2/11(Sat) 19:18:18|NO.78235

ほい。こんな感じ。
ついでに、メモリの開放漏れや長いパスが取り扱えない問題を修正。


#module mFolderSelect #define CLSID_FileOpenDialog "{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}" #define IID_IFileOpenDialog "{d57c7288-d4ad-4768-be02-9d969532d960}" #usecom IFileOpenDialog IID_IFileOpenDialog CLSID_FileOpenDialog #comfunc IFileOpenDialog_Show 3 int #comfunc IFileOpenDialog_SetOptions 9 int #comfunc IFileOpenDialog_GetOptions 10 var #comfunc IFileOpenDialog_SetFolder 12 int #comfunc IFileOpenDialog_GetResult 20 var #define IID_IShellItem "{43826d1e-e718-42ee-bc55-a1e261c37bfe}" #usecom IShellItem IID_IShellItem #comfunc IShellItem_GetDisplayName 5 int, var #define FOS_PICKFOLDERS 0x20 #define SIGDN_DESKTOPABSOLUTEPARSING 0x80028000 #uselib "shell32" #func SHCreateItemFromParsingName "SHCreateItemFromParsingName" wstr, sptr, var, var #uselib "kernel32" #cfunc lstrlenW "lstrlenW" sptr #uselib "ole32" #func CoTaskMemFree "CoTaskMemFree" sptr #define ctype IsDisableComObj(%1) (vartype(%1) != 6 || varuse(%1) == 0) #define global ctype FolderDialog(%1="") _FolderDialog(%1) #defcfunc _FolderDialog str strDefPath newcom pFod, IFileOpenDialog if IsDisableComObj(pFod) : return "" if ( strDefPath != "") { ppShellItem = 0 IShellItem_GUID = 0x43826d1e, 0x42eee718, 0xe2a155bc, 0xfe7bc361 SHCreateItemFromParsingName strDefPath, 0, IShellItem_GUID, ppShellItem if ( ppShellItem != 0){ newcom pShellItem, IID_IShellItem, -1, ppShellItem IFileOpenDialog_SetFolder pFod, ppShellItem delcom pShellItem } } dwOptions = 0 IFileOpenDialog_GetOptions pFod, dwOptions IFileOpenDialog_SetOptions pFod, dwOptions | FOS_PICKFOLDERS IFileOpenDialog_Show pFod, hwnd ppsi = 0 IFileOpenDialog_GetResult pFod, ppsi if ppsi == 0 { delcom pFod return "" } newcom pSi, IID_IShellItem, -1, ppsi if IsDisableComObj(pSi) : delcom pFod : return "" pszPath = 0 IShellItem_GetDisplayName pSi, SIGDN_DESKTOPABSOLUTEPARSING, pszPath if pszPath == 0 { delcom pSi delcom pFod return "" } dupptr szPath, pszPath, lstrlenW(pszPath)*2, 2 path = cnvwtos(szPath) CoTaskMemFree pszPath delcom pSi delcom pFod return path #global mes FolderDialog("C:\\")



まーる

リンク

2017/2/12(Sun) 10:02:33|NO.78243

ありがとうございます
より使いやすくなりました



ONION software Copyright 1997-2023(c) All rights reserved.