本文介绍了Win32API Cant使用按钮单击打开对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.我陷入了Win32中的Openbox的困扰.
我已经读过这篇文章
(http://www.codeproject.com/Articles/3984/Customizing-the-quot-Browse-for-folder-quot-dialog).
该家伙使用一个对话框来调用文件夹浏览器"框,因为它在主图片上可见.
但是我不能只使用VIEW按钮而不使用中间的OpenBox来称呼它.
请帮助.
非常抱歉,我的英语不对,希望您能理解我/
Hi everyone.I got stuck with the Openbox in win32.
I''ve read this article
(http://www.codeproject.com/Articles/3984/Customizing-the-quot-Browse-for-folder-quot-dialog).
That dude used a dialog box to call Folder Browser-box as it is visible on the main picture.
But I can''t call it just pushing the VIEW button without using intermediate OpenBox.
HELP PLEASE.
And sorry for my wrong English, I hope you understand me/
推荐答案
#include <windows.h>
#include <shlobj.h>
#include <stdio.h>
int main()
{
BROWSEINFO bInfo;
LPITEMIDLIST pidl;
char pszBuffer[MAX_PATH];
bInfo.hwndOwner = NULL;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = pszBuffer;
bInfo.lpszTitle = "Select a Directory";
bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bInfo.lpfn = NULL;
bInfo.lParam = 0;
if(pidl = SHBrowseForFolder(&bInfo))
{
// Copy the path directory to the buffer
if(SHGetPathFromIDList(pidl,pszBuffer))
{
// pszBuffer now holds the directory path
printf(("You selected the directory: %s\n"),pszBuffer);
}
else
printf("Selected item not a folder\n");
}
else
printf("User cancelled OR failure with: SHBrowseForFolder(&bInfo);");
return 0;
}
这篇关于Win32API Cant使用按钮单击打开对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!