Click here to Skip to main content
15,899,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DDX_Text(..) not getting generated by MFC?? Pin
aparnakishore7-Feb-06 18:38
aparnakishore7-Feb-06 18:38 
AnswerRe: DDX_Text(..) not getting generated by MFC?? Pin
aparnakishore7-Feb-06 19:07
aparnakishore7-Feb-06 19:07 
Questionchild windows (destroying controls in main window) Pin
nedimbakic6-Feb-06 19:33
nedimbakic6-Feb-06 19:33 
AnswerRe: child windows (destroying controls in main window) Pin
nedimbakic6-Feb-06 19:36
nedimbakic6-Feb-06 19:36 
AnswerRe: child windows (destroying controls in main window) Pin
Owner drawn6-Feb-06 19:42
Owner drawn6-Feb-06 19:42 
GeneralRe: child windows (destroying controls in main window) Pin
nedimbakic7-Feb-06 1:53
nedimbakic7-Feb-06 1:53 
GeneralRe: child windows (destroying controls in main window) Pin
Owner drawn7-Feb-06 16:44
Owner drawn7-Feb-06 16:44 
GeneralRe: child windows (destroying controls in main window) Pin
nedimbakic7-Feb-06 17:13
nedimbakic7-Feb-06 17:13 
Owner drawn wrote:
If you want to destroy the button you have to get the handle of the button and then pass this handle to DestroyWindow to get it destroyed.


Yes, and that is what I do. My button's handle is hBtn1 which I use with DestroyWindow function as DestroyWindow(hBtn1), but nothing happens. Once created, button just sits in its place and I cannot destroy it untill I destroy the main window where it sits.

If I am not making this clear, maybe some code will explain. So here is how I create that button:
case WM_LBUTTONDOWN:
{
hBtn1 = CreateWindow("BUTTON","Picture 1", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,50,320,70,20,hWindow,(HMENU) 2, hInstGlobal, NULL);

......}

case WM_RBUTTONDOWN:
{
DestroyWindow(hBtn1);
......... }

And that is what I want. On left mouse click I want to create this button in the main window, and on right mouse click I want to get rid of it for good, don't need it any more!

Any ideas why this would not work? Why can't I just call DestroyWindow(hBtn1) and destroy this button?

Thanks! By the way, thanks for working on it Owner Drawn!


-- modified at 23:13 Tuesday 7th February, 2006
GeneralRe: child windows (destroying controls in main window) Pin
Owner drawn7-Feb-06 17:16
Owner drawn7-Feb-06 17:16 
GeneralRe: child windows (destroying controls in main window) Pin
nedimbakic8-Feb-06 1:39
nedimbakic8-Feb-06 1:39 
QuestionHow too export MDI project FORMview contents to Powerpoint. Pin
star966-Feb-06 19:15
star966-Feb-06 19:15 
QuestionShowing file in edit control Pin
swaapu6-Feb-06 19:06
swaapu6-Feb-06 19:06 
AnswerRe: Showing file in edit control Pin
khan++6-Feb-06 19:44
khan++6-Feb-06 19:44 
GeneralRe: Showing file in edit control Pin
toxcct6-Feb-06 21:19
toxcct6-Feb-06 21:19 
GeneralRe: Showing file in edit control Pin
khan++6-Feb-06 21:31
khan++6-Feb-06 21:31 
GeneralRe: Showing file in edit control Pin
toxcct6-Feb-06 21:33
toxcct6-Feb-06 21:33 
QuestionCurrent domain that the user is logged in into Pin
Chintoo7236-Feb-06 18:44
Chintoo7236-Feb-06 18:44 
AnswerRe: Current domain that the user is logged in into Pin
Blake Miller7-Feb-06 6:22
Blake Miller7-Feb-06 6:22 
QuestionMacros Pin
swaapu6-Feb-06 18:43
swaapu6-Feb-06 18:43 
AnswerRe: Macros Pin
Stephen Hewitt6-Feb-06 20:48
Stephen Hewitt6-Feb-06 20:48 
QuestionParsing Error with using Control Array Pin
BeakX6-Feb-06 18:33
BeakX6-Feb-06 18:33 
AnswerRe: Parsing Error with using Control Array Pin
khan++6-Feb-06 19:36
khan++6-Feb-06 19:36 
GeneralRe: Parsing Error with using Control Array Pin
BeakX6-Feb-06 23:08
BeakX6-Feb-06 23:08 
QuestionGraphs using MFC Pin
Anu_Bala6-Feb-06 18:11
Anu_Bala6-Feb-06 18:11 
AnswerRe: Graphs using MFC Pin
Cool Ju6-Feb-06 19:19
Cool Ju6-Feb-06 19:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.