[futurebasic] [Q] Resource Manager

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1998 : Group Archive : Group : All Groups

From: Mel Patrick <mel@...>
Date: Mon, 2 Mar 1998 15:08:57 -0800
I have been working on a project for the last few months. It has an
external resource file and to make sure that I don't get a collision, I
open the external resource file, use the toolbox USERESREF(filenumb) to
switch to it and then extract my resource using GET1RESOURCE (again from
the toolbox).

While this works 98% of time, I have a number of clients who crash at
exactly the same point each time. What works flawlessly here in the office
and for some flatly refuses to work for others. Or is hit and miss.

I've re-written my routines several different ways and mostly to no avail.
I was reading a muse from a fellow programmer this morning and it shed a
little light...and just maybe a logical reason.
------
"I've heard from six different users who tell me that Surf Express 1.1.1
causes my programs (Window Monkey, Helium and Holiday Lights) to fail to
work . Specifically, when opening the Window Monkey or Helium control
panels, or the Holiday Lights application, users see a message saying that
an "unexpected error occurred." With the help of one of these users, I have
narrowed down the exact line of code that fails in my programs. It's in the
resource-manager related toolbox call 'Get1IndResource.' In my case, it
looks like this: Get1IndResource ('MCmd', 1). What this does is try to load
the first 'MCmd' resource in the current resource file (which should be the
control panel or application file). With Surf Express installed, this
toolbox call fails and the resource is not loaded, which should never
happen; hence the "unexpected error" message. Either Surf Express is
changing the current resource file (very bad), or it installs a trap patch
that causes Get1IndResource to fail in certain (perhaps all) situations.
Get1IndResource is not a very commonly used resource manager call, but it's
used often enough that I can see how this bug could cause other problems.
For example, Navigator could fail to load the animated icon resources."
------
Myself, I am not using the Get1IndResource as the other author is, but I am
using a subset of it "GET1RESOURCE". I know that GETRESOURCE always works
so here's the question of day for those who know.

If you call USERESREF and then a GETRESOURCE, it should work exactly the
same as GET1RESOURCE? Or is there a risk of it falling down through the
open resource files and finding a match that is NOT in the external
resource file I am using? Or any way to tell?

Secondly, when you read in a resource from an external file, and then close
the external file, is the handle still valid in memory or does closing the
external file remove all references to anything it might have contained?
All my external resources are marked purgeable so maybe the memory manager
is doing what it's supposed to do when you close an external resource file.

Ultimately, the answer could be a system conflict with an extension or
control panel. But try telling that to a client. They are always quick to
point out, "Microsoft Word works"...;-)



Mel Patrick - theWabbitGuy - mel@...
mailto:mel@...
http://www.intergate.bc.ca/business/mel