亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? faq62.htm

?? C++builder學習資料C++builder
?? HTM
?? 第 1 頁 / 共 2 頁
字號:


<HTML>

<HEAD>

   <TITLE>Allow the user to browse for a folder</TITLE>

   <META NAME="Author" CONTENT="Harold Howe">

</HEAD>

<BODY BGCOLOR="WHITE">



<CENTER>

<TABLE  BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="640">



<TR>

<TD>







<H3>

Allow the user to browse for a folder

</H3>

<BR>

<H3>Answer:</H3>

<P>

There are two ways to allow the user to browse for a folder. First, there's the hard way,

using the API function <TT>SHBrowseForFolder</TT>. Then there's the easy way, using the

VCL's <TT>SelectFolder</TT> function. <TT>SelectFolder</TT> is documented in the BCB

help system. This function works nicely, but unfortunately, it displays a form that uses

the old Win 3.1 icons for folders and drives. <TT>SHBrowseForFolder</TT> shows a more

contemporary dialog that contains the newer icons that are part of Windows 95, Windows 98,

and Windows NT4. This FAQ explains how to utilize the <TT>SHBrowseForFolder</TT> function

in a C++Builder project. Figure 1 shows the dialog box that pops up when you call <TT>SHBrowseForFolder</TT>.

</P>



<IMG SRC="images/browse.gif" BORDER=0 ALIGN="BOTTOM">  <BR>

<H4>Figure 1. The <TT>SHBrowseForFolder</TT> dialog</H4>

<P>

<TT>SHBrowseForFolder</TT> is part of the shell interface API. The prototype for the

function is located in <TT>SHLOBJ.H</TT>. Like most API functions,

<TT>SHBrowseForFolder</TT> takes a large, inexplicable structure as an argument.

The structure's type name is <TT>BROWSEINFO</TT>. You fill in the members of this

structure to control how the browse dialog will behave. After the user closes the dialog,

<TT>SHBrowseForFolder</TT> returns a pointer to an ID list (<TT>PIDL</TT>) that indicates

what folder was selected.

</P>

<P>

One confusing aspect of <TT>SHBrowseForFolder</TT> is that it doesn't return the directory

path to the folder that the user selected. One might presume that the <TT>BROWSEINFO</TT>

structure would contain a string for the directory path. Of course, this would

have made way too much sense, so Microsoft decided to implement an elaborate mechanism

that requires you to work for that directory string. As mentioned earlier,

<TT>SHBrowseForFolder</TT> returns a PIDL, which is a relatively worthless object. The

API contains a function called <TT>SHGetPathFromIDList</TT> that can convert a PIDL into

a directory path string.

</P>

<P>

The code segment below explains how to use <TT>SHBrowseForFolder</TT>.

</P>

<pre>

<b>void</b> <b>__fastcall</b> TForm1<b>:</b><b>:</b>Button1Click<b>(</b>TObject <b>*</b>Sender<b>)</b>

<b>{</b>

    BROWSEINFO    info<b>;</b>

    <b>char</b>          szDir<b>[</b>MAX_PATH<b>]</b><b>;</b>

    <b>char</b>          szDisplayName<b>[</b>MAX_PATH<b>]</b><b>;</b>

    LPITEMIDLIST  pidl<b>;</b>

    LPMALLOC      pShellMalloc<b>;</b>



    <font color="navy">// SHBrowseForFolder returns a PIDL. The memory for the PIDL is</font>

    <font color="navy">// allocated by the shell. Eventually, we will need to free this</font>

    <font color="navy">// memory, so we need to get a pointer to the shell malloc COM</font>

    <font color="navy">// object that will free the PIDL later on.</font>

    <b>if</b><b>(</b>SHGetMalloc<b>(</b><b>&</b>pShellMalloc<b>)</b> <b>==</b> NO_ERROR<b>)</b>

    <b>{</b>

        <font color="navy">// if we were able to get the shell malloc object,</font>

        <font color="navy">// then proceed by initializing the BROWSEINFO stuct</font>

        memset<b>(</b><b>&</b>info<b>,</b> <font color="blue">0x00</font><b>,</b><b>sizeof</b><b>(</b>info<b>)</b><b>)</b><b>;</b>

        info<b>.</b>hwndOwner <b>=</b> Handle<b>;</b>                 <font color="navy">// Owner window</font>

        info<b>.</b>pidlRoot  <b>=</b> <font color="blue">0</font><b>;</b>                      <font color="navy">// root folder</font>

        info<b>.</b>pszDisplayName <b>=</b> szDisplayName<b>;</b>     <font color="navy">// return display name</font>

        info<b>.</b>lpszTitle <b>=</b> <font color="blue">"Browse Title"</font><b>;</b>         <font color="navy">// label caption</font>

        info<b>.</b>ulFlags   <b>=</b> BIF_RETURNONLYFSDIRS<b>;</b>   <font color="navy">// config flags</font>

        info<b>.</b>lpfn <b>=</b> <font color="blue">0</font><b>;</b>                           <font color="navy">// callback function</font>



        <font color="navy">// execute the browsing dialog</font>

        pidl <b>=</b> SHBrowseForFolder<b>(</b><b>&</b>info<b>)</b><b>;</b>



        <font color="navy">// pidl will be null if they cancel the browse dialog.</font>

        <font color="navy">// pidl will be not null when they select a folder</font>

        <b>if</b><b>(</b>pidl<b>)</b>

        <b>{</b>

            <font color="navy">// try to convert the pidl to a display string</font>

            <font color="navy">// return is true if success</font>

            <b>if</b><b>(</b>SHGetPathFromIDList<b>(</b>pidl<b>,</b> szDir<b>)</b><b>)</b>

            <b>{</b>

                <font color="navy">// set one caption to the directory path</font>

                Label1<b>-></b>Caption <b>=</b> szDir<b>;</b>

            <b>}</b>



            <font color="navy">// set another caption based on the display name</font>

            Label2<b>-></b>Caption <b>=</b> info<b>.</b>pszDisplayName<b>;</b>



            <font color="navy">// use the shell malloc com object to free the pidl.</font>

            <font color="navy">// then call Relasee to signal that we don't need</font>

            <font color="navy">// the shell malloc object anymore</font>

            pShellMalloc<b>-></b>Free<b>(</b>pidl<b>)</b><b>;</b>

        <b>}</b>

        pShellMalloc<b>-></b>Release<b>(</b><b>)</b><b>;</b>

    <b>}</b>

<b>}</b>

