The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: FlySky on January 08, 2011, 05:46:10 PM

Title: Listbox problem
Post by: FlySky on January 08, 2011, 05:46:10 PM
Hey guys,

Got this weird listbox problem.

Consider this WindowProc

WndProc Frame hWin, uMsg, wParam, lParam

   Cmp D[uMsg], WM_INITDIALOG
   Jne >
      Invoke GetDlgItem, [hWin], ID_LISTBOX_WINDOWS      ;Retrieve the handle to our listbox receiving windows
      Mov [ListBoxHandleWindows], Eax                      ;Store our listbox handle
      Invoke EnumWindows, Offset EnumWnd, NULL           ;Retrieve the active processes
   Invoke GetDlgItem, [hWin], ID_LISTBOX_SCANRESULT   ;Retrieve the handle to our listbox receiving scan result
   Mov [ListBoxHandleScanResult], Eax               ;Store listbox handle
:

      Cmp D[uMsg], WM_CLOSE
      Jne >
      Invoke ExitProcess, NULL

:

   Cmp D[uMsg], WM_COMMAND                       ;This message function checks if we pressed any buttons
   Jne > @end
   Cmp D[wParam], ID_SCAN_BUTTON                     ;Did we press the scan button?
   Jne > SelChanged

SelChanged:
   Mov Edx, [wParam]
   Shr Edx, 16
   Cmp Dx, LBN_SELCHANGE                  ;Did we change sells?
   Jne > StopSelChange
   Mov Eax, Edx          ---> THIS SPOT IS NEVER REACHED!! WEIRDO
   Jmp > @end
StopSelChange:
   Ret

@end:
   Xor Eax, Eax
   Ret

EndF

In the above code I have a simple dialogbox with an edit control and a listbox. When the DialogBox is created I am storing a handle to the listbox and add to the Listbox all current visible windows. Now I am trying to let the EditBox receive the string from the Listbox.
So when I change the Item in the listbox it would show the new item in the EditBox. The problem is it never detects if sells are changed. I stuck in the mov eax, edx just as a marker so I could set a breakpoint there. But it never breaks and EDX never reaches the value 1 after the shift right instruction. Is my listbox created wrong or what on earth could be the problem.
Thanks in advance.
Title: Re: Listbox problem
Post by: wjr on January 08, 2011, 06:09:37 PM
Perhaps a problem without style and a solution with style... the LBN_SELCHANGE notification code is sent only by a list box that has the LBS_NOTIFY style.
Title: Re: Listbox problem
Post by: dedndave on January 08, 2011, 10:25:34 PM
wow, Wayne - nice to see you visit us   :bg
Title: Re: Listbox problem
Post by: FlySky on January 09, 2011, 08:56:18 AM
It looks like it's a problem with Easy Code. On Easy Code resource builder I can see that the Notify tab is set to TRUE. But when compiling and opening the compiled resource script in reshacker LBS_NOTIFY is not enabled. Looks I have to use a .BAT file to get this compiled correctly.
Title: Re: Listbox problem
Post by: FlySky on January 09, 2011, 09:50:28 AM
Sorry for double post but I am not allowed to edit my earlier post.

The error was indeed LBS_NOTIFY. Somehow when using EasyCode IDE to create the dialogbox with the listbox and setting the listbox Notify attribute to TRUE it's not compiling with LBS_NOTIFY enabled.
I've done it manually by setting LBS_NOTIFY in the .rsrc file and than compiling using a build.bat and everything is working fine.