C - Win32 problem writing in ListBox
I have a generic WndProc() func running and I have a Dialog Box with a ListBox in it.
I enter a Menu Item to open the Dialog Box and enter a specific function I created to fill the ListBox
The problem i'm facing, is the fact that while I have the Dialog Box opened, it keeps revisiting the WndProc() function and coming back to the FillListBox() in an infinit cycle, causing it to fill the ListBox numerous times.
BOOL CALLBACK FillListBox(HWND hWnd, UINT messg, WPARAM wParam, LPARAM lParam);
Is there a better way to treat the ListBox in the Dialog Box, or a way to only enter the FillListBox() function once?
Thanks in advance,
P.S. I tried creating a modal and non-modal Dialog Box and it still cycles.