다음을 통해 공유


확장 단위 샘플 컨트롤 빌드

중요

이 항목의 콘텐츠 및 샘플 코드는 오래되었으며 현재 지원되지 않습니다. 현재 드라이버 개발 도구 체인에서는 작동하지 않을 수 있습니다.

이 섹션의 코드를 컴파일하여 UVC 확장 단위 샘플 컨트롤을 만들 수 있습니다. 이 프로젝트를 빌드할 때 해당 애플리케이션과 함께 사용하여 확장 단위에서 속성을 가져와서 설정할 수 있는 Microsoft ActiveX 컨트롤을 만듭니다.

컨트롤을 사용하려면 특정 확장 단위 기능을 구현하는 하드웨어가 필요합니다. 또는 USB 에뮬레이터를 사용할 수 있습니다.

다음 단계를 사용하여 컨트롤을 빌드합니다.

  1. 다음 패키지를 설치합니다.

    • Microsoft Windows Server 2003 SP1(서비스 팩 1) DDK(드라이버 개발 키트)
    • Microsoft DirectX 9.0 SDK 업데이트(2005년 2월)
    • Microsoft DirectX 9.0 2005년 2월 SDK Extras
  2. 다음 topics 샘플 코드를 개별 파일로 복사합니다.

    UVC 확장 단위에 대한 샘플 인터페이스

    샘플 확장 단위 플러그 인 DLL

    UVC 확장 단위에 대한 샘플 레지스트리 항목

    UVC 확장 단위용 샘플 애플리케이션

    확장 단위를 사용하여 이벤트 자동 업데이트 지원

    UVC INF 파일 제공

  3. 다음과 같이 원본 파일을 만듭니다.

    TARGETNAME= uvcxuplgn
    TARGETTYPE= DYNLINK
    TARGETPATH= obj
    TARGETEXT=  ax
    
    DLLENTRY=_DllMainCRTStartup
    DLLBASE=0x10080000
    USE_MSVCRT=1
    
    USE_STATIC_ATL=1
    
    USER_INCLUDES= $(O)
    
    INCLUDES=
    
    SOURCES= interface.idl \
     uvcxuplgn.cpp \
             stdafx.cpp    \
             interface_i.c \
             vidcap_i.c    \
             xuproxy.cpp
    
    TARGETLIBS= \
            $(SDK_LIB_PATH)\kernel32.lib          \
            $(SDK_LIB_PATH)\user32.lib            \
            $(SDK_LIB_PATH)\gdi32.lib             \
            $(SDK_LIB_PATH)\advapi32.lib          \
            $(SDK_LIB_PATH)\comdlg32.lib          \
            $(SDK_LIB_PATH)\ole32.lib             \
            $(SDK_LIB_PATH)\oleaut32.lib          \
            $(SDK_LIB_PATH)\uuid.lib              \
            $(SDK_LIB_PATH)\comctl32.lib
    
  4. 다음과 같이 메이크파일 파일을 만듭니다.

    #############################################################################
    #
    #       Copyright (C) Microsoft Corporation 1995
    #       All Rights Reserved.
    #
    #       MAKEFILE for WDM device driver kit
    #
    #############################################################################
    
    #
    # DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source
    # file to this component.  This file merely indirects to the real make file
    # that is shared by all the driver components of the Windows NT DDK
    #
    
    !if "$(WIN2K_DDKBUILD)" == ""
    !INCLUDE $(NTMAKEENV)\makefile.def
    !endif
    
  5. Microsoft Windows SDK 포함된 Guidgen.exe 도구를 사용하여 세 개의 GUID를 만듭니다.

    • 첫 번째 GUID를 확장 단위의 속성 집합 ID로 사용합니다. x 기반 GUID 자리 표시자를 Xuproxy.h, Xusample.rgs, Xuplgin.inf 및 하드웨어 수준의 확장 단위 설명자에서 새 GUID로 바꿉니다.
    • 두 번째 GUID를 확장 단위의 IID로 사용합니다. y 기반 GUID 자리 표시자를 Interface.idlXuplgin.inf의 새 GUID로 바꿉니다.
    • 세 번째 GUID를 확장 단위의 클래스 GUID(clsid)로 사용합니다. z 기반 GUID 자리 표시자를 Xuplgin.inf, Xuproxy.hXusample.rgs의 새 GUID로 바꿉니다.
  6. 다음과 같이 Uvcxuplgn.def 를 만듭니다.

    LIBRARY uvcxuplgn
    
    EXPORTS
        DllGetClassObject   PRIVATE
        DllCanUnloadNow     PRIVATE
        DllRegisterServer   PRIVATE
        DllUnregisterServer PRIVATE
    
  7. 다음과 같이 Uvcxuplgn.cpp 를 만듭니다.

    #include "stdafx.h"
    CComModule _Module;
    #include <initguid.h>
    #include "interface.h"
    #include "xuproxy.h"
    BEGIN_OBJECT_MAP(ObjectMap)
    OBJECT_ENTRY(CLSID_ExtensionUnit, CExtension)
    END_OBJECT_MAP()
    
    STDAPI DllRegisterServer(void)
    {
        return _Module.RegisterServer(FALSE, NULL);
    }
    
    STDAPI DllUnregisterServer(void)
    {
        return _Module.UnregisterServer();
    }
    
    EXTERN_C
    BOOL
    DllMain(
        HINSTANCE   hinst,
        DWORD       dwReason,
        LPVOID      lpReserved)
    {
        switch (dwReason) {
            case DLL_PROCESS_ATTACH:
    
                _Module.Init (ObjectMap, hinst);
                break;
    
            case DLL_PROCESS_DETACH:
                _Module.Term();
                break;
        }
        return TRUE;
    }
    
    extern "C" STDMETHODIMP DllCanUnloadNow(void)
    {
        return _Module.GetLockCount()==0 ? S_OK : S_FALSE;
    }
    
    extern "C" STDAPI DllGetClassObject(
        REFCLSID    rclsid,
        REFIID      riid,
        LPVOID      *ppv)
    {
        return _Module.GetClassObject(rclsid, riid, ppv);
    }
    
  8. 다음과 같이 Stdafx.h 를 만듭니다.

    // stdafx.h : include file for standard system include files,
    //      or project specific include files that are used frequently,
    //      but are changed infrequently
    
    #if !defined(AFX_STDAFX_H__722DC775_FE6F_42FB_BED5_E1E299976D17__INCLUDED_)
    #define AFX_STDAFX_H__722DC775_FE6F_42FB_BED5_E1E299976D17__INCLUDED_
    
    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    
    #define STRICT
    #ifndef _WIN32_WINNT
    #define _WIN32_WINNT 0x0400
    #endif
    #define _ATL_APARTMENT_THREADED
    
    #include <atlbase.h>
    //You may derive a class from CComModule and use it if you want to override
    //something, but do not change the name of _Module
    extern CComModule _Module;
    #include <atlcom.h>
    #include <atlctl.h>
    
    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
    
    #endif // !defined(AFX_STDAFX_H__722DC775_FE6F_42FB_BED5_E1E299976D17__INCLUDED)
    
  9. 다음과 같이 Stdafx.cpp 를 만듭니다.

    // stdafx.cpp : source file that includes just the standard includes
    //  stdafx.pch will be the pre-compiled header
    //  stdafx.obj will contain the pre-compiled type information
    
    #include "stdafx.h"
    
    #ifdef _ATL_STATIC_REGISTRY
    #include <statreg.h>
    #include <statreg.cpp>
    #endif
    
    #include <atlimpl.cpp>
    
  10. WDK 빌드 환경에서 를 호출하여 Build -cZg 샘플을 빌드합니다.

추가 정보

UVC 확장 단위 코드 샘플

UVC 확장 단위에 대한 샘플 인터페이스

샘플 확장 단위 플러그 인 DLL

UVC 확장 단위에 대한 샘플 레지스트리 항목

UVC 확장 단위용 샘플 애플리케이션

확장 단위를 사용하여 이벤트 자동 업데이트 지원

UVC INF 파일 제공