I'd appreciate some help with a subclassing query. I've got a very
simple dialog with 20 edit boxes which I have subclassed in order
to capture keyboard entries such as cursor down and return to
move to the next edit control. I've done this with the following
code:
For N&=1 To 20
Control Add TextBox, hDlg, N&, "", 150*DU#, (N&*17+3)*DU#, 25*8*DU#, 16*DU#
Control Add Label, hDlg, N&+100, Str$(N&), 110*DU#, (N&*17+3)*DU#, 4*8*DU#, 16*DU#
Control Handle hDlg, N& To TmpFldHandle&
EditControlOrigProc = SetWindowLong(TmpFldHandle&,%GWL_WNDPROC,CodePtr(CursorControl))
Next N&
This works great and my Function CursorControl does the job perfectly.
My problem is that I have added a listbox and tried to subclass that
as follows:
N&=21
Control Add ListBox, hDlg, N&, Items(), 150*DU#, (N&*17+3)*DU#, 25*8*DU#, 40
Control Handle hDlg, N& To TmpFldHandle&
EditControlOrigProc = SetWindowLong(TmpFldHandle&,%GWL_WNDPROC,CodePtr(CursorControl))
This crashes Windows nicely every time! Can anybody point out to
me where I am going so hideously wrong. All the posts I have read
on subclassing only deal with single controls on a dialog.
Cheers, Nick
------------------
simple dialog with 20 edit boxes which I have subclassed in order
to capture keyboard entries such as cursor down and return to
move to the next edit control. I've done this with the following
code:
For N&=1 To 20
Control Add TextBox, hDlg, N&, "", 150*DU#, (N&*17+3)*DU#, 25*8*DU#, 16*DU#
Control Add Label, hDlg, N&+100, Str$(N&), 110*DU#, (N&*17+3)*DU#, 4*8*DU#, 16*DU#
Control Handle hDlg, N& To TmpFldHandle&
EditControlOrigProc = SetWindowLong(TmpFldHandle&,%GWL_WNDPROC,CodePtr(CursorControl))
Next N&
This works great and my Function CursorControl does the job perfectly.
My problem is that I have added a listbox and tried to subclass that
as follows:
N&=21
Control Add ListBox, hDlg, N&, Items(), 150*DU#, (N&*17+3)*DU#, 25*8*DU#, 40
Control Handle hDlg, N& To TmpFldHandle&
EditControlOrigProc = SetWindowLong(TmpFldHandle&,%GWL_WNDPROC,CodePtr(CursorControl))
This crashes Windows nicely every time! Can anybody point out to
me where I am going so hideously wrong. All the posts I have read
on subclassing only deal with single controls on a dialog.
Cheers, Nick
------------------
Comment