n00b needs help with api graphics acting very weird
This is my first post here.
I am currently working on writing an image/sprite editor for the win32 api. it is supposed to handle my own file format, and is actually a port of an intel x86asm program i wrote about a year ago.
I am quite new at windows programming, but all seemed to work fine and well (thanks to TheForger and Charles Petzold), until some time ago when i started to work with actually drawing the images, with the palette(it is mostly supposed to handle 256 colours, will add support for 24bit colour later, though.)
in one mdichild, and the frames in others.
At first glance the image/palette output routine seemed to work ok, but sooner or later it gets all FUBAR and you have to close the program. this was were frustrating, and i tried all kinds of ways to solve the problem. anyway, now i am posting on these message boards, hoping that some kind soul with a better knowledge of the workings of the windows api might have a clue of what i am doing wrong.
here is a picture of the the very basic interface atm, before:
http://trotskij.mine.nu/after.jpg (more or less, differs a bit.)
here is a zip with a stripped down version of the program (mostly just the gui-stuff, most other headers arent included, those who handles the pictures, mem management etc) that prints a random palette and a static picture (some rectangles) in mdichildren.
using this you can recreate the problem.
(just choose colours in the palette, minimize the windows, move them, minimize the program, you cant really do much, as i stripped most of the things that do stuff.)
sooner or later it will crash..
i have no idea what is causing the problem. probably i am using WM_PAINT wrong or something. as you can see most of the image output code is very ugly, i dont use custom devicecontexts or blitting or stuff.. mostly just rectangles, taking into account the zoomlevel and gridwidth, if any. the routines are far from complete, but it is very hard to work on them when it continously crashes.
i would be *very* grateful for any ideas on how i could write it better.
i run winXP on a 400mhz celeron, 256MB ram.