Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MFC STATUS BAR PROBLEM ADDITIONAL Pin
#realJSOP5-Feb-07 23:13
mve#realJSOP5-Feb-07 23:13 
QuestionRe: MFC STATUS BAR PROBLEM ADDITIONAL [modified] Pin
T.RATHA KRISHNAN6-Feb-07 1:42
T.RATHA KRISHNAN6-Feb-07 1:42 
QuestionPlease help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy4-Feb-07 23:17
XTr1NiTy4-Feb-07 23:17 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
kasturi_haribabu4-Feb-07 23:44
kasturi_haribabu4-Feb-07 23:44 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
#realJSOP4-Feb-07 23:47
mve#realJSOP4-Feb-07 23:47 
GeneralRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy5-Feb-07 0:16
XTr1NiTy5-Feb-07 0:16 
QuestionRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) [modified] Pin
XTr1NiTy5-Feb-07 0:02
XTr1NiTy5-Feb-07 0:02 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
#realJSOP5-Feb-07 0:24
mve#realJSOP5-Feb-07 0:24 
1) Add a control variable for the listctrl. It will simplify further manipulation of the control, eliminating the need for code like this:

hList = (CListBox*)(GetDlgItem(IDC_LIST));


2) If you want to remove all items from the list control, use this (based on your apparent current code):

hList->DeleteAllItems();


3) There's no need to send a message to the listbox (see item #2 above).

4) Quite frankly, your naming conventions suck. Personally, I would never name a dialog box class something like "frmMenu". If you scan file names and you see frmmenu.cpp, wouldn't you assume that file contains some sort of menu code?

Is the message you're sending coming from outside the dialog box? If so, make a programmer-defined message and handle it that way:

// in a separate header file, like "CustomMessages.h"

#define UWM_DELETE_ALL_ITEMS WM_APP+1

// in the dlg header file
#include "CustomeMessages.h"
class frmMenu public
{
public:
afx_msg LRESULT OnDeleteAllItems(WPARAM wParam=0, LPARAM lParam=0);
};

// in the dlg cpp file
{MESSAGE_MAP
   ON_MESSAGE(UWM_DELETE_ALL_ITEMS, OnDeleteAllItems)
MESSAGE_MAP}

LRESULT frmMenu::OnDeleteAllItems(WPARAM wParam, LPARAM lParam)
{
    lParam;
    wParam;
    ((CListBox*)(GetDlgItem(IDC_LIST)))->DeleteAllItems();
    return 1L;
}


This was all done off the top of my head, so you may need to adjust the code to fit/compile, but this should do what you need.



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


QuestionRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy5-Feb-07 0:43
XTr1NiTy5-Feb-07 0:43 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
#realJSOP5-Feb-07 1:47
mve#realJSOP5-Feb-07 1:47 
QuestionRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy5-Feb-07 1:19
XTr1NiTy5-Feb-07 1:19 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
#realJSOP5-Feb-07 1:50
mve#realJSOP5-Feb-07 1:50 
GeneralRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy5-Feb-07 2:06
XTr1NiTy5-Feb-07 2:06 
GeneralRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
#realJSOP5-Feb-07 2:25
mve#realJSOP5-Feb-07 2:25 
JokeRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy5-Feb-07 2:47
XTr1NiTy5-Feb-07 2:47 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
David Crow5-Feb-07 3:09
David Crow5-Feb-07 3:09 
GeneralRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
XTr1NiTy5-Feb-07 3:36
XTr1NiTy5-Feb-07 3:36 
AnswerRe: Please help, SendMesssage not working in MFC Dialog Application, (with wizard) Pin
Michael Dunn5-Feb-07 10:01
sitebuilderMichael Dunn5-Feb-07 10:01 
Questionhide submenu item on selecting a menu item Pin
Sunshine Always4-Feb-07 23:06
Sunshine Always4-Feb-07 23:06 
AnswerRe: hide submenu item on selecting a menu item Pin
kasturi_haribabu4-Feb-07 23:15
kasturi_haribabu4-Feb-07 23:15 
GeneralRe: hide submenu item on selecting a menu item Pin
Sunshine Always4-Feb-07 23:41
Sunshine Always4-Feb-07 23:41 
AnswerRe: hide submenu item on selecting a menu item Pin
kasturi_haribabu5-Feb-07 0:15
kasturi_haribabu5-Feb-07 0:15 
GeneralRe: hide submenu item on selecting a menu item Pin
Sunshine Always5-Feb-07 0:45
Sunshine Always5-Feb-07 0:45 
GeneralRe: hide submenu item on selecting a menu item Pin
Hamid_RT5-Feb-07 7:35
Hamid_RT5-Feb-07 7:35 
AnswerRe: hide submenu item on selecting a menu item Pin
ThatsAlok6-Feb-07 20:12
ThatsAlok6-Feb-07 20:12 

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.