YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Free Trial
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
ActiveX COM Products
Technical Support

Links

Get Ready to Unleash the Power of UCanCode .NET


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


MFC Example: CoInitializeEx and SHBrowseForFolder  with file folder browser

 
 

Sorry, it should have been FolderBrowse.jpg

Introduction

File browsing in MFC is easy due to the included CFileDialog class. CFolderDlg wraps the SDK's SHBrowseForFolder function and makes folder browsing as easy as file browsing.

Features

The programmer can specify an initial folder. The user can create new folders. The dialog is resizable.

Using the code

You can get the name of a user selected folder in three lines of code:

Collapse Copy Code
// create and initialize a new object
CFolderDlg dlg(TRUE, m_folder, this);

// show dialog
if (dlg.DoModal() == IDCANCEL) return;

// get selected folder
m_folder = dlg.GetFolderName();

If you want to give some extra information to the user, you can add the following line:

Collapse Copy Code
// set the text that is displayed above the tree view control
dlg.SetTitle("Any instructions...");

The CFolderDlg constructor looks like this:

Collapse Copy Code
CFolderDlg(BOOL HideNewFolderButton, 
        const CString& InitialFolder, CWnd* pParent);

Points of Interest

If you are using Microsoft Visual C++ 6.0 (as I am), you will have to upgrade your Software Development Kit (SDK):

  1. Download the ISO version.
  2. Use DAEMON Tools to install the SDK.
  3. Replace your include folders:

    out:

    1. ...\MICROSOFT VISUAL STUDIO\VC98\<any>

    in:

    1. ...\MICROSOFT PLATFORM SDK\INCLUDE
    2. ...\MICROSOFT PLATFORM SDK\INCLUDE\MFC
    3. ...\MICROSOFT PLATFORM SDK\INCLUDE\ATL
    4. ...\MICROSOFT PLATFORM SDK\INCLUDE\CRT

If your compiler can't find CoInitializeEx(), add #define _WIN32_DCOM to your stdafx.h.

 

 

 

Copyright ?1998-2009 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net