|
It works in 3 ways
1. when you are inserting the item.
mask represents the valid field that you have filling up and that the listview control should take note of it or safe it in its internal buffer.
2. When you get LVITEM in response to some notification.
now the mask represents the valid data that this structure contains.
3. When you are trying to retrive some information like GetItem.
now the mask represents the fields that you are interested to retrive
If you are trying to insert an item and say you want to put some data in lparam then you should according set the bit in the mask to indicate that you are providing that field. If you dont set the bit then lparam is ignored.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Thanks for the reply. Unfortunatley it doesn't really answer my question. I'm not really concered with LVITEM, but simply used it as an example. I'm interested in how the bitmaks actually works. I want to use a bitmask in my program to do something similar, but I don't really know how setting a bit in the mask makes an item in the structure valid. Is it simply a check (like an if statement or something) that Windows does? So for example if I set the LVIF_TEXT flag does Windows have a check something like
if (mask & LVIF_TEXT)
Thanks again.
- Aaron
|
|
|
|
|
You need to take a look at the logical bit operations in this article.
Look at the sections that deals with bitwise Masking:
Here[^]
I Dream of Absolute Zero
|
|
|
|
|
Yes thats exactly how it works.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Is there a way I can use the switch case statement to specify a range of numbers. ie
switch(val)
{
case 100 to 300:
break;
case 500 to 750:
break;
}
or equivalent to ON_COMMAND_EX_RANGE in MFC but the SDK version.
Thanks
|
|
|
|
|
no
you could:
switch(val)
{
case 100:
case 101:
case 102:
case 103:
...
case 300:
break;
case 500:
case 501:
case 502:
...
case 750:
break;
}
which could be prettied up by a #define
switch(val)
{
CASE_100_TO_300:
break;
CASE_500_TO_750:
break;
}
The maximum characters for the signature is five hundred. I was wondering how long a five hundred characters message would be, so I decided to make my signature 500 characters long. I'm sure if I had some cool html stuff in my signature, I could eat up five hundred characters, but just typing five hundred characters takes quite some time. The trick I think is finding something to say, but I'm usually a man of few words. So I guess I'll tell you what I've discovered is the secret to life. It
|
|
|
|
|
No, i would rather go for if statement.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
|
Ravi Bhavnani wrote:
Use Pascal instead.
That's usually a better choice in any case...
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
another trick might be:
switch (val<=300?1:(val<=750?2:3))
{
case 1:
break;
case 2:
break;
case 3:
break;
}
--
Joel Lucsy
|
|
|
|
|
oh, i don't think it really works...
the compiler might say that val<=300?1val<=750?2:3) is not a constant expression.... (i don't know why but... )
TOXCCT >>> GEII power
|
|
|
|
|
You're right, my mistake. But, you can do the calculation just before the switch and stuff it into a variable and it'll work just fine. I use this type of technique occasionally so I know it works.
--
Joel Lucsy
|
|
|
|
|
hi
I have created a application for supporting another application.
So before installing my program i want to check if the main application is installed. If so i will have to move certain files from my application folder to the main applications folder.
Could anyone tell me how to accomplish this using installshield.
Thanks in Advance
Shiraz
|
|
|
|
|
Try the forums on InstallShield's site. This forum is for Visual C++, a programming language. FYI, though, there are wizards in InstallShield Developer that help you accomplish this and plenty of documentation to explain the manual steps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello all I have normal images list that I use to display the CTreeCtrl item normal images
this is the way i set the images of the item.
<br />
m_NormalImageList.Create(IDB_BITMAP_NORMAL, 16, 6, RGB (255,255,255));<br />
smptree.SetImageList(&m_NormalImageList, TVSIL_NORMAL );<br />
<br />
treeStruct.item.pszText = nametoshow;
treeStruct.item.iImage = File_Or_Folder;
Parent= aTreeCtrl->InsertItem(&treeStruct);
they seem to works.. coz all the item has the right images as i wanted them to have.
but the problem is when you click on those images after display, the images are changing.
if you dont' click on the image, it stay the way it is.
for example, c:\tempfolder has the folder image, a.txt has file image, a.zip has zip file image but when I click on folder image which is c:\tempfolder, the image change from the folder to file, when you click again, it change file to zip file image, and you click one more time, it goes back to folder image.. like going entire IDB_BITMAP_NORMAL images list... and it is never stop changing if you dont' stop clicking on the images.
how can i prevent that effect? i want folder name to have always folder image, file name to have file image, zip file to have zip file image. diable to change image to image when you click on it.
thank you
|
|
|
|
|
There are two "normal" image indexes for each tree item: the normal-normal and the selected. Insert the following:
treeStruct.item.iSelectedImage = treeStruct.item.iImage;
|
|
|
|
|
Hey Guys
Does anyone know how i can get my software to put a drive icon in explorer and then when the user enters that drive it calls my software.
Peter
|
|
|
|
|
Sorry Guys completly pointless post i found michael's guide.
|
|
|
|
|
If you are reading my namespace extension article, keep in mind that a namespace isn't a drive. If you want an actual new drive letter, you'll need to write a device driver.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
I have an ansi c string, and I'd like to convert it to Unicode and stuff this into a std::basic_string<wchar_t>.
So, I thought I could do the following :
void transformAnsiToUnicode( const char* str, int stringLength, std::basic_string<wchar_t>& newStr )
int size = MultiByteToWideChar( CP_ACP, 0, str, stringLength, NULL, 0 );
newStr.resize( size );
int err = MultiByteToWideChar( CP_ACP, 0, str, stringLength, (wchar_t*)newStr.begin(), size );
if ( 0 == err ) {
err = GetLastError();
}
Now on VC6 this works perfectly (with either the default STL or with STL Port). On VC7 it bitches about
(wchar_t*)newStr.begin()
Is there away around this?
Is this even *legal* to do? Or do I have to allocate a new wchar_t buffer, use that with MultiByteToWideChar(), and then assign to the newStr variable, and then delete it?
Thanks
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Check out USES_CONVERSION and its conversion macros, they are easy to use.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Yes you have to create a new buffer and assign it. basic_string doesn't (and shouldn't) allow you direct access to it's internal buffer. You can only get a const wchar_t* from it by using c_str(). But if you try to modify it, you will wreak havoc on the basic_string. The only way to change a basic_string's contents is through its public access members (like operator=() or the contructor, etc.)
The maximum characters for the signature is five hundred. I was wondering how long a five hundred characters message would be, so I decided to make my signature 500 characters long. I'm sure if I had some cool html stuff in my signature, I could eat up five hundred characters, but just typing five hundred characters takes quite some time. The trick I think is finding something to say, but I'm usually a man of few words. So I guess I'll tell you what I've discovered is the secret to life. It
|
|
|
|
|
Jim Crafton wrote:
(wchar_t*)newStr.begin()
generates a warning because you cannot assume that an iterator is a pointer to anything. It may actually be a pointer, but making that assumption in your code is unsafe.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!"
-- Rico Mariani, CLR perf guy
|
|
|
|
|
Damn.
I understand the reasons for that, but it's just so damn annoying to have to allocate/copy/delete a tmp buffer for no other reason than that I can't get access to the buffer in std::string.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Hi,
does anyone know how to get the secondary display monitor dimensions? GetSystemMetrics cannot do it, if I got it wright.
Tnks
Bernardo
|
|
|
|