The thing I want to achive is having, lets say, 10 picture boxes displayed on a panel. When I click on one picture box, the image will change so... If I create a for-loop that creates the boxes and initializes the position of the boxes, how do I manage the click event for each box?
I know that I can drag them out in design mode and then just click on each picture box to get code for it but lets say that i should have 100 boxes.... There must be a easy solution to this knowledge problem of mine.
What framework are you using?
Some have methods to do this (ie .NET's Control.GetChildAtPoint() or MFC's ON_COMMAND_RANGE() )
In pure WIN32 I would process the main window/dialogs click events (WM_LBUTTONDOWN, etc).
Create a loop that checks if the point clicked is within each pictureboxes client area (look at GetClientRect(), PtInRect() ), processing as required.
Make sure to return the correct value or call the default handler if required (ie don't interfer with any clicks that are not in the pictureboxes).
Also check if the mouse click point is in client or screen coods (eg ScreenToCLient() may be required).
Not certain if this will help, but I'd do it quick n' dirty. Make your picture window an owner drawn button, with each click have it updated to whatever picture you have sequenced (load_from_file: picture001, picture002, et cetera). I'm working off the premise that you're using pure win32 & images are of the same size.