Forum > Windows

activex.pp DosDateTimeToVariantTime definition problem

<< < (2/3) > >>

440bx:
I know all that. 

The header is incorrect. 

An int type isn't a two value type.


--- Quote from: PascalDragon on July 13, 2025, 07:08:25 pm ---Yes, that could be misinterpreted, but one is supposed to use MSDN when working with the Windows API anyway.

--- End quote ---
In general I completely agree with that _except_ when the stuff is wrong.  Having correct definition is more important than header files and/or msdn.

nanobit:
In Windows SDK, uppercase FALSE (0), TRUE (1) are integer-constants.

PascalDragon:

--- Quote from: 440bx on July 13, 2025, 08:11:01 pm ---The header is incorrect.
--- End quote ---

The header files are the official source for the Windows API, not a disassembly of the binary and its the official headers that the API translations are based on.

440bx:

--- Quote from: PascalDragon on July 15, 2025, 09:58:59 pm ---The header files are the official source for the Windows API, not a disassembly of the binary and its the official headers that the API translations are based on.

--- End quote ---
In that case Astronomers and Paleontologists should read the bible to get the "official" (not to mention _sacred_) information about Earth's place in the universe and the origin of the species.

Just for fun... here is another definition that, at least in Pascal, is incorrect:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function ListView_GetItemIndexRect(hwnd:hwnd; plvii:PLVITEMINDEX; iSubItem:clong; code:clong; prc:LPRECT) :BOOL; It's incorrect because it is a faithful ;) translation of the C macro.

The documentation defines the macro as:

--- Code: C  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---BOOL ListView_GetItemIndexRect(  [in]      HWND        hwnd,  [in]      LVITEMINDEX *plvii,  [in]      LONG        iSubItem,  [in]      LONG        code,  [in, out] LPRECT      prc); and states the following about the last parameter "prc"

--- Quote ---
[in, out] prc

Type: LPRECT

A pointer to a RECT structure to receive the coordinates. The caller is responsible for allocating this structure. prc must not be NULL.

--- End quote ---
Emphasis mine.  It "kinda" makes sense for the last parameter not to be NULL/nil given that the purpose of the macro/function is to retrieve the rectangle values (it would be "difficult" to get the rect if passing nil as the place to store it.)

The C definition is "correct" because C does not have the means to enforce the condition that the parameter must not be nil but, Pascal does.  The Pascal definition is incorrect, it should specify "var" for the last parameter.

Official, sacred... etc, don't make things right.

marcov:
Commctrls was semi automated translated with various bits of Pascal code back then.

Anyway, I fully agree with PascalDragon.

And in this particular case, while it might be semantically closer, it breaks 1:1 converting existing (example) code.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version