|
The underline will appeare only if you press the ALT key. Did you noticed that?
nave
|
|
|
|
|
using the ampersand is not called "hotkey" but "mnemonic". if you want to see the underscore, use the keyboard to open the menu (using the Alt key).
hotkey is what you ave when you press something like Ctrl+C
|
|
|
|
|
KellyR wrote: If I want the menu items to have little underlines underneath the letters which are used for the hotkeys (i.e. the way it actually looks in the VC++ resource editor), do I need to ownerdraw the menu? Or is there a simpler way to do it?
Mnemonic keys appear when you press the Alt key. Windows has a option to disable this behavior. It's not your fault it's how window's behaves if that option is on.
I forgot where the option is. Just press Alt key to see the mnemonics.
|
|
|
|
|
I'm aware that alt shows the underlines, but there are many programs in which it is not necessary to press alt (VC++, MS Excel, to name two). So I guess the short answer is yes, I do need to ownerdraw them. I was hoping there was just some simple option I could set somewhere to make it look right. Oh well. Thanks.
KR
|
|
|
|
|
KellyR wrote: I'm aware that alt shows the underlines, but there are many programs in which it is not necessary to press alt (VC++, MS Excel, to name two).
MS Excel and VC++ does not have a normal menu bar they are different class of controls called MsoCommandBar.
The normal behavior of a menu mnemonic depends on a global setting. There was a checkbox somewhere inside some propery page. I don't remember where exactly it is. I remember setting this option.
|
|
|
|
|
Oh I see, so I need to use a different class. Thanks!
KR
|
|
|
|
|
KellyR wrote: Oh I see, so I need to use a different class. Thanks!
. No. This class is not shared by Microsoft. This is their private class only used for their applications.
|
|
|
|
|
HI!
The code is below.
i had tried both the way.by using LVBKIMAGE and also used ImageList_AddIcon,but not getting fruitful result. can any guide me,please?
<br />
<br />
LVBKIMAGE IBBkImg;<br />
ZeroMemory(&IBBkImg,sizeof(LVBKIMAGE));<br />
IBBkImg.ulFlags=LVBKIF_STYLE_TILE;<br />
IBBkImg.pszImage=(LPWSTR)"C:\\ok.bmp";<br />
LvItem.iItem=0;
LvItem.iSubItem=0;
<br />
LvItem.pszText=w_UploadedFile;
SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);
Amit
|
|
|
|
|
|
i did it. i got reference from that but in WM_PAINT gives error,AND i also took reference from 2 more places then i put here.
amit
|
|
|
|
|
|
Three errors
1)
Error 2 error LNK2019: unresolved external symbol __imp__ImageList_Create@20 referenced in function "long __stdcall GlobaListProc(struct HWND__ *,unsigned int,unsigned int,long)" (?GlobaListProc@@YGJPAUHWND__@@IIJ@Z) DRMClient.obj
2)same as bove
3)Error 5 fatal error LNK1120: 2 unresolved externals D:\Projects\Debug\DRMClient.exe
|
|
|
|
|
Did you include Commctrl.lib/ Imgctl.lib
|
|
|
|
|
I have added it. Inspite of it gives the linking error is any there other matter?
Amit
|
|
|
|
|
Requires comctl32.lib library to be linked.
|
|
|
|
|
I have already used include.
#include <commctrl.h>
is it ok? if not then guide me for explicit linking with lib.
|
|
|
|
|
|
|
how can i resolve the bugs , for linking.
I need simple first, then i will try to add the file icon . but i need base first how can any images display icon/image from resource in the listview.
|
|
|
|
|
which view are you using in list view? Report, icon etc..?
nave
|
|
|
|
|
|
1.Create a image list with width and height 20, 20 or less
2.Add icons to the image list.
3. Send LVM_SETIMAGELIST to the image list with the wparam LVSIL_SMALL and LPARAM as handle of image list.
4. Then while inserting item with the LVM_INSERTITEM message, set the appropriate values in the LVITEM structure( mask and iImage )
nave
|
|
|
|
|
the code as per your guidline is below
<br />
<br />
memset(&LvCol,0,sizeof(LvCol));
HIMAGELIST hSmall;<br />
HICON hIcon;<br />
<br />
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), ILC_MASK, 1, 1);<br />
<br />
hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_QUESTION));<br />
ImageList_AddIcon(hSmall, hIcon);<br />
DestroyIcon(hIcon);<br />
<br />
ListView_SetImageList(hList, hSmall, LVSIL_SMALL);<br />
<br />
LvCol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;<br />
LvCol.iSubItem = 0;<br />
LvCol.pszText = _T("Flag");<br />
LvCol.cx = 50;<br />
LvCol.fmt = LVCFMT_RIGHT;<br />
LvCol.iImage =0;<br />
<br />
ListView_InsertColumn(hList, 0, &LvCol); <br />
LvCol.pszText=_T("File"); <br />
SendMessage(hList,LVM_INSERTCOLUMN,1,(LPARAM)&LvCol);<br />
LvCol.pszText=_T("Extension");
SendMessage(hList,LVM_INSERTCOLUMN,2,(LPARAM)&LvCol);
LvCol.pszText=_T("Location");
<br />
SendMessage(hList,LVM_INSERTCOLUMN,3,(LPARAM)&LvCol);
LvCol.pszText=_T("Size");
<br />
SendMessage(hList,LVM_INSERTCOLUMN,4,(LPARAM)&LvCol);
LvCol.pszText=_T("Duration");
<br />
SendMessage(hList,LVM_INSERTCOLUMN,5,(LPARAM)&LvCol);
LvCol.pszText=_T("Bit Rate");
<br />
SendMessage(hList,LVM_INSERTCOLUMN,6,(LPARAM)&LvCol);
LvCol.pszText=_T("Type"); <br />
SendMessage(hList,LVM_INSERTCOLUMN,7,(LPARAM)&LvCol);
LvCol.pszText=_T("Modified Date"); <br />
SendMessage(hList,LVM_INSERTCOLUMN,8,(LPARAM)&LvCol);
LvCol.pszText=_T("Progress"); <br />
SendMessage(hList,LVM_INSERTCOLUMN,9,(LPARAM)&LvCol);
LvCol.pszText=_T("Protected");<br />
SendMessage(hList,LVM_INSERTCOLUMN,10,(LPARAM)&LvCol);
memset(&LvItem,0,sizeof(LvItem));<br />
SendMessage(hList,LVM_INSERTCOLUMN,11,(LPARAM)&LvCol);
LvItem.mask=LVIF_TEXT;
LvItem.cchTextMax = 256;
ListView_SetItemState(hList,0,LVIS_SELECTED ,LVIF_STATE); <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Amit
|
|
|
|
|
your code have some problem..
amitmistry_petlad wrote: hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), ILC_MASK, 1, 1);
use ILC_COLOR32 along with ILC_MASK
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 1, 1);
amitmistry_petlad wrote: DestroyIcon(hIcon);
Should not call DestroyIcon for a resource icon.
Also show me how you called the ListView_InsertItem().
nave
|
|
|
|
|
I am using listview two times.
1) first when i read all the xml content and display it in the listview.(on WM_INITDIALOG)
for that all columns draw first time in this call back(i will manage it if first time image add
by the (2)). (this is when application open firstime)
(after opened application- new dialog contain combo and new call back - and listview HANDLE is global )
2) when I add any new item in the list view through open dialog.(when COMBO event selchange)
then the new values(files) add diretly in this when i used open dialog.(want to add image/icon here ). when dialog close.the listview saved and display by (1).(this is when running application).
//same for all sub items
<br />
LvItem.iItem=i; <br />
LvItem.iSubItem=0;
LvItem.pszText=(LPWSTR)w_UploadedFile;<br />
SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);
|
|
|
|
|