</pre>

<H3>Understanding the purpose of <TT>SHGetMalloc</TT></H3>

<P>

<TT>SHBrowseForFolder</TT> returns a <TT>PIDL</TT> object. The <TT>PIDL</TT> is allocated by the shell's task

allocator. When you're done using the <TT>PIDL</TT>, it must be released by the task allocator. In

order to properly free the <TT>PIDL</TT> object, you must obtain a reference to the shell's task

allocator by calling the <TT>SHGetMalloc</TT> function. You can then use the task allocator

to deallocate the <TT>PIDL</TT>.

</P>

<P>

<TT>SHGetMalloc</TT> returns a pointer to an <TT>IMalloc</TT> COM object. The <TT>IMalloc</TT> COM interface

is documented in the OLE Reference MS help file that comes with C++Builder. If you're not

up to speed with COM (like...who is), then think of the <TT>IMalloc</TT> COM object as just another

C++ object that has methods that you can call. The method that we need for this FAQ is the

<TT>Free</TT> method. <TT>Free</TT> will release the <TT>PIDL</TT> object. When you're finished using the

task alloctor, call the <TT>Release</TT> method of the <TT>IMalloc</TT> object. The pseudo-code below depicts the

relationship between the COM methods and regular C++ code that we are more familiar with.

</P>

<PRE>

<B>COM code</B>                           <B>C++ psuedo-equivalent</B>

LPMALLOC pShellMalloc;             // think of pShellMalloc as an object that

SHGetMalloc(&pShellMalloc);        // handles new and delete for OS shell tasks



LPITEMIDLIST  pidl;                Tpidl *pidl;

pidl = SHBrowseForFolder(...);     pidl = new Tpidl();



pShellMalloc-&gt;Free(pidl);          delete pidl;



pShellMalloc-&gt;Release();

</PRE>

<H3>The <TT>BROWSEINFO</TT> structure</H3>

<P>

The <TT>BROWSEINFO</TT> structure allows you to control the appearance and behavior

of the <TT>SHBrowseForFolder</TT> dialog. Each <TT>BROWSEINFO</TT> structure is described

below.

</P>

<pre>

