c++ - StillImage::GetDeviceList Pointer -


i'm trying make call method call called getdeviceslist in interface called stilliamge , getting empty results. think pointer problem i'm not c++ expert , think problem. method call is:

hresult getdevicelist(   dword dwtype,   dword dwflags,   [out]  dword *pdwitemsreturned,   [out]  lpvoid *ppbuffer ); 

i know working when plug imaging devices in , out eh nubmer of returned devices goes , down. fact result blank think due me not getting pointers correct - take quick , let me knwo if reason please?

#include "stdafx.h"  bool debug = true;  int _tmain(int argc, _tchar* argv[]) {     dword dwstitotal = 0;     psti psti = null;     hresult hres = sticreateinstance(getmodulehandle(null), sti_version, &psti, null);      sti_device_information deviceinfo[255];     memset(deviceinfo,0, sizeof(deviceinfo));      hres = psti->getdevicelist(null, null, &dwstitotal, (lpvoid*) deviceinfo);      printf("number devices %d\n", dwstitotal);     (int i=0; i<dwstitotal; i++){         printf("---------------------------------------------------\n");         printf("type %d\n", deviceinfo[i].devicetype);         printf("vendor %s\n", deviceinfo[i].pszvendordescription);         printf("device %s\n", deviceinfo[i].pszdevicedescription);         printf("portname %s\n", deviceinfo[i].pszportname);         printf("propprovider %s\n", deviceinfo[i].pszpropprovider);         printf("localname %s\n", deviceinfo[i].pszlocalname);         printf("internalname %s\n", deviceinfo[i].szdeviceinternalname);     }     psti->release();      if (debug){         char key;         std::cin >> key;     }      return 0; } 

thanks in advance , sorry asking such basic question!

regards,

neil

if check reference getdevicelist, last parameter ppbuffer (pointer a) handle sti-allocated buffer. trying send buffer allocated yourself, believe should crashing somehow...

anyway, here proper way it

sti_device_information* deviceinfo = null; hres = psti->getdevicelist(null, null, &dwstitotal, (lpvoid*) &deviceinfo); 

and pointer array of sti_device_information items, allocated sti itself. once done it, need release localfree.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -