[Bug 2339] DVD Shrink Open Files dialog doesn't work
Wine Bugs
wine-bugs at winehq.org
Sun Jul 25 02:42:36 CDT 2004
http://bugs.winehq.org/show_bug.cgi?id=2339
------- Additional Comments From jonathan at ernstfamily.ch 2004-25-07 02:42 -------
Here is the answer from the author; I splitted his answer in two part and put the
other part in bug 2338.
To see the original answer with correct indentation, please read here:
http://forum.digital-digest.com/showthread.php?s=&postid=183082#post183082
--------------------
I attached some code snippets, if you need more information, feel free to
contact me directly: dvdshrink "at" dvdshrink.info
The browse for folder dialog uses some kind of callback, I forget for what
purpose exactly, but I attached the code also.
/ **************************************************
***************************
SelectFolderDlg
**************************************************
***************************/
#ifndef BIF_NEWDIALOGSTYLE
#define BIF_NEWDIALOGSTYLE 0x0040
#endif
#ifndef BIF_USENEWUI
#define BIF_USENEWUI 0x0050
#endif
// browser callback: when initialized, set the initial selection
// to the specified buffer
int CALLBACK _SHBrowseForFolderCallbackProc(
HWND hwnd,
UINT uMsg,
LPARAM lParam,
LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED)
{
LPCTSTR szpath = (LPCTSTR) lpData;
if (szpath)
{
if (_tcslen(szpath))
{
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
}
}
}
return 0;
}
bool SelectFolderDlg(HWND hwnd,
LPCTSTR sztitle,
CString& szfolder, bool bAllowNew)
{
// get malloc interface for piddles
IMalloc * pmalloc = NULL;
if (FAILED(SHGetMalloc(&pmalloc)))
return false;
// get root folder
LPITEMIDLIST pidl = NULL;
SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
// do browse
TCHAR szpath[MAX_PATH] = {0};
BROWSEINFO sInfo = {0};
sInfo.lpszTitle = sztitle;
sInfo.pidlRoot = pidl;
sInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_VALIDATE;
sInfo.lpfn = _SHBrowseForFolderCallbackProc;
sInfo.hwndOwner = hwnd;
sInfo.lParam = (LPARAM)(LPCTSTR)(szfolder);
if (bAllowNew)
sInfo.ulFlags |= BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_USENEWUI;
LPITEMIDLIST pid2;
pid2 = SHBrowseForFolder(&sInfo);
pmalloc->Free(pidl);
// if we have a folder
bool bok = false;
if (pid2)
{
if (SUCCEEDED(SHGetPathFromIDList(pid2, szpath)))
{
bok = true;
szfolder = szpath;
}
pmalloc->Free(pid2);
}
// free piddles
pmalloc->Release();
// ok!
return bok;
}
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the wine-bugs
mailing list