Hi, José - I am pulling my hair out again with WinFBX.
I have a BitMapButton and when I click on it WndProc completes a task.
I then want the bmp to be killed and replaced with another. On clicking on the 'new' bmp WndProc completes a task. The task is the opposite to clicking on the previous bmp. We basically have a toggle.
This is what I have in the rc file.
Code: Select all
101 bitmap top.bmp
102 bitmap nottop.bmp
Code: Select all
#Define ID_Top 1103
...
...
Function WndProc( .................
Static As Boolean Topmost = True
...
...
Case ID_Top
IF GET_WM_COMMAND_CMD(wParam, lParam) = BN_CLICKED THEN
If IsTrue(Topmost) then
DestroyWindow(pWindow.ControlHandle(ID_Top))
pWindow.AddControl("BITMAPBUTTON", , ID_Top, "#102", 94, 0, 16, 16)
AfxRedrawWindow(pWindow.ControlHandle(ID_Top))
SetWindowPos hDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Topmost = False
Messagebox hDlg, "NotTop", "Cpaths", MB_Topmost ' Testing purposes only
Else
DestroyWindow(pWindow.ControlHandle(ID_Top))
pWindow.AddControl("BITMAPBUTTON", , ID_Top, "#101", 94, 0, 16, 16)
AfxRedrawWindow(pWindow.ControlHandle(ID_Top))
SetWindowPos hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Topmost = True
Messagebox hDlg, "Top", "Cpaths", MB_Topmost ' Testing purposes only
End If
End If
I have a feeling that DestroyWindow is not doing what I hoped it would.