Problem with DTN_DATETIMECHANGE function for DateTimePicker

Started by Jean-Pierre LEROY, April 04, 2005, 06:07:58 AM

Previous topic - Next topic

Jean-Pierre LEROY

Hi,

I've got a PowerBASIC compiler error, when I try to compile my FF project; the error is in a DTN_DATETIMECHANGE function for a DateTimePicker Control.

PowerBasic Compiler returned an error during compiling, Error Number = 414; I can't see what is wrong !

FUNCTION FORM1_DATEACTUELLE_DTN_DATETIMECHANGE ( _
                                              ControlIndex  AS LONG,           _  ' index in Control Array
                                              hWndForm      AS DWORD,          _  ' handle of Form
                                              hWndControl   AS DWORD,          _  ' handle of Control
                                              pNMHDR        AS NMHDR PTR       _  ' pointer to NMHDR structure
                                              ) AS LONG

END FUNCTION

Has anyone else got this problem ?

Jean-Pierre

TechSupport

The problem is that you are using the new PB compilers and they do not allow pointers to be passed by reference. They must be passed ByVal. You need to modify the declaration:

ByVal pNMHDR AS NMHDR PTR _ ' pointer to NMHDR structure

I have already fixed this for the next version of FireFly.

Jean-Pierre LEROY

Ok Paul, I've just try with "BY VAL" keyword and it's Ok.

Thank you very much for your help.
Jean-Pierre

Haakon Birkeland

QuoteThey must be passed ByVal.
For some unknown reason I've caught the change of reference made in 8.x, but when I looked in the help-file last time, I couldn't find any anything there. Have anyone seen any elaborative text on the subject there?

TechSupport

If I remember correctly, in previous versions of PB they have indicated that pointers *should* be passed ByVal. In the latest compiler they decided to strictly enforce it. I assume that in the past that the compiler simply treated parameters without the ByVal keyword as being ByVal regardless.

Roger Garstang

Yeah, I think it is kinda dumb the way they did it too.  I think it only should have an error if you explicitly try to uses it as any other type of parameter and keep the old way of assuming ByVal.