flat assembler
Message board for the users of flat assembler.

Index > Windows > systray icon help

Author
Thread Post new topic Reply to topic
jch



Joined: 30 Apr 2008
Posts: 3
jch 30 Apr 2008, 23:04
Hello. This is my first post so please be gentle.

Im having a problem, and am using the systray code under examples as reference. What Ive done is created a 16x16 pixel bmp and want to have it show up in the system tray instead of the windo that shows up in the systray example.

Where Im getting confused, or where I think Im getting confused, is there is no reference to any bitmaps in that example or any resource section.. so where is that default graphic thats being displayed coming from? How would I display the graphic i made.. lets say its called myicon.bmp. Can someone please guide me in the right direction, thanks.

Oh and concerning graphics, do they have to be bmp or can I use graphic icons that are saved as png?
Post 30 Apr 2008, 23:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 01 May 2008, 05:01
The OS has a few predefined icons, perhaps the example is using one of those (you didn't say what example you are using so I can only guess).

And the OS only uses bitmaps for icons, you will need to convert other formats to bitmap before using.

You might like to see the fasmw sources for an example of how to use a custom bitmap.
Post 01 May 2008, 05:01
View user's profile Send private message Visit poster's website Reply with quote
jch



Joined: 30 Apr 2008
Posts: 3
jch 03 May 2008, 01:02
Actually, I DID say what example I was using. I said I was looking at the systray example, under the examples section of flatassembler.net.

Im using fasmw. my OS is Win32 XP. So, I see where its calling its own Icon, but there isnt any bitmap referenced anywhere in that example... which brings me back to my first post.

Again, I created a 16 pixel x 16 pixel bmp, lets say I called it myicon.bmp, how do I have that appear in system tray instead of what is being displayed in the system tray from that example of systray off the flatassembler.net examples link on the main page? How would I setup the bmp under resource section, and how would I invoke the bmp?
Post 03 May 2008, 01:02
View user's profile Send private message Reply with quote
Yardman



Joined: 12 Apr 2005
Posts: 244
Location: US
Yardman 03 May 2008, 02:29
[ Post removed by author. ]


Last edited by Yardman on 04 Apr 2012, 03:18; edited 1 time in total
Post 03 May 2008, 02:29
View user's profile Send private message Reply with quote
jch



Joined: 30 Apr 2008
Posts: 3
jch 07 May 2008, 01:34
@yardman

yah..................

your example like had nothing to do with what I was asking. I understand the "predefined" icons. so.... this:
---
invoke LoadIcon, NULL,IDI_QUESTION
---
was really a waste of posting on your part, as you just rehashed revolutions example by creating another "predefined" icon. and....

I already said in my previous posts (maybe you should reread), that I was already trying to setup a bmp, called myicon.bmp in the resource section, and was just wanting some friendly advice like maybe uhhhhhhh an actual example calling an actual user created icon.. if I wanted to see another predefined example i would have ask for one .... wouldnt I?

Hey, if i wanted to put an icon in the systray using c++ I know how to do that. If, I wanted to do it with delphi... guess what I know how to do that too. However, since Im new to the whole assembler thing, and yes Ive been reading various documents related to assembler, Id like some freakin slack and get off my back for just asking to see some non predefined icon examples.

When someone asks me for something.. I uh help them out, by using their example in code form... I guess every once in a while you come across people like you who are soo engrossed in their ego that they tend to forget what it was like starting out learning a new coding language.

Oh and... "A little more courtesy might be in order when
asking for help around here" .... are you fucking blind? I just reread my first post... how could I be more fucking courtest?

Oh and lets look at my second post... I used "I DID" .. why? because how many systray example are under the examples link off the main page.. really Im curious.. cause I only see one... and I made it very very clear what I was using and what I was trying to do but have zero luck and just wanted an example ... using myicon.bmp just to ummmm.... geee.. set me off on the correct path.... then omg, what happens next? some ego trippin whatever else person, posts a remark about being curtious, then turns around and posts another predefined icon WTF? Are you serious?

Fuck it, Ill ask around somewhere else... somewhere where there arent dickheads like you.. I mean Im sure, a place exists, unless the whole asm community are like you. Hey, prove me wrong? If there arent any helpful people (good samartians) in this community let me know, I only like being part of communities that actually help out beginners.

I not editing my post, if it causes a moderator to ban me then so be it, I dont think I would like it here anyways.. I mean maybe if I have years of asm experience and never had to ask any question and only submitted code.. I guess then just maybe I might of had a place here.

John.
Post 07 May 2008, 01:34
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 295
Alphonso 07 May 2008, 09:48
This works for me, although other ways may be better.

You'll have to convert your bitmap to an icon, myicon.bmp --> myicon.ico

Add a resource section at the end of systray example,
Code:
section '.rsrc' resource data readable

  directory RT_ICON,icons,\
            RT_GROUP_ICON,group_icons

  resource icons,\
           1,LANG_NEUTRAL,icon_data

  resource group_icons,\
           100,LANG_NEUTRAL,main_icon

  icon main_icon,icon_data,'myicon.ico'    
If your 'myicon.ico' file is not in the same directory as tray.asm then you'll need to add the path as well.

Next you will need to change the line
Code:
        invoke  LoadIcon, NULL,IDI_WINLOGO    
in tray.asm to
Code:
        invoke  LoadIcon,[hInstance],100    
where 100 is the icon group number. In this case we have only used one icon and one size (16x16?), if you want to add different sizes/bit depth of the same icon and let windows pick then something like
Code:
section '.rsrc' resource data readable

  directory RT_ICON,icons,\
            RT_GROUP_ICON,group_icons

  resource icons,\
           1,LANG_NEUTRAL,icon_01,\
           2,LANG_NEUTRAL,icon_02,\
           3,LANG_NEUTRAL,icon_03

  resource group_icons,\
           100,LANG_NEUTRAL,main_icon

  icon main_icon,icon_01,'MyIcon16.ico',\   ;16x16
                 icon_02,'MyIcon32.ico',\   ;32x32
                 icon_03,'MyIcon48.ico'     ;48x48    

To add a different icon add it under 'resource icons' 4,5,6... then create a new group under 'resource group_icons' 101,LANG_NEUTRAL,next_icon... and finally add the new file name(s) under the 'icon' macro. See 'Resources' in FASM.PDF for further details.
Post 07 May 2008, 09:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 07 May 2008, 10:13
jch wrote:

< ... snip rant ... >

John.
Oops, looks like we lost a goodun there. I should have spent 3 or 4 hours, taking time off from my job, preparing an example and posting it. But instead I stupidly though my little comment about taking a look-see at the fasmw sources would suffice, since it already uses a custom bitmap. My bad, I hope you will forgive us all jch.
Post 07 May 2008, 10:13
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.