<b>typedef</b> <b>struct</b> <b>{</b>

    HWND          hwndOwner<b>;</b>

    LPCITEMIDLIST pidlRoot<b>;</b>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品无人码麻豆乱码1区2区 | 欧美一区二区三区视频免费| 久久精品国产77777蜜臀| 亚洲国产精品成人综合 | 欧美日韩一级二级| 国产精品亚洲第一 | 高清国产一区二区三区| 午夜精品久久久久久久99樱桃| 久久久一区二区| 在线不卡的av| 色婷婷激情一区二区三区| 国产一区二区女| 免费三级欧美电影| 午夜欧美视频在线观看| 国产精品美女久久久久高潮| 精品欧美一区二区三区精品久久 | 亚洲精品欧美综合四区| 国产午夜精品在线观看| 欧美一区二区精品久久911| 一本色道**综合亚洲精品蜜桃冫| 黄页网站大全一区二区| 视频在线观看一区| 亚洲成人自拍偷拍| 亚洲人精品午夜| 国产精品毛片a∨一区二区三区 | 亚洲一区二区三区小说| 国产精品国产a| 久久久不卡网国产精品二区| 91精品国产综合久久香蕉麻豆 | 成人高清视频在线| 国产很黄免费观看久久| 老司机精品视频在线| 美女在线视频一区| 免费成人深夜小野草| 免费在线成人网| 人人超碰91尤物精品国产| 日韩国产欧美在线播放| 亚洲主播在线播放| 午夜精品视频在线观看| 香蕉影视欧美成人| 天天操天天干天天综合网| 亚洲成av人片在www色猫咪| 亚洲一区二区黄色| 亚洲午夜久久久久中文字幕久| 亚洲精品国产精华液| 亚洲少妇最新在线视频| 一区二区中文视频| 亚洲嫩草精品久久| 亚洲高清在线精品| 日本91福利区| 国产一区二区不卡老阿姨| 国产麻豆欧美日韩一区| 成人av在线网站| 色综合久久久久综合99| 欧美日韩中文字幕一区| 欧美一区二区三区免费大片| 欧美成人艳星乳罩| 欧美激情资源网| 亚洲日本在线看| 午夜不卡在线视频| 久久精品国产亚洲高清剧情介绍 | 国产乱码精品一品二品| 国产成人精品亚洲午夜麻豆| www激情久久| 国产精品夫妻自拍| 性做久久久久久| 国产精品自拍一区| 99久久精品情趣| 5566中文字幕一区二区电影| 久久久精品中文字幕麻豆发布| 国产精品久久久久久久久久久免费看 | 国产酒店精品激情| av一区二区三区四区| 欧美日韩成人激情| 2023国产精品| 亚洲精选在线视频| 精品一区二区三区久久| 91免费在线播放| 欧美大片一区二区| 亚洲欧美日韩电影| 精品一区二区精品| 日本高清不卡在线观看| 欧美成人猛片aaaaaaa| 国产精品激情偷乱一区二区∴| 亚洲在线视频网站| 国产综合色视频| 欧美少妇一区二区| 国产日韩影视精品| 日韩制服丝袜先锋影音| 成人免费观看视频| 日韩免费观看高清完整版在线观看| 欧美极品美女视频| 美女视频一区在线观看| 91久久精品国产91性色tv| 欧美mv日韩mv国产| 亚洲国产视频在线| 国产福利一区二区三区视频在线| 欧美最新大片在线看| 久久久www成人免费毛片麻豆| 亚洲自拍另类综合| 99久久久国产精品免费蜜臀| 日韩美女一区二区三区四区| 亚洲另类一区二区| 久久色在线观看| 亚洲福利电影网| 99热国产精品| 久久久国产午夜精品| 奇米色一区二区| 欧美精品乱码久久久久久按摩 | 久久久久国产成人精品亚洲午夜| 亚洲国产精品麻豆| 波多野结衣精品在线| www亚洲一区| 美女诱惑一区二区| 欧美日韩高清一区二区不卡| 成人免费在线播放视频| 国产成人av一区二区三区在线| 在线不卡a资源高清| 亚洲国产日产av| 日本道色综合久久| 亚洲欧美日韩久久精品| 不卡欧美aaaaa| 国产精品美女www爽爽爽| 国产精品亚洲视频| 国产日韩一级二级三级| 国产乱码字幕精品高清av| 日韩美女视频在线| 蜜桃av一区二区在线观看| 欧美日韩激情在线| 亚洲国产婷婷综合在线精品| 在线视频综合导航| 亚洲综合免费观看高清在线观看| 91在线国内视频| 国产精品日日摸夜夜摸av| 国产精品亚洲成人| 中国av一区二区三区| 成人中文字幕电影| 综合分类小说区另类春色亚洲小说欧美| 国产精品一线二线三线| 久久久精品影视| 成人av免费在线观看| 中文字幕一区二| 色成人在线视频| 亚洲午夜三级在线| 日韩欧美激情一区| 韩国三级在线一区| 欧美国产欧美亚州国产日韩mv天天看完整| 国产精品99久久久久久似苏梦涵| 国产欧美精品一区二区三区四区 | 亚洲日本免费电影| 91国偷自产一区二区三区观看 | 欧美日韩在线播| 天堂av在线一区| 精品国产一区二区在线观看| 国产一区视频网站| 国产精品久久久爽爽爽麻豆色哟哟| 成人免费高清在线观看| 亚洲综合色网站| 欧美一区三区二区| 国产精品99久| 伊人开心综合网| 91精品久久久久久蜜臀| 狠狠色丁香婷综合久久| 1024亚洲合集| 欧美日韩国产电影| 国产一区二三区| 亚洲天堂成人在线观看| 欧美日韩国产一区二区三区地区| 美女久久久精品| 国产精品成人一区二区艾草| 欧美三片在线视频观看 | 91成人国产精品| 老司机免费视频一区二区三区| 国产精品乱码人人做人人爱| 欧美日韩一区小说| 韩国成人福利片在线播放| 亚洲欧美一区二区久久| 欧美一区二区三区在线| 不卡一区在线观看| 日韩精品色哟哟| 国产精品久99| 欧美成人女星排名| 色噜噜夜夜夜综合网| 国内精品自线一区二区三区视频| 亚洲欧美色图小说| 欧美va亚洲va| 亚洲欧美色综合| 精品国免费一区二区三区| 在线观看国产一区二区| 国产精品一区二区果冻传媒| 香港成人在线视频| 中文字幕免费不卡| 欧美一区二区播放| 91视频www| 国产一区二区三区高清播放| 香港成人在线视频| 亚洲色图制服诱惑| 久久综合色之久久综合| 欧美三级日韩三级| 99精品欧美一区|