> Using a string list of alerts, I would first have to copy the text in
> memory with SysStringByIndex before calling FrmCustomAlert.
That's right, and you have to provide enough buffer space. Anyway, the memory 
is temporary allocated on the stack usually. So it does not bloat you PRC.

> Using string resources for each alert would mean calling DmGetResource and
> MemHandleLock/Unlock whenever I call FrmCustomAlert.
If you use SysStringByIndex, you don't need any locking; see below.

> In either case, aren't the savings in resource header memory compensated by
> additional code?
This is code (shortened, but should run) I use:

void ShowError(UInt16 index) {
  Char line[200];

  SysStringByIndex(stblIdError, index, line, sizeof line);
  if (line[0] == '\0') {
    /* just as a fallback for a wrong index */
    StrPrintF(line, "(Unknown error #%u)", index);
  }
  FrmCustomAlert(alertIdError, line, NULL, NULL);
}

You could even put the alertId in the first characters of the string and call 
FrmCustomAlert with an incremented pointer for more flexibility like 
different alert icons.

And you can't tell me that this routine is bigger than 100++ ressource headers 
and other entries for the different alert ressources... Simply evaluate with 
a real example, it's not so much work.

Just my EUR 0.02.
Bodo


-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to