windows - How to use WIA in C++? -



windows - How to use WIA in C++? -

i found this tutorial on using wia in c++, don't understand how utilize it. next doesn't succeed, , don't wrong here. copied code tutorial.

void init() { iwiadevmgr2* devmgr; hresult hr = createwiadevicemanager( &devmgr ); if(!succeeded(hr)) { std::cout << "couldn't create wia device manager!\n"; return; } ... } hresult createwiadevicemanager(iwiadevmgr2** devmgr) { if(devmgr == 0) homecoming e_invalidarg; *devmgr = 0; homecoming cocreateinstance( clsid_wiadevmgr2, 0, clsctx_local_server, iid_iwiadevmgr2, (void**)devmgr); }

by way, using windows 7 64-bit, using iwiadevmgr2 should fine.

createwiadevicemanager returns -2147221008

that's 0x800401f0 when interpret/display unsigned number. should, hresult not signed type. winerror.h sdk file:

// // messageid: co_e_notinitialized // // messagetext: // // coinitialize has not been called. // #define co_e_notinitialized _hresult_typedef_(0x800401f0l)

add line initialization code:

coinitialize(null);

c++ windows wia

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -