目录浏览框(SHBorwseForFolder)函数在C++Biulder5中为何用不起来?(100分)

  • 主题发起人 主题发起人 Gmxyb
  • 开始时间 开始时间
G

Gmxyb

Unregistered / Unconfirmed
GUEST, unregistred user!
一些在C++Biulder4中使用了SHBorwseForFolder()的源程序在C++Biulder5中<br>编译通不过,报告“重复声明错误在Shlobj.h”。请问如何解决?
 
//---------------------------------------------------------------------------<br>#define NO_WIN32_LEAN_AND_MEAN &nbsp; &nbsp;/*注意此处*/<br>#include 《vcl.h》<br>#pragma hdrstop<br><br>#include "shlobj.h" &nbsp;<br>#include "Unit1.h"<br>//---------------------------------------------------------------------------<br>#pragma package(smart_init)<br>#pragma resource "*.dfm"<br>TForm1 *Form1;<br>//---------------------------------------------------------------------------<br>__fastcall TForm1::TForm1(TComponent* Owner)<br>&nbsp; &nbsp; &nbsp; &nbsp; : TForm(Owner)<br>{<br>}<br>//---------------------------------------------------------------------------<br><br>void __fastcall TForm1::Button1Click(TObject *Sender)<br>{<br>&nbsp; BROWSEINFOA bi;<br>&nbsp; char WDir[MAX_PATH];<br>&nbsp; LPITEMIDLIST ItemID;<br>&nbsp; memset(&amp;bi, 0, sizeof(BROWSEINFOA));<br>&nbsp; memset(WDir, 0, MAX_PATH);<br>&nbsp; bi.hwndOwner = Handle;<br>&nbsp; bi.ulFlags = BIF_RETURNONLYFSDIRS;<br>&nbsp; bi.lpszTitle = "请选择路径:";<br>&nbsp; ItemID = SHBrowseForFolder(&amp;bi);<br>&nbsp; SHGetPathFromIDList(ItemID, WDir);<br>&nbsp; Edit1-&gt;Text = String(WDir); <br>}<br>//---------------------------------------------------------------------------<br>
 
To Gmxyb<br>看C++Builder中SelectDirectory函数的源代码,在FileCtrl中。
 
多人接受答案了。
 
后退
顶部