RadASM 3.x - How do I add Icons to Project? (Solved)

Started by Shooter, December 05, 2010, 09:08:25 PM

Previous topic - Next topic

Shooter

#15
Quote from: donkey on December 06, 2010, 05:38:39 AM
The project you attached is the old one with moduleproc and gfl.txt in it.
Edgar,
Hmmm, that was odd. I used the Zip file function of RadASM to make that package... I guess if a .zip file already exists it doesn't prompt to replace and doesn't let you know. I created a new one from WinRAR (see attached).

I did just now figure out that it wasn't the project that was locking up my computer, but RadASM itself. RadASM compiles the project without a problem, but if you click 'Run' the CPU usage goes through the roof. However, if you launch the project's .exe from Explorer, all works as it should.  :dazzled:

Also, I've tweaked a little here and there and got that section of my project to work.  :bg

One more question... what are the units in RadASM's RC editor for the height and width of an bitmap area/loaded image? I loaded two images approx 395x395 into a 400x400 'image frame', but there's a huge 'border' (gap) between the image and the edge of the bitmap area. I toyed around with it and reduced the bitmap area to 275x275... there's a thin 'border' (I'd guess maybe 10 pixels... about 1/3 the width of a scroll bar) on the left/right edges, but the top/bottom borders are nearly 5 times the left/right's. (Btw, I modified my project to these sizes AFTER making the .zip file.)

Thanks again,
-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

fearless

ƒearless

donkey

Quote from: fearless on December 09, 2010, 05:58:00 PM
END start

Might need that?

Wrong assembler fearless, that's a MASM directive, its not necessary in GoAsm.

Shooter,

You didn't include the images in your zip.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

The images are larger than allowed. I converted them to 256 color and zipped the heck out of 'em.

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

The images seem to be displayed as expected. If you wish to have them always fit into the static you will have to subclass it and use StretchBlt to draw them.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

Edgar,
The part that doesn't make sense to me is I created the "Image" (control) and set it to just a few 'pixels??' larger than the bitmaps, but the gap between the bitmaps and the "Image" border were huge. That's why I asked what the 'units' RadASM uses to set the control... I assumed it was 'pixels'. Is that not the case? How much of a gap between the image and the border do you see?

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

Hi Shooter,

RadAsm's resource editors units are in pixels and are translated to Dialog Units when written to an RC file via the customary formula (Pix*4)/BaseUnits for X and (Pix*8)/BaseUnits for Y. I'm afraid I deleted the files (I just keep them long enough to take a look) but the example you sent was a very small image control and very large images. The only thing showing were the standard border and the partial images.

I re-downloaded the project and ran it:



Note that the border is a 3D-Look border if you want a smaller one use Flat or Sunken.



Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

Quote from: donkey on December 09, 2010, 08:42:06 PM
...translated to Dialog Units when written to an RC file via the customary formula (Pix*4)/BaseUnits for X and (Pix*8)/BaseUnits for Y.

Ahhhhhhh. That is INDEED a must to know. Thank you very much, and it fits, but I'm not sure I have a full grasp as to WHY the X vs. Y are so different, or even need to be 'translated' (calculated) like that, but cie la vie, non?

Btw, the "Image" was reset to a larger size in a latter version of the project than what I gave you, as was the entire dialog obviously.  :bg

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

Quote from: Shooter on December 09, 2010, 09:01:22 PM
Quote from: donkey on December 09, 2010, 08:42:06 PM
...translated to Dialog Units when written to an RC file via the customary formula (Pix*4)/BaseUnits for X and (Pix*8)/BaseUnits for Y.

Ahhhhhhh. That is INDEED a must to know. Thank you very much, and it fits, but I'm not sure I have a full grasp as to WHY the X vs. Y are so different, or even need to be 'translated' (calculated) like that, but cie la vie, non?

Btw, the "Image" was reset to a larger size in a latter version of the project than what I gave you, as was the entire dialog obviously.  :bg

-Shooter

Its actually a don't really need to know since it is exceedingly rare that you will ever need to directly edit an RC file. Dialog Units are the way they are because Windows needs to be able to proportionally adjust the size of a dialog based on the font that is being used and the DeviceCaps for the target DC. In a case like this size in pixels is pretty useless so the RC files use different units since they contain sizes are expected to adapt to different resolutions.

Note that this is not related to either GoAsm or RadAsm but is a requirement of Windows:

http://msdn.microsoft.com/en-us/library/ms645475%28VS.85%29.aspx

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

Edgar,
Anyway I could get a copy of your brain?  :wink It sure would save some frustrations.  :toothy

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

Ah, you wouldn't want my brain. I was lucky when I started in assembler many years ago to have Iczelion, Hiroshimator, NaN and many others help me out, just returning the favor.  :U
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

So, getting back to the practicality of it all... I'd have to make a call to identify what the base units are, then readjust the "Image" control to that size, or would I have to resize the bitmap to fit the control?

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

Quote from: Shooter on December 09, 2010, 09:45:48 PM
So, getting back to the practicality of it all... I'd have to make a call to identify what the base units are, then readjust the "Image" control to that size, or would I have to resize the bitmap to fit the control?

-Shooter

No, you never have to use base units, as I said it is not something that many people are required to know unless they are writing a resource editor. You can use MoveWindow or SetWindowPos to resize the window to fit your images. They are documented at MSDN:

MoveWindow
SetWindowPos

Either that or set the size in the RadAsm resource editor but be aware that the size in pixels it gives includes the border area. The fourth option is to resize the image to fit your window, you can do that with StretchBlt.

StretchBlt

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

This is an old example I wrote that covers how to read mp3 headers and tag information. It uses StretchBlt to fit the album art image to a static control. Its a pretty big application to show just the one feature and it uses GDI+ but you might find a few other things interesting as well...

Note that this was just a fairly quick example and its quite old so I won't be commenting on bugs or issues with it.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

Quote from: donkey on December 09, 2010, 10:40:11 PM
Note that this was just a fairly quick example and its quite old so I won't be commenting on bugs or issues with it.

Seems to have assembled and ran just fine for me. Thanks.

One thing that led me away from the Visual Studio was that I was trying to build an MP3 player for windows, but I could not get past VBR. The song played just fine if it was constant rate, but VBR songs would skip all over the place. I'm a part time DJ and wanted to design my own playing DJ Console to MY liking, but gave up because of this. Your example just reminded me of that little issue when I saw "IsVBR". I'm going to have to keep that in mind as I develop my skills.

Thank you,
-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.