# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1048886347 0 # Node ID 464b5e46b313bb48d9c4d641b36d7d9185f66b45 # Parent 7c1770e3fe08371637fc9c01128113739b4385dd Create the bitmap button even if the bitmap file does not exist. diff -r 7c1770e3fe08 -r 464b5e46b313 win/dw.c --- a/win/dw.c Thu Mar 27 11:14:25 2003 +0000 +++ b/win/dw.c Fri Mar 28 21:19:07 2003 +0000 @@ -4222,7 +4222,7 @@ { HWND tmp; BubbleButton *bubble; - HBITMAP hbitmap; + HBITMAP hbitmap = 0; char *file = malloc(strlen(filename) + 5); if(!file || !(bubble = calloc(1, sizeof(BubbleButton)))) @@ -4232,23 +4232,6 @@ return 0; } - strcpy(file, filename); - - /* check if we can read from this file (it exists and read permission) */ - if(access(file, 04) != 0) - { - /* Try with .bmp extention */ - strcat(file, ".bmp"); - if(access(file, 04) != 0) - { - free(bubble); - free(file); - return 0; - } - } - - hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); - tmp = CreateWindow(BUTTONCLASSNAME, "", WS_CHILD | BS_PUSHBUTTON | @@ -4267,9 +4250,24 @@ SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); - SendMessage(tmp, BM_SETIMAGE, - (WPARAM) IMAGE_BITMAP, - (LPARAM) hbitmap); + strcpy(file, filename); + + /* check if we can read from this file (it exists and read permission) */ + if(access(file, 04) == 0) + hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); + else + { + /* Try with .bmp extention */ + strcat(file, ".bmp"); + if(access(file, 04) == 0) + hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); + } + + + if(hbitmap) + SendMessage(tmp, BM_SETIMAGE, + (WPARAM) IMAGE_BITMAP, + (LPARAM) hbitmap); free(file); return tmp; }