PDA

View Full Version : Callback Error



gungadout
21-09-2010, 07:54
Hi Folks,

Attached is a callback error I've been getting.

I already have a multi-level menu display screen working well in the same program.

I pretty much copied and pasted the logic for this more general screen display, but something is amiss.

If anything obvious stands out, please let me know. I'm really after the concepts that can lead to the particular error that is appearing.

Once again, the logic presented is an extract of the relevant statements. It excludes the voluminous and specialised database interaction logic.

Thanks,

Peter H. (gungadout)

gungadout
21-09-2010, 08:16
Oops.

The "Dim hDlgScreen As Long" in the attachment should have read "Dim hdlgCurrentScreen As Long".

I copied and pasted the wrong statement.

Sorry.

Michael Hartlef
21-09-2010, 09:07
Without having a system here to test on, I would guess that you should remove the CALL part out of the offending line. The documenation shows it but I never used it.

Petr Schreiber
21-09-2010, 09:46
Hi,

I think the reported error is correct. Your dialog callback is defined as classic function:


Function cbDialogScreen()
...
End Function


but it should be callback function:


Callback Function cbDialogScreen()
...
End Function


You may wonder why... The reason is that callback functions have special handling, which allows preallocation and filling of CBHNDL, CBCTL and other CB* stuff to them.


Petr

ErosOlmi
21-09-2010, 10:24
Exactly Petr.

Callback functions are special functions because (as Petr stated) during execution of a Callback Windows message pump variables (meta variables CB*) are create and destroyed on the fly. Also special internal structures are allocated in order to manage that variable values.

The value of CB* variables are taken directly from Windows message handling process.

Ciao
Eros

gungadout
23-09-2010, 01:17
Thanks, Folks.

That solved the problem.

That instruction must have been one of those that I coded from scratch, not one of those that I copied and changed.

Regards,

Peter H. (gungadout)