Click here to Skip to main content
15,921,716 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help with memcpy ? Pin
Christian Graus22-Nov-05 16:31
protectorChristian Graus22-Nov-05 16:31 
Questioncreate ordinary window using menu Pin
stick_thai22-Nov-05 14:20
stick_thai22-Nov-05 14:20 
QuestionGDI+ PNG Transparency Pin
ClickHeRe22-Nov-05 13:50
ClickHeRe22-Nov-05 13:50 
AnswerRe: GDI+ PNG Transparency Pin
douglasjordan22-Nov-05 18:09
douglasjordan22-Nov-05 18:09 
Questionenable and disable menu item of a dialog box Pin
includeh1022-Nov-05 12:22
includeh1022-Nov-05 12:22 
AnswerRe: enable and disable menu item of a dialog box Pin
Cool Ju22-Nov-05 16:54
Cool Ju22-Nov-05 16:54 
GeneralRe: enable and disable menu item of a dialog box Pin
includeh1022-Nov-05 18:58
includeh1022-Nov-05 18:58 
AnswerRe: enable and disable menu item of a dialog box Pin
jhwurmbach23-Nov-05 2:54
jhwurmbach23-Nov-05 2:54 
I use a method where the parent of the dialog (e.g. a view) relays its WM_IDLEUPDATECMDUI to its dialogs, mimicking what CFrameWnd does.
The CDialog-derived child in turn handles WM_IDLEUPDATECMDUI and calls UpdateDialogControls, which looks for the UI-functions to be called.
The reference linked in the code snipped desrcibes the process for a status bar, but all commandUIs are equal - it does work for, say, buttons to enable and disable on staus change of another button.

The advantage of how this works is that you work with the MFC, not against it.

ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)<br />
...<br />
//called by Parent view (CTreeBrowserView) on WM_IDLEUPDATECMDUI<br />
//  thereby simulating the menu-update system via UPDATE_COMMAND_UI messages in a modeless dlg<br />
//  Reference: <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;123158" rel="nofollow">At Microsoft</a>[<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;123158" target="_blank" rel="nofollow" title="New Window">^</a>]<br />
LRESULT	CMethodPage::OnIdleUpdateCmdUI(WPARAM, LPARAM)<br />
{<br />
  UpdateDialogControls(this, false);	//send ON_UPDATE_COMMAND_UI for all controls of this dlg<br />
  return 0L;<br />
}<br />
//The Parent view does this:<br />
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)<br />
...<br />
LRESULT CTreeBrowserView::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam)<br />
{<br />
  if (m_pEditor == NULL)   /no editor open<br />
  {<br />
    return 0L;<br />
  }<br />
  else  //The editor is open<br />
  {<br />
    return m_pEditor->SendMessage(WM_IDLEUPDATECMDUI, wParam, lParam);<br />
  }<br />
}






"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."

-- Caius Petronius, Roman Consul, 66 A.D.


-- modified at 8:55 Wednesday 23rd November, 2005
QuestionBest way to set min size for a window? Pin
Ian Bowler22-Nov-05 8:10
Ian Bowler22-Nov-05 8:10 
AnswerRe: Best way to set min size for a window? Pin
David Crow22-Nov-05 9:04
David Crow22-Nov-05 9:04 
GeneralRe: Best way to set min size for a window? Pin
Ian Bowler22-Nov-05 10:57
Ian Bowler22-Nov-05 10:57 
QuestionSerialization and File | Save Pin
BuckBrown22-Nov-05 7:49
BuckBrown22-Nov-05 7:49 
AnswerRe: Serialization and File | Save Pin
David Crow22-Nov-05 7:53
David Crow22-Nov-05 7:53 
GeneralRe: Serialization and File | Save Pin
BlackDice23-Nov-05 11:20
BlackDice23-Nov-05 11:20 
GeneralRe: Serialization and File | Save Pin
David Crow25-Nov-05 14:03
David Crow25-Nov-05 14:03 
AnswerRe: Serialization and File | Save Pin
Cliff Hatch24-Nov-05 23:39
Cliff Hatch24-Nov-05 23:39 
QuestionWeb page segmentation Pin
llp00na22-Nov-05 7:20
llp00na22-Nov-05 7:20 
QuestionSHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 6:05
Alex Orovetskiy22-Nov-05 6:05 
AnswerRe: SHFileOperation problem Pin
Chris Losinger22-Nov-05 6:32
professionalChris Losinger22-Nov-05 6:32 
AnswerRe: SHFileOperation problem Pin
David Crow22-Nov-05 8:09
David Crow22-Nov-05 8:09 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 8:23
Alex Orovetskiy22-Nov-05 8:23 
GeneralRe: SHFileOperation problem Pin
Chris Losinger22-Nov-05 8:33
professionalChris Losinger22-Nov-05 8:33 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 9:03
Alex Orovetskiy22-Nov-05 9:03 
GeneralRe: SHFileOperation problem Pin
David Crow22-Nov-05 9:00
David Crow22-Nov-05 9:00 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 9:14
Alex Orovetskiy22-Nov-05 9:14 

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.