realbasic-nug
[Top] [All Lists]

System resources once again

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: System resources once again
From: Andrew Ellis <loopend at yahoo dot com>
Date: Sun, 30 Dec 2001 08:29:03 -0500
Thanks Christian for the tip (about app.resourcefork allowing access to
system resources as well. I wonder why it's not mentioned in the docs, or is
it?)

Anyway, it worked well except in one case:
 
rf=app.ResourceFork
rid=rf.resourceid("kcs4",2)
s=rf.Getresource("kcs4",rid)

This resource is actually the flag icon in the menu bar representing the
installed keyboard layout. If you try the code above, the icon in the menu
bar will get corrupted temporarily. Don't panic. Rebooting or simply opening
the Keyboard control panel will restore the icon. This by the way happens to
any other layout icon that shows in that menu, even if it's not the
currently active layout.
But wait, it can get worse. If you open the Keyboard control panel while
your app is still running, you'll get a bomb.

It might not sound like a big deal (it's just an icon after all), but to me,
it means that RB is not accessing the resources "read only" the same way
Resorcerer does, and it's obviously making that resource busy and
inaccessible to the system, or something like that.

Using #pragma disablebackgroundtasks to prevent the system from trying to
update the icon display while I'm accessing it didn't help. Probably the
system is immune to the pragma directive.

Any thoughts?

Note: For anyone who is wondering how, why and what good it does to access a
kcs icon resource which is not supported by RB (as far as I know, only
GetCicn, Getticl and gettics are available), well, after I getResource, I
can translate the hex data to pixels into a canvas and voila. I can also
write the data it to a new resource and call it ics4 then access it the
normal way.



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



<Prev in Thread] Current Thread [Next in Thread>