I'm having a lot of trouble with WM_PAINT. In the following, I have stripped the code to the essential parts that demonstrate my problem. Subroutine AnaStart creates a toolbar and some on-screen tool buttons, while AnaRefresh displays a geographical map.
NewAnaScreen = .true.
NewAnaScreen = .false.
iret = SetFocus(ghWndMain)
iret = EndPaint(hWnd,ps)
MainWndProc = 0
I would like to see the tool bar displayed first (more or less instantly), then the map being painted (this may take several seconds for a detailed map). What I always see is the map first, then the toolbar. In fact it's worse than that because the map gets painted twice before the toolbar appears. I have proved by debugging that AnaStart is called first every time, but AnaRefresh always runs twice before the product of AnaStart appears.
I'm very confused and would be very grateful for some insight.
With many thanks in advance,