Re: WinClass Question for Al (part 2)
- Posted by don cole <doncole at pacbell.net> Dec 22, 2005
- 517 views
Sorry I took so long Al, I had things to attend to. Al Getz wrote: > > Hi again Don, > > > I looked at your new program and it looks a lot better :) It ran > fine this time, and i was able to try a few things out. Here's > a short list of a few things i found that improves the picture handling > and makes sure all pictures are unregistered before the viewer exits. > (Note if one picture is not unregistered then it wont be possible to > delete that pic from Win Explorer unless you first log off/log back on). > > 1. Fix that makes sure all pictures are unregistered before the > viewer exits... > > Within the onChar routine: > > elsif char=27 then --escape key > QuitApp() > --(and rem out the four function calls to close windows) > > This changes allows WinMain to return properly so the short section > of code that unregisters the last pic viewed and free's the GdiPlus > library runs as planned. This code must be run before the viewer > shuts down completely. QuitApp() simply calls PostQuitMessage(0). > This fixed the problem of not being able to delete picture with a 2nd party program. > 2. I noticed that when we scroll a pic to the right, left, up or down, > if there are only two pics in the directory the viewer might move > to a different pic (the other one) instead of simply scrolling, so > changing the code for the arrow keys fixes this problem... > > Also within the onChar routine: > > elsif char=38 then --arrow up > VertScrollAmount=VertScrollAmount+VertScrollIncrement > retv=win:InvalidateRect(GetHandle(MainAppWindow),0,1) > > The only difference here is InvalidateRect replaces > --DirListIndex=DirListIndex-1 > --onClick_ButtonForward() > which was an old trick to get the window to repaint. > The new code will work even if there is only one pic left. > The above has to be changed for all four arrow keys too, which > each have their own way of changing the scroll amount but should > all now use InvalidateRect instead of the old way. I'm glad you showed me this I had a hard time figuring out how to repaint the window. I tried onPaint_MainAppWindow() and call_func to onPaint_MainAppWindow(). I finally settled for onClickButtonForward() which I was not happy with, but it worked. > 3. The example: > ?GdipDisposeImage(TargetDirName&newtemp) > --unregisters the picture so it can delete > was really just an example of unreg'ing the pic, but you probably dont > want the result to be printed to console so of course you can use: > > atom void > void=GdipDisposeImage(TargetDirName&newtemp) I changed this to rstv=GdipDisposeImage(TargetDirName&newtemp) because it was already declared. BTW what does rstv stand for? > or something like that if you wish. > > > BTW, that new 'Help' screen is very nice! The viewer really needed > something like that. I sometimes forget the proper key for a given > function myself and dont feel like looking up the text file he he. I'm glad you liked the help screen. I added the arrow keys which I don't think were in the version I send you. I made all the changes you suggested and everything seems to work fine. I plan on uploading to the archives soon. Thank you very much for all your help. Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.