// stet.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const UINT WM_ONRECEIVE_EVENT      = 0x8200; //WM_APP+0x0200
const UINT WM_ONSTATUS_EVENT       = 0x8201;
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
    
    HRESULT   hr;
    CLSID     clsid;
    WSDeviceType wsDevType;    
    CComBSTR bstr,GRS,Gateway,DeviceDescript,GetAllGCIDDAs,GetAllGCIDDAsX;
         if (FAILED(CoInitialize(NULL)))
         {
               return FALSE;
         }
    hr =   CLSIDFromProgID(OLESTR("WSClient.WSConfiguredDevices"),&clsid);
     
    if (hr != S_OK)
    {    
        printf ( "레지에 등록된 GUID값이 없다 failed: 0x%x\n", hr);
        return false ;
    }
     
      IWSConfiguredDevices *pDevies=NULL;
      hr = ::CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IWSConfiguredDevices, (void**)&pDevies);
       if (hr !=S_OK) {
        
           printf ("IWSConfiguredDevices 메소드를 호출 하지 못했습니다. failed: 0x%x\n", hr);
           return false ;
        }
       
       hr = pDevies->Register((BSTR)"GORES");   
      
       if (hr !=S_OK) {
         
           printf ( "Register 메소드를 호출 하지 못했습니다. failed: 0x%x\n", hr);
           return false ;
        }
                ////////이부분까지는 넘어가는 데요.. 
 
        IWSDevice *pDeviseds=NULL;
        hr = ::CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IWSDevice, (void**)&pDeviseds);
         
        if (hr != S_OK){
            
           printf ("IWSDevice 메소드를 호출 하지 못했습니다.failed: 0x%x\n", hr);   //이부분 부터 에러가 나오는데요.. 혹시 문법에 문제가 있는건인지... 혹시 문법 문제라면 조금 알려주시면 감사드리겠습니다.
           return false ;
        }
                
        pDeviseds->get_Poolname(&bstr); 
        pDeviseds->get_DeviceType(&wsDevType);
                pDeviseds->get_Port(&GRS);
                pDeviseds->get_Gateway(&Gateway);
                pDeviseds->get_DeviceDescriptor(&DeviceDescript);
                pDeviseds->GetAllGCIDDAs(&GetAllGCIDDAs);
        pDeviseds->GetAllGCIDDAsX(&GetAllGCIDDAsX);
        IWSHostSessionDispatch *pDev=NULL;
        hr = ::CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IWSHostSessionDispatch, (void**)&pDev);
         
        if (hr != S_OK){
            
           printf ("IWSFilterSessionDispatch 메소드를 호출 하지 못했습니다.failed: 0x%x\n", hr);
           return false ;
        }
         
        hr = pDev->Initialize((BSTR)"GORES",wsDevType,0);
        hr = pDev->Open();
        if (hr != S_OK){
            
           printf ("Initialize 메소드를 호출 하지 못했습니다.failed: 0x%x\n", hr);
           return false ;
        }
        
    ::CoUninitialize();
    return 0;
}
오늘도 좋은 하루 되세요.
        
        
                    
                    
                    
                    
                    
    
                    
                    
                    
                    
                    
                
                    [최초 등록일: ]
                    [최종 수정일: 12/14/2005]