-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
56 lines (40 loc) · 1.75 KB
/
utils.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __WIA_COMMON_UTILS
//==========================================================================
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//--------------------------------------------------------------------------
//------------------------------------------------------------
//Please read the ReadME.txt which explains the purpose of the
//sample.
//-------------------------------------------------------------
#define __WIA_COMMON_UTILS
#include <windows.h>
#include <objbase.h>
#include <stdio.h>
#include <tchar.h>
#include <wia.h>
#include <oleauto.h>
#include <shlwapi.h>
#include <strsafe.h>
#include <sstream>
#include <comdef.h>
#include <iostream>
#pragma comment(lib,"Ole32.lib") // linker issues
// Helper function to display an error message and an optional HRESULT
void ReportError( LPCTSTR pszMessage, HRESULT hr = S_OK );
HRESULT ReadPropertyGuid(IWiaItem2* pWiaItem2, PROPID propid , GUID* guid);
HRESULT ReadPropertyBSTR(IWiaPropertyStorage* pWiaPropertyStorage, PROPID propid , BSTR* pbstr);
HRESULT ReadPropertyLong(IWiaItem2* pWiaItem2, PROPID propid , LONG* lVal);
HRESULT WritePropertyGuid(IWiaPropertyStorage* pWiaPropertyStorage, PROPID propid , GUID guid);
HRESULT WritePropertyLong(IWiaPropertyStorage* pWiaPropertyStorage, PROPID propid , LONG lVal);
HRESULT ReadWiaPropsAndGetDeviceID( IWiaPropertyStorage *pWiaPropertyStorage ,BSTR* pbstrDeviceID );
HRESULT PrintItemName( IWiaItem2 *pIWiaItem2 );
void debug_output(HRESULT hr);
void sleepForSeconds(int second);
#endif