tags:

views:

143

answers:

2

how can i use this dll function?:

extern "C"__declspec(dllexport) 
  void   __cdecl InvertRawPic(unsigned char *In, unsigned char *Out, 
                              unsigned int rows, unsigned int cols);

in QT. This function is to invert images.

A: 
vnm
A: 

thanks but it doesn't work This I'm try

const unsigned char ROWS=8;
const unsigned char COLS=8;

unsigned char RawPicIn[ROWS*COLS]  =
                                                           {255,0,0,0,0,0,0,0,
                                                            0,255,0,0,0,0,0,0,
                                                                0,0,255,0,0,0,0,0,
                                                                0,0,0,255,0,0,0,0,
                                                                0,0,0,0,255,0,0,0,
                                                                0,0,0,0,0,255,0,0,
                                                                0,0,0,0,0,0,255,0,
                                                                0,0,0,0,0,0,0,255};

unsigned char RawPicOut[ROWS*COLS] ;



__declspec(dllexport)typedef void  (*ft)(unsigned char *In, unsigned char *Out, unsigned int rows, unsigned int cols);


void ImageWindow::berechnenDLL()
{
// Fall 2: DLL-Funktion mit Übergabe eines Rohbildes (nur Array)
    HINSTANCE h = LoadLibrary(L"DllMitLTI");
   if(!h) { MessageBox(0,L"dll nicht gef11111.",L"",MB_OK); return; }
   FARPROC f = GetProcAddress(h,"InvertRawPic");
  ft  f1 = (ft) f;

   if(!f1) { MessageBox(0,L"func nicht2 gef.",L"",MB_OK); return; }
 f1(RawPicIn, RawPicOut, ROWS, COLS);
 MessageBox(0,L"aufruf erfolgreich",L"",MB_OK);}
Parvesh
You should look, where your program fails. If it can't load library, then may be your library not in PATH nor in your program directory or it's name is wrong (try to add .dll extension to lib name). If it can't find function pointer, then maybe you have wrong function's name.
vnm