윈도우 앱개발을 향하여

블로그 이미지
윈도우 10 스토어에 앱을 개발해 올리는 것을 목표로 하고 있습니다. 비전공자가 독학으로 시도하는 일이어서 얼마나 걸릴지 모르겠지만... 아무튼 목표는 그렇습니다!!
by 코딩하는 경제학도
  • Total hit
  • Today hit
  • Yesterday hit

Understanding Shell Namespace Extensions (MSDN 번역)


윈도우 탐색기는 사용자가 Shell Object에 접근할 수 있게 도와주는 도구와 결합된 Shell namespace의 graphical representation이다. With a namespace extension, you can take any body of data and have Windows Explorer present it to the user as a virtual folder. When a user browses into this folder, your data는 tree-structured 계층의 폴더들과 파일들로 표현되어 보여집니다, much like the rest of the Shell namespace. 사용자와 application들은 다른 namespace object들과 비슷한 방법으로 가상 폴더(virtual folder)의 내용물을 사용할 수 있습니다. 이 문서는namespace extension을 생성하는 방법을 다룹니다.


목차

How a Namespace Extension Works

The Default System Folder View Object(DefView)

How Windows Explorer Interacts with a Namespace Extension

TreeView

Folder View

Menu Bar and Toolbars

Status Bar


- How a Namespace Extension Works

윈도우 탐색기가 보여주는 모든 폴더들은 내부적으로 folder object라 불리는 COM(Component Object Model) Object로 대표됩니다(represented). 사용자가 폴더 또는 폴더의 내용물을 건드릴 때마다 쉘은 standard interface들 중 하나를 통하여 해당 folder object와 소통합니다. Folder object는 사용자의 행동에 맞춰 필요한 반응을 하고, 쉘은 윈도우 탐색기로 그 변화를 출력합니다.

사용자가 사용하는 대부분의 폴더들과 파일들은 file system 또는 system virtual folder(휴지통 같은)에 속합니다. 이런 standard folders들의 기능을 레지스터를 수정하거나 Shell extension handler를 implementing함으로써 확장할 수 있습니다(Creating Shell Extension handlers 참조). 하지만 쉘을 확장하는 것은 당신의 정보가 빠르게 normal file system의 파일이나 폴더로 packaged될 수 있을 때 유용합니다.

파일 시스템의 파일이나 폴더로 정보를 저장하는 것이 권장되지 않거나 심지어는 불가능한 경우도 존재합니다. 
(A collection of items that is most effectively packaged in a single file, such as a database. A collection of items stored on a remote computer that does not have a standard Windows file system. An example of such data is the information stored on a personal digital assistant (PDA) or digital camera. A collection of items that does not represent stored data. An example of such data is the printer links contained by the standard Printers folder.)


One way to present this kind of data to a user is to write an application to allow users to view and interact with the various items. However, if your data can be presented as a folder/file hierarchy, much of the functionality you will need to implement might be user interface services that are already provided by Windows Explorer. A much more efficient approach could be to write a namespace extension and let Windows Explorer become your GUI.

To implement a namespace extension, your information must be organized as a tree-structured namespace. Your namespace root is presented as a virtual folder in the Shell namespace. The root folder, and all its subfolders and data items, becomes part of the Shell namespace, and Windows Explorer becomes your user interface. You can thus present your information to the user in a familiar and readily accessible way with much less UI programming than would be required for a custom application.

A namespace extension consists of two basic components:

  • A data manager
  • An interface between the data manager and Windows Explorer

The first component on the list is entirely up to you. You can store and manage your data in whatever way is most effective. The second component is the code needed to package your data as folder objects and handle the interaction with Windows Explorer. Windows Explorer can then call these objects to allow users to view and interact with your data as if it were a collection of folders and files. Your namespace extension's folder objects must interact with Windows Explorer as if they were normal folders. Before attempting to implement a namespace extension, you must first understand how Windows Explorer handles a folder object.

- The Default System Folder View Object (DefView)

The Shell provides a default implementation of the folder view, colloquially known as DefView, so that you can avoid much of the work of implementing your own namespace extension. Because some view features cannot be achieved through custom views, it is often recommended that the default system folder view object is used in place of a custom view. For more information, see SHCreateShellFolderView.

- How Windows Explorer Interacts with a Namespace Extension

Windows Explorer provides users with a GUI that allows them to do a variety of tasks, including:

  • Navigating the namespace hierarchy and viewing the contents of folders.
  • Managing the contents of the namespace by moving, deleting, and copying objects.
  • Retrieving a variety of information about objects.
  • Launching applications.

The Windows Explorer GUI has five basic components. The following illustration names the components and shows where they are typically displayed within Windows Explorer.


When a user displays a folder that belongs to a namespace extension in Windows Explorer, the folder object has at least partial control over the contents of all five areas.

- Tree View

The tree view provides a high-level view of the namespace. This area hosts a tree view control that can display every namespace folder and the folder's position in the namespace hierarchy. A user can perform several operations with the tree view area, including:

  • Displaying or hiding the next level in the namespace.
  • Copying, moving, or deleting folders.
  • Right-clicking a folder to display a shortcut menu.
  • Selecting a folder and viewing its contents in the folder view.

The tree view communicates with folder objects primarily through their IShellFolder interface. For example, when a user clicks the plus sign (+) next to the folder's icon, Windows Explorer expands the display to show the folder's subfolders. To obtain the information needed to update the tree view, the Shell makes several calls to the folder object's IShellFolder interface to:

  • Request the folder's attributes.
  • Enumerate the contents of the folder.
  • Request display names for each subfolder.
  • Request an icon to display next to each folder.

Windows Explorer then updates the tree view to show the selected folder's subfolders. If the subfolders have subfolders, a '+' character is displayed next to their folder icon. There are a number of more sophisticated tasks that a user can also perform with the tree view, including:

  • Using the Clipboard to cut or copy a folder and paste it into another folder.
  • Using drag-and-drop to cut or copy a folder and drop it on another folder.
  • Using a search engine to search for items in a folder or its subfolders.
  • Modifying the folder's properties.

For a more detailed discussion of how a namespace extension handles these user actions, see Implementing the Basic Folder Object Interfaces.

- Folder View

When a user selects a folder, the contents of the folder are displayed in the folder view. To some extent, the normal functionality of the folder view overlaps with the tree view. Users can move or copy folders, change folder properties, view the contents of a subfolder, display a shortcut menu for a folder, and so on. However, there are some distinct differences between tree view and folder view:

  • Folder view displays only the contents of a single folder, not part or all of the namespace hierarchy.
  • Folder view displays file objects as well as folder objects.
  • Folder view can display much more information about objects than tree view.
  • Folder view allows namespace extensions to have almost complete control over what information is displayed and how. Only minor aspects of the tree view, such as folder icons, can be modified.

Unlike the tree view, Windows Explorer does not directly control the contents of the folder view. The folder view is an area that Windows Explorer provides to folder objects. Displaying and managing the contents of a folder in the folder view are the responsibility of the folder object. Although most folder views follow a fairly standard format, there are actually few limitations on what can be displayed or how. An extreme case is the Internet folder, which is a full-featured browser.

When a user selects a folder that belongs to your namespace extension, you create a window and pass its handle to Windows Explorer. This window becomes a child of the folder view window. Windows Explorer provides the dimensions of the folder view window but places no restrictions on the content of your child window. You can then use the child window to display the folder's folder view.

Namespace extensions use one of two approaches for creating a folder view:

  • Use your child window to host a list view control. This control allows you to display the contents of a folder in much the same way as the Windows Explorer classic view.
  • Use your child window to host a WebBrowser control and use a Dynamic HTML (DHTML) document to display the contents of the folder.

Both approaches display a folder view that looks very much like that displayed for system folders. However, if you want to use a different display scheme, you are free to do so.

- Menu Bar and Toolbars

Like most Windows applications, Windows Explorer provides the user with a collection of tools. A complete selection of tools is available through the menu bar. The more commonly used tools are also represented by buttons or edit boxes on a toolbar. Unlike many Windows applications, the Windows Explorer menu bar is actually a toolbar control that has been customized to behave like a conventional menu. Both the menu bar and the toolbar are incorporated into a rebar control to allow users to organize the individual controls to suit their needs.

By default, Windows Explorer supports a standard set of buttons and menu items, such as Copy and Properties. Your namespace extension can customize the menu bar and toolbars by deleting standard tools and adding custom tools. When your folder view object is initialized, Windows Explorer passes a pointer to its IShellBrowser interface. This interface supports several methods that you can call to customize the menu bar and toolbar. When the user selects one of your custom menu items or toolbar buttons, Windows Explorer forwards WM_COMMAND messages for custom menu and toolbar items to your child window's window procedure.

- Status Bar

The Windows Explorer status bar displays information about the currently selected object. Your namespace extension can use the status bar to display status information, such as a text string. You can customize the status bar by calling IShellBrowser.



AND

ARTICLE CATEGORY

분류 전체보기 (56)
Programming (45)
MSDN (4)
개발노트 (2)
reference (5)

RECENT ARTICLE

RECENT COMMENT

CALENDAR

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

ARCHIVE