sgergo
October 21st, 2008, 05:23 AM
Hello to all!
I am developing a small application and I am working on its GUI. It is a pump control application and it has several buttons (on/off, port change, direction etc.). For a nicer look I decided to implement some static controls with bitmaps just to show that the particular button is in which state. It is basically an empty static field where I would like to change the bitmap depending on the state of the button.
I couldn't find the solution, so now, I always create a new static control when the user pushes the button - and these controls probably end up lying on each other and allocating memory at every push. It's not nice. The code here:
#define ST_OP_ON CreateWindowEx(0, "static", "STOPON", WS_VISIBLE | WS_CHILD | SS_BITMAP, 200, 30, 100, 5, hwnd, (HMENU)OP_ST, hInst, NULL);
#define ST_OP_OFF CreateWindowEx(0, "static", "STOPOFF", WS_VISIBLE | WS_CHILD | SS_BITMAP, 200, 30, 100, 5, hwnd, (HMENU)OP_ST, hInst, NULL);
I'm looking for a solution how to change the bitmap on static controls OR how to kill child windows at runtime. All help would be highly appreciated.
Cheers, sg
I am developing a small application and I am working on its GUI. It is a pump control application and it has several buttons (on/off, port change, direction etc.). For a nicer look I decided to implement some static controls with bitmaps just to show that the particular button is in which state. It is basically an empty static field where I would like to change the bitmap depending on the state of the button.
I couldn't find the solution, so now, I always create a new static control when the user pushes the button - and these controls probably end up lying on each other and allocating memory at every push. It's not nice. The code here:
#define ST_OP_ON CreateWindowEx(0, "static", "STOPON", WS_VISIBLE | WS_CHILD | SS_BITMAP, 200, 30, 100, 5, hwnd, (HMENU)OP_ST, hInst, NULL);
#define ST_OP_OFF CreateWindowEx(0, "static", "STOPOFF", WS_VISIBLE | WS_CHILD | SS_BITMAP, 200, 30, 100, 5, hwnd, (HMENU)OP_ST, hInst, NULL);
I'm looking for a solution how to change the bitmap on static controls OR how to kill child windows at runtime. All help would be highly appreciated.
Cheers, sg