Recent

Author Topic: Any reason why some Comctl32 functions are commented out in func.inc ?  (Read 4271 times)

440bx

  • Hero Member
  • *****
  • Posts: 4014
Hello, 

A number of common control functions in func.inc are commented out.  They are not in CommCtrl (which is where they should be) nor in any other Windows (desktop) unit.

There are about 2 dozen common control functions commented out.

Is there a good reason I am missing for those functions to be commented out or, was it just an oversight ?
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

ASerge

  • Hero Member
  • *****
  • Posts: 2240
I think these function just got lost when ported to CommCtrl.
By the way, give an example.

Thaddy

  • Hero Member
  • *****
  • Posts: 14360
  • Sensorship about opinions does not belong here.
Yes, indeed: example(s).
Also compare to the jedi units. It may be a left over from the olden days where not everything had a straight translation or consisted of hard to read/translate C macro's.
msdn is your friend here, as is a peek in the C winapi headers to see if they are indeed macro's..
« Last Edit: April 05, 2019, 09:06:31 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

440bx

  • Hero Member
  • *****
  • Posts: 4014
I think these function just got lost when ported to CommCtrl.
By the way, give an example.
sure... here is one I ran into when with property sheets... from ascfun.inc
Code: Pascal  [Select][+][-]
  1. function EnumICMProfilesA(_para1:HDC; _para2:ICMENUMPROCA; _para3:LPARAM):longint; external 'gdi32' name 'EnumICMProfilesA';
  2. {
  3. function PropertySheetA(lppsph:LPCPROPSHEETHEADER):longint; external 'comctl32' name 'PropertySheetA';
  4. function ImageList_LoadImageA(hi:HINST; lpbmp:LPCSTR; cx:longint; cGrow:longint; crMask:COLORREF;uType:UINT; uFlags:UINT):HIMAGELIST; external 'comctl32' name 'ImageList_LoadImageA';
  5.  
  6. function CreateStatusWindowA(style:LONG; lpszText:LPCSTR; hwndParent:HWND; wID:UINT):HWND; external 'comctl32' name 'CreateStatusWindowA';
  7. procedure DrawStatusTextA(hDC:HDC; lprc:LPRECT; pszText:LPCSTR; uFlags:UINT); external 'comctl32' name 'DrawStatusTextA';
  8. function GetOpenFileNameA(_para1:LPOPENFILENAME):WINBOOL; external 'comdlg32' name 'GetOpenFileNameA';
  9. function GetSaveFileNameA(_para1:LPOPENFILENAME):WINBOOL; external 'comdlg32' name 'GetSaveFileNameA';
  10. function GetFileTitleA(_para1:LPCSTR; _para2:LPSTR; _para3:WORD):integer; external 'comdlg32' name 'GetFileTitleA';
  11. function ChooseColorA(_para1:LPCHOOSECOLOR):WINBOOL; external 'comdlg32' name 'ChooseColorA';
  12. function FindTextA(_para1:LPFINDREPLACE):HWND; external 'comdlg32' name 'FindTextA';
  13. function ReplaceTextA(_para1:LPFINDREPLACE):HWND; external 'comdlg32' name 'ReplaceTextA';
  14. function ChooseFontA(_para1:LPCHOOSEFONT):WINBOOL; external 'comdlg32' name 'ChooseFontA';
  15. function PrintDlgA(_para1:LPPRINTDLG):WINBOOL; external 'comdlg32' name 'PrintDlgA';
  16. function PageSetupDlgA(_para1:LPPAGESETUPDLG):WINBOOL; external 'comdlg32' name 'PageSetupDlgA';
  17. }
  18. function CreateProcessA(lpApplicationName:LPCSTR; lpCommandLine:LPSTR; lpProcessAttributes:LPSECURITY_ATTRIBUTES;
and from func.inc
Code: Pascal  [Select][+][-]
  1. function ColorMatchToTarget(_para1:HDC; _para2:HDC; _para3:DWORD):WINBOOL; external 'gdi32' name 'ColorMatchToTarget';
  2. {
  3. function CreatePropertySheetPageA(lppsp:LPCPROPSHEETPAGE):HPROPSHEETPAGE; external 'comctl32' name 'CreatePropertySheetPageA';
  4. function DestroyPropertySheetPage(hPSPage:HPROPSHEETPAGE):WINBOOL; external 'comctl32' name 'DestroyPropertySheetPage';
  5. procedure InitCommonControls; external 'comctl32' name 'InitCommonControls';
  6.  
  7. function ImageList_AddIcon(himl:HIMAGELIST; hicon:HICON):longint;
  8. function ImageList_Create(cx:longint; cy:longint; flags:UINT; cInitial:longint; cGrow:longint):HIMAGELIST; external 'comctl32' name 'ImageList_Create';
  9. function ImageList_Destroy(himl:HIMAGELIST):WINBOOL; external 'comctl32' name 'ImageList_Destroy';
  10. function ImageList_GetImageCount(himl:HIMAGELIST):longint; external 'comctl32' name 'ImageList_GetImageCount';
  11. function ImageList_Add(himl:HIMAGELIST; hbmImage:HBITMAP; hbmMask:HBITMAP):longint; external 'comctl32' name 'ImageList_Add';
  12. function ImageList_ReplaceIcon(himl:HIMAGELIST; i:longint; hicon:HICON):longint; external 'comctl32' name 'ImageList_ReplaceIcon';
  13. function ImageList_SetBkColor(himl:HIMAGELIST; clrBk:COLORREF):COLORREF; external 'comctl32' name 'ImageList_SetBkColor';
  14. function ImageList_GetBkColor(himl:HIMAGELIST):COLORREF; external 'comctl32' name 'ImageList_GetBkColor';
  15. function ImageList_SetOverlayImage(himl:HIMAGELIST; iImage:longint; iOverlay:longint):WINBOOL; external 'comctl32' name 'ImageList_SetOverlayImage';
  16. function ImageList_Draw(himl:HIMAGELIST; i:longint; hdcDst:HDC; x:longint; y:longint;fStyle:UINT):WINBOOL; external 'comctl32' name 'ImageList_Draw';
  17. function ImageList_Replace(himl:HIMAGELIST; i:longint; hbmImage:HBITMAP; hbmMask:HBITMAP):WINBOOL; external 'comctl32' name 'ImageList_Replace';
  18. function ImageList_AddMasked(himl:HIMAGELIST; hbmImage:HBITMAP; crMask:COLORREF):longint; external 'comctl32' name 'ImageList_AddMasked';
  19. function ImageList_DrawEx(himl:HIMAGELIST; i:longint; hdcDst:HDC; x:longint; y:longint;dx:longint; dy:longint; rgbBk:COLORREF; rgbFg:COLORREF; fStyle:UINT):WINBOOL; external 'comctl32' name 'ImageList_DrawEx';
  20. function ImageList_Remove(himl:HIMAGELIST; i:longint):WINBOOL; external 'comctl32' name 'ImageList_Remove';
  21. function ImageList_GetIcon(himl:HIMAGELIST; i:longint; flags:UINT):HICON; external 'comctl32' name 'ImageList_GetIcon';
  22. function ImageList_BeginDrag(himlTrack:HIMAGELIST; iTrack:longint; dxHotspot:longint; dyHotspot:longint):WINBOOL; external 'comctl32' name 'ImageList_BeginDrag';
  23. procedure ImageList_EndDrag; external 'comctl32' name 'ImageList_EndDrag';
  24. function ImageList_DragEnter(hwndLock:HWND; x:longint; y:longint):WINBOOL; external 'comctl32' name 'ImageList_DragEnter';
  25. function ImageList_DragLeave(hwndLock:HWND):WINBOOL; external 'comctl32' name 'ImageList_DragLeave';
  26. function ImageList_DragMove(x:longint; y:longint):WINBOOL; external 'comctl32' name 'ImageList_DragMove';
  27. function ImageList_SetDragCursorImage(himlDrag:HIMAGELIST; iDrag:longint; dxHotspot:longint; dyHotspot:longint):WINBOOL; external 'comctl32' name 'ImageList_SetDragCursorImage';
  28. function ImageList_DragShowNolock(fShow:WINBOOL):WINBOOL; external 'comctl32' name 'ImageList_DragShowNolock';
  29. function ImageList_GetDragImage(ppt:LPPOINT; pptHotspot:LPPOINT):HIMAGELIST; external 'comctl32' name 'ImageList_GetDragImage';
  30. function ImageList_GetIconSize(himl:HIMAGELIST; var cx:longint; var cy:longint):WINBOOL; external 'comctl32' name 'ImageList_GetIconSize';
  31. function ImageList_SetIconSize(himl:HIMAGELIST; cx:longint; cy:longint):WINBOOL; external 'comctl32' name 'ImageList_SetIconSize';
  32. function ImageList_GetImageInfo(himl:HIMAGELIST; i:longint; var pImageInfo:IMAGEINFO):WINBOOL; external 'comctl32' name 'ImageList_GetImageInfo';
  33. function ImageList_Merge(himl1:HIMAGELIST; i1:longint; himl2:HIMAGELIST; i2:longint; dx:longint;dy:longint):HIMAGELIST; external 'comctl32' name 'ImageList_Merge';
  34. function ImageList_SetImageCount(himl: HIMAGELIST; uNewCount: UINT): Integer; external 'comctl32.dll' name 'ImageList_SetImageCount';
  35.  
  36. function CreateToolbarEx(hwnd:HWND; ws:DWORD; wID:UINT; nBitmaps:longint; hBMInst:HINST;wBMID:UINT_PTR; lpButtons:LPCTBBUTTON; iNumButtons:longint; dxButton:longint; dyButton:longint;dxBitmap:longint;
  37.   dyBitmap:longint; uStructSize:UINT):HWND; external 'comctl32' name 'CreateToolbarEx';
  38. function CreateMappedBitmap(hInstance:HINST; idBitmap:longint; wFlags:UINT; lpColorMap:LPCOLORMAP; iNumMaps:longint):HBITMAP; external 'comctl32' name 'CreateMappedBitmap';
  39. procedure MenuHelp(uMsg:UINT; wParam:WPARAM; lParam:LPARAM; hMainMenu:HMENU; hInst:HINST;hwndStatus:HWND; var lpwIDs:UINT); external 'comctl32' name 'MenuHelp';
  40. function ShowHideMenuCtl(hWnd:HWND; uFlags:UINT; lpInfo:LPINT):WINBOOL; external 'comctl32' name 'ShowHideMenuCtl';
  41. procedure GetEffectiveClientRect(hWnd:HWND; lprc:LPRECT; lpInfo:LPINT); external 'comctl32' name 'GetEffectiveClientRect';
  42. function MakeDragList(hLB:HWND):WINBOOL; external 'comctl32' name 'MakeDragList';
  43. procedure DrawInsert(handParent:HWND; hLB:HWND; nItem:longint); external 'comctl32' name 'DrawInsert';
  44. function LBItemFromPt(hLB:HWND; pt:POINT; bAutoScroll:WINBOOL):longint; external 'comctl32' name 'LBItemFromPt';
  45. function CreateUpDownControl(dwStyle:DWORD; x:longint; y:longint; cx:longint; cy:longint;hParent:HWND; nID:longint; hInst:HINST; hBuddy:HWND; nUpper:longint;nLower:longint; nPos:longint):HWND; external 'comctl32' name 'CreateUpDownControl';
  46. }
  47.  
  48. function RegCloseKey(hKey:HKEY):LONG; external 'advapi32' name 'RegCloseKey';
  49. function RegSetKeySecurity(hKey:HKEY; SecurityInformation:SECURITY_INFORMATION; pSecurityDescriptor:PSECURITY_DESCRIPTOR):LONG; external 'advapi32'

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14360
  • Sensorship about opinions does not belong here.
These are often but not always macro's. Their signature significantly differs from the Delphi declarations (which I have open hence the speedy reaction). Can you look at the jedi stuff? I am pretty sure that they are declared there in a Delphi compatible fashion.
[edit] don't bother. They are in the JCL and that is not available to FPC.
They are declared correct in winuits-base commctrls, e.g:
Code: Pascal  [Select][+][-]
  1. // Macro 11
  2. Function ImageList_AddIcon(Himl:HIMAGELIST;hicon:HICON):cint;
  3.  
I am using 3.2.0 and trunk 3.3.1 from today. So there is no issue. They are declared elsewhere. Grep is not a science, it's an art?
It can be that one of the defines confuses the editor, though: these are rather dense there.
« Last Edit: April 05, 2019, 09:24:54 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

440bx

  • Hero Member
  • *****
  • Posts: 4014
They are declared correct in winuits-base commctrls, e.g:
I am using 3.2.0 and trunk 3.3.1 from today. So there is no issue. They are declared elsewhere. Grep is not a science, it's an art?
Nice to know the problem has been fixed in v3.2.0.  I use the stable release of the compiler, when the next stable release comes out, I'll use that one. 

grep, whether science or art, doesn't change what a compiler knows or doesn't know nor, is it used to upgrade from a stable release to a trunk release.  Enjoy grep.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

ASerge

  • Hero Member
  • *****
  • Posts: 2240
Nice to know the problem has been fixed in v3.2.0.  I use the stable release of the compiler, when the next stable release comes out, I'll use that one. 
In 3.0.4 ImageList_AddIcon (and CreateStatusWindowA) is also defined in CommCtrl. But CreatePropertySheetPageA - no. Maybe list is not migrated functions are not so great?

440bx

  • Hero Member
  • *****
  • Posts: 4014
In 3.0.4 ImageList_AddIcon (and CreateStatusWindowA) is also defined in CommCtrl. But CreatePropertySheetPageA - no. Maybe list is not migrated functions are not so great?
It's somewhat hard to determine what ends up being defined and not defined.  As you said, some functions do get defined in another file while others don't.

Who knows why some functions made it and others didn't.  What is sure is that when you're porting code and FPC says it doesn't know about some function then, I have to find out if it has been defined in another unit or not defined at all.  In some cases (actually often) the function is in one of the Jedi units but, Delphi 2 doesn't like those.

Between that and occasional definitions between Delphi and FPC that don't match, a considerable amount of time can be "invested" in smoothing out those rough edges.  oh well... that's life.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14360
  • Sensorship about opinions does not belong here.
Delphi 2? That's 23 years ago. (I still use it, though for small utils) Windows, Delphi and FPC have moved on.

Also note, more importantly, that D2 has no cardinal type (well, 31 bit instead of D4's full UINT32), so the winapi bindings for D2 are wrong all over the place.
« Last Edit: April 06, 2019, 10:45:11 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

440bx

  • Hero Member
  • *****
  • Posts: 4014
Delphi 2? That's 23 years ago. (I still use it, though for small utils) Windows, Delphi and FPC have moved on.
That's true but, many things didn't move in the right direction.  Delphi  2 generates better 32bit code than any other Delphi version and, it is the _only_ version of Delphi whose debug symbols are understood by softice (Borland Pascal/Delphi was really popular at one time, popular enough for the premier system debugger to support its debug format, those really were good old days.)

With Delphi 2, I have a compiler that generates very decent 32bit code and a system debugger a keystroke away.    There is nothing today that matches what was available 23 years ago.  That's a bit sad, software development has gone backwards except maybe for MS, their software is a heck of a lot better today than it was then (except in one very noticeable way when it come to their C compiler.)  Another thing that has _significantly_ gone backwards is text editing, it seems every text editor around has a Christmas tree complex, features galore but at the expense of what makes a text editor really good and a pleasure to use.

But, you're right, Delphi 2 is missing a few features I'd really like have but, all of them put together aren't worth losing the advantages it has.  I have a copy of Delphi 5, it's not even installed (that was a waste of money.) I have access to a Delphi 10 installation and I only use it to compare its behavior with FPC's, developing software with that thing is simply out of the question.  I haven't even bothered to download the free version they currently offer, I don't want it even for free.

For 64bit I've decided to use either FPC or MSVC (which is sometimes the only practical way of going about writing a particular piece of software.)

Anyway... I guess I'm getting old.... I have a good excuse, it happens to everybody... chuckle.


(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: Any reason why some Comctl32 functions are commented out in func.inc ?
« Reply #10 on: April 06, 2019, 05:15:59 pm »
Calls were duplicated between commctrl and windows.

Probably in the original '98-'99 headers they ended up in windows, but later delphis have them in commctrls.

Moreover the commctrl ones were the newer translated ones (2005?), so the windows were simply commented.

If there are calls missing, please report them.
« Last Edit: April 06, 2019, 05:29:31 pm by marcov »

440bx

  • Hero Member
  • *****
  • Posts: 4014
Re: Any reason why some Comctl32 functions are commented out in func.inc ?
« Reply #11 on: April 06, 2019, 05:23:30 pm »
If there are calls missing, please report them.
I'll do that. 
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018