|
All I can do is confirm that your code is correct and works for me - one other thing, though, the documentation for LVS_SINGLESEL states By default, multiple items may be selected, so you shouldn't need to do that anyway, unless you've explicitly selected "Single Selection" for the control in the dialog editor.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for your reply.If I select muiltiple items with "ctrl" button then I can able to do multiple selection. But for ListBox this is not the case. Previously I thought I
can do multiple selection without "ctrl" button as Listbox.Can I do that?
|
|
|
|
|
Oh, I see (I think) - you want to add to the selection whenever you click on an item? Nah, can't do that with a standard list control. However, I'm sure you could use the notifications that a list control sends (LVN_ITEMCHANGING, LVN_ITMECHANGED, NM_CLICK) to implement your selection logic.
e.g. here's some code handling notifications from a list control (list_). This inverts a particular item's selection when it's clicked on, not affecting any other control's selection state. canChangeSel_ is a bool member of the dialog, and is used to tell the LVN_ITEMCHANGING handler if it can allow selection changes or not.
void CaaaDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE itemActivate = (LPNMITEMACTIVATE)pNMHDR;
const int hit = list_.HitTest(LPNMITEMACTIVATE(pNMHDR)->ptAction);
if (hit != -1)
{
canChangeSel_ = true;
list_.SetItemState(hit, ~(list_.GetItemState(hit, LVIS_SELECTED)), LVIS_SELECTED);
canChangeSel_ = false;
}
}
void CaaaDlg::OnItemChangingList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pLV = LPNMLISTVIEW(pNMHDR);
*pResult = FALSE;
if ((pLV->uChanged&LVIF_STATE) && LVIS_SELECTED==((pLV->uNewState^pLV->uOldState)&LVIS_SELECTED))
*pResult = canChangeSel_?FALSE:TRUE;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hemlat wrote: But for ListBox this is not the case.
For a listbox, you must send it a LBS_MULTIPLESEL message.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I want to load multiple images in my progg. from sample database. So for ease i have saved my database serially. So in the given progg. i want str to b replaced by by 1.bmp, 2.bmp, 3.bmp and so on...but it is reading only str. Can you plzz tell how to do the same and what's the prob. in doing as i have done.
//Progg. for taking the names serially.
#include"stdio.h"
#include"string.h"
#include"conio.h"
#include"CImg.h"
using namespace cimg_library;
int main()
{
int i;
char str[10],string[10],fmt[]=".bmp";
for(i=1;i<=10;i++)
{
sprintf(str,"%d",i);
strcat(str,fmt);
CImg<double> image("C:/Users/Shree Hari/Desktop/trial/str");
CImgDisplay main_display(image,"Image",0);
//printf("\n\n%s\n",str);
}
getch();
return 0;
}
|
|
|
|
|
shyampasari wrote: but it is reading only str.
Well, obviously because you hard-coded it that way. If you want to concatenate the str variable to the string "C:/Users/Shree Hari/Desktop/trial/", you will need to call strcat:
char fullPath[MAX_PATH];
strcpy(fullPath,"C:/Users/Shree Hari/Desktop/trial/");
strcat(fullPath,str);
|
|
|
|
|
Thankkyou Cedric for your reply.
I have implemented what you have write.As follows but again ma progg run and a window popped with a mssg
CImg<double>::load():File 'path' cannot be opened.
Plzz reply!!!
//Progg. for taking the names serially.
#include"stdio.h"
#include"string.h"
#include"conio.h"
#include"CImg.h"
using namespace cimg_library;
int main()
{
int i;
char str[10],string[10],fmt[]=".bmp",path[]="C:/Users/Shree Hari/Desktop/trial/";
for(i=1;i<=10;i++)
{
sprintf(str,"%d",i);
strcat(str,fmt);
strcat(path,str);
CImg<double> image("path");
CImgDisplay main_display(image,"Image",0);
//printf("\n\n%s\n",str);
}
getch();
return 0;
}
|
|
|
|
|
Hum, I think you need some serious tutorial on string manipulation because it seems you don't understand at all what you are doing.
First:
shyampasari wrote: CImg<double> image("path");
Because of the quotes, you are passing a string litteral and not the path variable. Remove the quotes.
Second:
Each time in your loop you will concatenate a new string to the previous string (which already contains the full path). So, it will work for the first image but not for the second anymore. You could simplify everything by simply doing this:
char path[255];
for(i=1;i<=10;i++)
{
sprintf(path,"C:/Users/Shree Hari/Desktop/trial/%d.bmp",i);
....
|
|
|
|
|
How to set the checkbox in CListView to be disable for user to change?
But user can not only double click and click the item in CListView,but also can multiple select by shift and control.
|
|
|
|
|
Well, i don't know how you could change its appearance aside of drawing the items yourself but you can avoid the changing of the check state by handling the LVN_ITEMCHANGING[^] notification.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
hi all,
i have a folder named "test" which is installed in windows directory when my program gets installed.if windows installed in D then my folder path is D:\\test
can i have some example code, in which i can open this folder and write a file with admin privileges.
i want a code example to open the folder "test" in windows directory and write a file...
thanks...
|
|
|
|
|
|
Subrat Patnaik wrote: i have a folder named "test" which is installed in windows directory...
Which implies:
d:\windows\test
If you have d:\test instead, the test folder resides off the root of the Windows volume.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I'm trying to copy the used clusters of a hard disk partition(NTFS,windows os) to another partition.
I used the "FSCTL_GET_VOLUME_BITMAP" to get the cluster usage details.
And I'm getting the used and free cluster counts correctly.And the cluster number I got is continuous.
This makes problem for me. I wanna copy the used clusters to a different partition.
What type of cluster number I'm getting.? ; but the answer is correct.
It makes confusion to me.
Sometimes my question may be totally wrong.....
with regards Krish
modified on Friday, June 12, 2009 3:09 AM
|
|
|
|
|
how to realize scrolling text in a dialog,like the <maquee><\maquee> in html?I use double buffering to draw the text,and change the text position in Ontimer() function.However,I found the effect is not so good.I heard about that can use the Multi-threaded to realize it?How?Thanks!
|
|
|
|
|
|
CWaitCursor changes back to normal cursor on mouse move event, before the end of the function
CWaitCursor wait;
|
|
|
|
|
I think you are still stuck with the same problem . Why are you using CWaitCursor function? wasn't SetCursor() a better solution?
|
|
|
|
|
No it is good once but,SetCursor() was a working for all the dialogs except for one dialog box.
When I user CWaitCursor using this works for all the dialogs (for the one dialog which I mentioned above I used
wait.Restore(); inbetween the code).
It worked. But now the new problem was that when on mouse move event , the hour glass symbol is replaced by normal mouse cursor.
Is there some thing similar to wait.Restore(); wich I can use with SetCursor
|
|
|
|
|
ptr_Electron wrote: CWaitCursor changes back to normal cursor on mouse move event, before the end of the function
There is an option in to restore the cursor back, use CWaitCursor::Restore. Also check from where the cursor is being reset to normal cursor.
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I need C or C++ code to convert the hex string to the binary string please can any one help me.
Eg Hex Data:
C1 E1 08 0F B6 C0 0B C8 8D 45 F4 50 89 4D F8 FF 15 48 70 40 00 83 45 F0 04 89 45 14 50 8D 45 E4 50 FF 75 0C FF 15 4C 72 40 00 FF 75 14 FF D3 83 45 E8 04 39 7D E8 0F 8C 77 FF FF FF 83 7E 58 FF 74 65 FF 76 34 FF 15 4C 70 40 00 85 C0 89 45 14 74 55 8B 7D 0C 6A 01 57 C7 45 E4 10 00 00 00 C7 45 E8 08 00 00 00 FF 15 50 70 40 00 FF 76 58 57 FF 15 54 70 40 00 FF 75 14 8B 35 58 70 40 00 57 FF D6 89 45 0C 8D 45 E4 68 20 08 00 00 50 6A FF 68 40 3F 42 00 57 FF 15 50 72 40 00 FF 75
To Binary Data:
Vÿq@ ‹ø;ûteÿuWÿq@ ‹ð;ót=9]ä‰]ütÿuäèéóÿÿÿÖ…Àt1ÇEü
ë(h @ h°@ h PB h ÿuøÿÖƒÄë
ÿuj÷èÊ, 9]èuWÿq@ ëjöëjçè™óÿÿSÿq@ é jðèó j߉EÐèé
|
|
|
|
|
Since your string is well formatted, it's pretty simple, for instance
char szHex[] = "C1 E1 08 0F B6 C0 0B";
const unsigned int SIZE = sizeof(szHex)/sizeof(szHex[0]) / 3;
unsigned char pBinary[SIZE];
for (int i=0; i<SIZE; i++)
{
if ( sscanf(szHex + 3 * i, "%2X", pBinary+i) != 1) break;
}
However, I see the result you're expecting is quite different. How can, for instance, you map 0xC1 to 'V' ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Tuesday, June 9, 2009 3:32 AM
|
|
|
|
|
No i pasted just for a sample output that i need, its not the correct output i copied a part from the output,
Thanks for your post.
|
|
|
|
|
How would you do this using pencil and paper?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|