source: trunk/Utilities/Miscellaneous/NullBstrArgument/Application/Application.cpp @ 180

Last change on this file since 180 was 180, checked in by roman, 11 years ago
File size: 887 bytes
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2013
3// Created by Roman Ryltsov roman@alax.info
4
5#include "stdafx.h"
6#import "libid:376B7D27-4AD3-47F6-AC02-D2DDE9E5A9B6" no_namespace raw_interfaces_only
7
8#define A(x) B(x, __LINE__)
9#define B(x, y) if(FAILED(x)) { CString s; s.Format(_T("Failed at line %d: %hs\n"), y, #x); OutputDebugString(s); }
10
11int _tmain(int argc, _TCHAR* argv[])
12{
13        A(CoInitialize(NULL));
14        {
15                CComPtr<IFoo> pFoo;
16                A(pFoo.CoCreateInstance(__uuidof(Foo)));
17                CComBSTR sValue;
18                sValue = "Application";
19                A(pFoo->Bar1(&sValue));
20                ATLTRACE("sValue 0x%p \"%ls\"\n", sValue, CStringW(sValue));
21                A(pFoo->Bar1(NULL));
22                sValue = "Application";
23                A(pFoo->Bar2(&sValue));
24                ATLTRACE("sValue 0x%p \"%ls\"\n", sValue, CStringW(sValue));
25                A(pFoo->Bar2(NULL));
26        }
27        CoUninitialize();
28        return 0;
29}
30
Note: See TracBrowser for help on using the repository browser.