Can not use resources with _ (Underscore)
Posted: Wed May 09, 2007 9:50 am
Hello,
We have a very interesting problem with Microsoft Compatibe DLL files build from resources. If we compile the resource file with Borland, the problem goes away.
If we use a _ (underscore) in a resource name, and there is another resource name that begins with the same letter as the one with the _ in it, the app crashes if the resource name is a dialog or does not show the bitmap if the resource is a bitmap.
We found out that this is because the app can not find the resource name without the _ in it if there is a resource that starts with the same letter.
For example:
This does NOT work:
IN_DBFYES
INSERT -> Starts with IN
This works:
IN_DBFYES
NOINSERT -> Works because this resource name does NOT start with IN
This is the source for a reduced sample:
PRG:
RC:
To download the source to build this test app, please download
http://s194970364.onlinehome.us/Test_resource.zip
We are puzzled why this works with a Borland compiled DL, and NOT with a Microsoft build DLL.
Can someone confirm, or even better, is there a solution or bugfix for this?
Thanks!
Patrick Mast
We have a very interesting problem with Microsoft Compatibe DLL files build from resources. If we compile the resource file with Borland, the problem goes away.
If we use a _ (underscore) in a resource name, and there is another resource name that begins with the same letter as the one with the _ in it, the app crashes if the resource name is a dialog or does not show the bitmap if the resource is a bitmap.
We found out that this is because the app can not find the resource name without the _ in it if there is a resource that starts with the same letter.
For example:
This does NOT work:
IN_DBFYES
INSERT -> Starts with IN
This works:
IN_DBFYES
NOINSERT -> Works because this resource name does NOT start with IN
This is the source for a reduced sample:
PRG:
Code: Select all
#include "FiveWin.ch"
Function Test_Resource()
LOCAL oDlg, oBmp
SET RESOURCES TO "Test.dll"
DEFINE DIALOG oDlg TITLE "Dll problem" FROM 0,0 TO 200,500 PIXEL
@ 10,10 IMAGE oBmp RESOURCE "INSERT" SIZE 20, 20 PIXEL OF oDlg
@ 10,40 IMAGE oBmp RESOURCE "CHANGE" SIZE 20, 20 PIXEL OF oDlg
@ 10,70 IMAGE oBmp RESOURCE "IN_DBFNO" SIZE 20, 20 PIXEL OF oDlg
@ 10,100 IMAGE oBmp RESOURCE "IN_DBFYES" SIZE 20, 20 PIXEL OF oDlg
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
Code: Select all
IN_DBFYES BITMAP "BITMAPS\\IN_DBF_YES.BMP"
IN_DBFNO BITMAP "BITMAPS\\IN_DBF_NO.BMP"
INSERT BITMAP "BITMAPS\\INSERT.BMP"
CHANGE BITMAP "BITMAPS\\CHANGE.BMP"
http://s194970364.onlinehome.us/Test_resource.zip
We are puzzled why this works with a Borland compiled DL, and NOT with a Microsoft build DLL.
Can someone confirm, or even better, is there a solution or bugfix for this?
Thanks!
Patrick Mast