|
Ups !!! I think you'll have to remove them one by one looping through the CList, using GetCount and IsEmpty and RemoveTail, RemoveHead or RemoveAt.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
(edited ... I forgot how to read this morning ... )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
somebody help...
how to clear a list box? no straight method for it??
regards,
Rookie
|
|
|
|
|
Rookieee wrote:
how to clear a list box?
How about CListBox::ResetContent() , or SendMessage(..., LB_RESETCONTENT, ...)?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi
To clear a listbox you must call the following function
...
c_listBox.ResetContent();
...
Regards,
Pattyn Kurt
codito ergo sum
|
|
|
|
|
thanx to resetcontent and u guys
regards,
Rookie
|
|
|
|
|
i need to update a list view with DateTme..which is in FILETIME struct.How can i convert it to string ?
Thanks
|
|
|
|
|
Using FileTimeToSystemTime[^] you have a SYSTEMTIME var with all the info:
From msdn:[^]
<br />
FILETIME ftCreate, ftAccess, ftWrite;<br />
SYSTEMTIME stUTC, stLocal;<br />
LPTSTR lpszString;<br />
<br />
GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite)<br />
FileTimeToSystemTime(&ftWrite, &stUTC);<br />
wsprintf(lpszString, TEXT("%02d/%02d/%d %02d:%02d"),<br />
stLocal.wMonth, stLocal.wDay, stLocal.wYear,<br />
stLocal.wHour, stLocal.wMinute);<br />
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hello,
I've got a little problem... seams I do not have realy understand how CMenu work.
I'm creating menu by hand using such method :
<br />
BOOL menuTest = m_cMenu.CreateMenu();<br />
MENUITEMINFO menuItemInfo;<br />
menuItemInfo.cbSize = sizeof(MENUITEMINFO);<br />
menuItemInfo.fMask = MIIM_ID;<br />
<br />
menuTest = fileMenu.CreatePopupMenu();<br />
if ( menuTest == TRUE ) {<br />
LoadString(AfxGetInstanceHandle(), IDS_NOUVEAU, projectPrefix, MAX_PATH);<br />
fileMenu.AppendMenu(MF_STRING | MF_ENABLED, IDS_PROJECT_ID_BASE+IDS_NOUVEAU, projectPrefix);<br />
<br />
LoadString(AfxGetInstanceHandle(), IDS_OUVRIR, projectPrefix, MAX_PATH);<br />
fileMenu.AppendMenu(MF_STRING | MF_ENABLED, IDS_PROJECT_ID_BASE+IDS_OUVRIR, projectPrefix);<br />
<br />
...<br />
<br />
LoadString(AfxGetInstanceHandle(), IDS_FICHIER, projectPrefix, MAX_PATH);<br />
m_cMenu.AppendMenu(MF_POPUP, (UINT)fileMenu.m_hMenu, projectPrefix);<br />
<br />
menuItemInfo.wID = IDS_PROJECT_ID_BASE+IDS_FICHIER;<br />
menuTest = m_cMenu.SetMenuItemInfo( pos++, &menuItemInfo, TRUE );<br />
}<br />
<br />
...<br />
<br />
SetMenu(&m_cMenu);<br />
Doing this, menu is created with success. One problem is all element appear grayed.
So I've seen later, that added ON_COMMAND( IDS_PROJECT_ID+IDS_NOUVEAU, OnMyMenuCommand ) would active them.
So I've added a ON_COMMAND_EX_RANGE with range of menu id (I dislike this method...), but then ALL of my menu item are activated, whereas they have been create with MF_GRAYED or MF_DISABLED.
So, my question is, how to build menu ? and how to make them work normaly, responding to standard OnMenu... method ???
Tx by advance,
|
|
|
|
|
Hi again, it seems the problem just come from the display of the menu.
When I check for the menuItem state, it is well in the creation state...
do not understand
|
|
|
|
|
Hi
If I remember correctly, this is what happens:
- If there is no function linked to a menu item (using the ON_COMMAND macro) the item will be grayed. This is normal because no function could be executed anyway.
- If there is a function linked the item will appear enabled and the linked function would be called upon a click.
!! If you want the menu items to dynamicaly change the state from enabled to disabled (and vice versa) depending on the state the whole program is in, you need to implement the ON_UPDATE_COMMAND_UI macro and create a handler in the object that will handle the update.
class CFoo
{
...
afx_msg void OnUpdateMyMenuCommand(CCmdUI* pCmdUI);
};
// in the message map you must include
ON_UPDATE_COMMAND_UI(IDS_PROJECT_ID+IDS_NOUVEAU, OnUpdateMyMenuCommand)
CFoo::OnUpdateMyMenuCommand(CCmdUI* pCmdUI)
{
pCmdUI->Enable(ToolAvailable());
}
Hope this is helpfull
Regards,
Kurt Pattyn
codito ergo sum
|
|
|
|
|
this[^] will probably help you on your way...
and if you'd like to have more infos on menus (ans especially CMenu s, read Roger Allen's Menus for beginners[^].
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Tx guys !!!
I miss the line about ON_UPDATE_COMMAND_UI...
Tx for all, it works !!!
<br />
UINT state = m_cMenu.GetMenuState( pCmdUI->m_nID, MF_BYCOMMAND );<br />
state = (state & MF_DISABLED) | ( state & MF_GRAYED );<br />
pCmdUI->Enable( ! ( state > 0 ) );<br />
|
|
|
|
|
Does anybody have any idea or sample code for grabbing text from a window with class AfxWnd42s(shown by Spy++). This seems to be a customised window and the text seems to have been painted in the window screen. Normal methods of text grabbing like WM_GETTEXT, WM_COPY etc do not seem to work.
Any help will be much appreciated.
Thanks
|
|
|
|
|
Hi
Does anyone know how to get on of the buttons on a toolbar to flash ?
or the best way to go about it
Thanks
Si
|
|
|
|
|
You need to display bitmaps for a button alternately.
The following code changes the bitmap of one button.
TBBUTTONINFO bi;
memset(&bi,0,sizeof(TBBUTTONINFO));
bi.cbSize = sizeof TBBUTTONINFO;
bi.dwMask = TBIF_IMAGE;
bi.idCommand = ID_FILE_OPEN; // Command ID of the button.
bi.iImage = 4; // The index of the bitmap to display.
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID_FILE_OPEN,&bi);
Handle the OnTimer() for CMainFrame. In it, display the new bitmap, and the old one alternately. This will give flashing effect.
You can add more images to the toolbar using:
m_wndToolBar.GetToolBarCtrl().AddBitmap();
Of course this code is not perfect.
this is this.
|
|
|
|
|
i want a text in this format...
CString cstr;
cstr= "Value of X =";
int i=10;
cstr +=i \\ how do u add int here?
so the output should be "value of x=10"
regards,
Rookie
|
|
|
|
|
Hi,
You can use itoa function for that
CString s = "Value of x= ";
int val = 10;
char cVal[2];
itoa(val,cVal,10); //Third parameter in this is the base for the conversion, for decimal it is 10.
s += CString(cVal);
Hope it will work.
Ritu Kwatra
|
|
|
|
|
Hi,
the best way to do this is to use the Format member function of the CString object.
This function has the same formating param as the 'C' sprintf function.
code:
CString cstr;
int i = 10;
cstr.Format("Value of X=%d", i);
Hope this is what you want.
Regards,
Kurt Pattyn
codito ergo sum
|
|
|
|
|
i tired both the other ways it worked... but i actually wanted in this way.
cstr.Format("Value of X=%d", i);
and it worked .. thanks guys..GoodKarma
regards,
Rookie
|
|
|
|
|
CString cstr;
cstr= "Value of X =";
int i=10;
CString csIVal;
csIVal.Format("%d",i);
cstr += csIVal;
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
oooops, marc.. atlast i'm going by ur way.. no other go...
thanx , thanx
can we do like this any way?
CString msg;
msg="value of x=";
int num;
num=5;
Msg.Format(Msg,"%d", num);
output should be --> "value of x:5"
but its printing only --> "value of x"
regards,
Rookie
|
|
|
|
|
That's because you are not doing anything with msg.
Format takes the first parameter (format-control string) and replace each % formatte part with the other parameters. So if you write:
Msg.Format(Msg,"%d", num);
It'll write the Msg as it was before the call, because there isn't any format-control string as Msg doesn'thave any %. If it'd had any, it'd had replaced by "%d" and "num" values.
void Format( LPCTSTR lpszFormat, ... );[^]
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
hi
i want to write an application for the desktop sharing, any body can help me or any link or article will be appreciated
ddd
|
|
|
|
|
What do you mean between users, remote computers ???
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|