Laex / Delphi-OpenCV

Project Delphi-OpenCV. Translation of OpenCV library header files in Delphi
507 stars 226 forks source link

Wrong type in ocv.highGUI_c #101

Closed HuguesDug closed 6 years ago

HuguesDug commented 6 years ago

Hello folks,

Yet another type that is incorrectly translated in ocv.highGUI_c

The type returned by cvGetWindowHandle is an handle to a window (hwnd), not a pointer.

And by the way (but I think this is internal opencv issue) it is not the window handle, it is the drawing control handle. If you want to remove the "title bar" with Windows API, you have to get the parent of this handle to really gain the handle of the window.

Regards

Hugues

356 {$IFDEF SAFELOADLIB} 357

358 type 359 TcvGetWindowHandle = function(const name: pCvChar): Pointer; cdecl; 360

361 var 362 cvGetWindowHandle: TcvGetWindowHandle; 363 {$ELSE} 364 function cvGetWindowHandle(const name: pCvChar): Pointer; cdecl; 365 {$ENDIF}

blaisexen commented 6 years ago

@HuguesDug

I've read all your post about issues, would you share all your .pas codes that you've made changes?

what about a link that we can download those files you've changed?

thanks in advance.

HuguesDug commented 6 years ago

I will... not this evening, busy, but next week-end.

HuguesDug commented 6 years ago

@blaisexen

Here is an upload link: http://dl.free.fr/ne4ff3NGO

blaisexen commented 6 years ago

thanks,, I will try it :dancer:

HuguesDug commented 6 years ago

@blaisexen You can see that there is only the core fil that is modified. The over request for modification that I raised were sorted out by the team. Only the last ones are open.

blaisexen commented 6 years ago

Ok, I think I understand that, thank you

Laex commented 6 years ago

In the OpenCV documentation, the cvGetWindowHandle function is defined as void cvGetWindowHandle (const char name) (https://docs.opencv.org/3.3.0/d0/d28/group__highgui__c.html#gac5a54cd8b8ce9c58273904eaacfe831d)

Then there were two ways

  1. Fix for convenience on HANDLE and then add a link to WinApi.Windows and in the future to lose compatibility with other platforms
  2. Follow the OpenCV documentation

While I adhere to the documentation

HuguesDug commented 6 years ago

What about using a compiler directive so that if "windows target" it returns an appropriate windows type ? It would not hurt the futur nor break compatibility.