News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Project: BMP to CUR converter

Started by NoCforMe, February 08, 2022, 04:23:25 PM

Previous topic - Next topic

jj2007


NoCforMe

Quote from: Vortex on February 14, 2022, 05:32:37 AM
Hi NoCforMe,

Impressive work. :thumbsup:
Ah, if you only knew how many blunders and stupid mistakes I made writing that ...
I did learn a lot, though, which to me is the whole point of the exercise.
Assembly language programming should be fun. That's why I do it.

NoCforMe

#17
Well, I have to post an update here because guess what? there were some bugs in that previous version. No, you say, how could that be, what with your extremely rigorous testing procedures? Well, they slipped through. For one thing, if you tested a cursor it was displayed upside-down. (See below for explanation of that.)

This version fixes that problem, plus it handles saving the cursor more reasonably (if you load a cursor and edit it, it doesn't ask you for the filename again unless you choose "Save as"), plus it checks for unsaved work and asks you if you really want to exit or load a new file.

It's a little more complex, as I added a resource file, plus there are two bitmaps and a cursor to load. There's a "makefile" (a batch file) to stitch everything together.

Enjoy.

Oh, about those upside-down cursors: I learned something coding this, which is that there's a difference in the order of the bitmap masks between creating a cursor file and using CreateCursor() to make one within an application. The former wants the bitmaps to be "upside down", that is, going from the bottom up, while CreateCursor() expects the bitmaps to be "normal", i.e., top-down. I had to add a rather kluge-y routine to flip the bitmaps over when creating a cursor with CreateCursor(). This is mentioned nowhere in the MSDN documentation, by the way (surprise, surprise). I'm still wondering why they ever implemented those bass-ackwards bottom-up formats.

Another thing: there's something weird going on in my editor with cursors. Notice that if you open the app and move the cursor around, the custom cursor (a pen or pencil) turns into the standard arrow when you move it out of the editing window. But click on "Reset" and you'll see that now the cursor stays the same until you move over either the little "preview" window or the toolbar, at which point it reverts to the standard arrow. I cannot figure out why this happens. I'm using SetClassLong, hWin, GCLP_HCURSOR... to change the class cursor, which works, except for this one quirk. Anyone have a clue what's going on here?

Another very small point: I don't like the way the toolbar looks. I'm using "visual styles" which affect the appearance, but haven't been able to come up with a look that I like. I wish the text buttons in the toolbar looked like buttons instead of just text. Tried a bunch of combinations of styles and enabling or not enabling visual styles but nothing looked right.

Later, in another part of the forest: I found out why bitmaps were designed bottom-up. As always, the indispensible Raymond Chen has the explanation. It's because OS/2.
Assembly language programming should be fun. That's why I do it.

jj2007


NoCforMe

Thanks, JJ. And if someone doesn't like my custom cursor they can always design their own.
Assembly language programming should be fun. That's why I do it.

Vortex

Hi David,

Once again, nice work :thumbsup:

Don't worry about coding and testing. All of us , we are on the same boat, so all everything is OK.

NoCforMe

Quote from: Vortex on February 17, 2022, 03:26:51 AM
Hi David,

Once again, nice work :thumbsup:

Don't worry about coding and testing. All of us , we are on the same boat, so all everything is OK.

You mean you ... you make mistakes too?  :winking:

If anyone answer the two questions I had up above I'd be grateful. One about the cursor not getting reset, the other about making the toolbar look nicer.
Assembly language programming should be fun. That's why I do it.