|
As another poster pointed out, when you delete an item it alters the indices of all the items that follow. For example, after item 0 is deleted what used to be item 1 is now item 0. Try modifying your code as follows:
for (int n=0;n < m_List.GetItemCount(); )
{
if(m_List.GetItemState(n, LVIS_SELECTED) == LVIS_SELECTED)
{
m_List.DeleteItem(n);
}
else
{
++n;
}
}
Even better, as the other poster indicated, go backwards and the problem goes away without the need for the above complications.
Steve
|
|
|
|
|
Hi,
im using Ccheckboxlist..and suppose im adding items to Ccheckboxlist as follows....
test
tester
testing
All
and later i want to change the position of "All" to first ie
All
test
tester
testing
Pls help me regarding the same....
|
|
|
|
|
I'd suggest you would delete item 3 from the list (the indices are zero-based) and insert a new item. Look at the DeleteString and InsertString methods.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
It's logically correct to do either of the 2 things.
Either make the list sorted.
Or add the items in the required order.
In this particular case, you should insert "All" at index 0.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi friends,
How can I use the MSChart Control in a MFC. I have problems with finding a way to put the data in the Chart control. I have stored my data both the data for the x axis and y axis in the access database. How to get the data from the database and then plot the graph in MS chart in MFC.
Quick reply is appreciated
Thanks a heap...
|
|
|
|
|
Hi friends,
How can I insert time information to the access database.I am working in MFC. Pl. help me how to insert time to access database.
Is there any format for insertion????
Quick reply is appreciated....
Thanks a heap...
|
|
|
|
|
How are you interfacing to the database? What's the data type of the relevant column in the database table?
Using (for example) OLE DB with an Access table containing a Date/Time typed field, you interface via a rowset that will have a member variable of type DATE, rather than a string.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
how to make the dialog transparent but the control is not transparent?
|
|
|
|
|
Could you explain a bit more what you mean?
> 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. <
|
|
|
|
|
Do none of the transparent[^] dialog[^] articles[^] on CodeProject help? Or couldn't you see them (they are transparent, after all).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Use setlayeredwindow() api
|
|
|
|
|
I have got three 2D images about the height of one object int three different angle of view. Now, I want to transform the three images with Rotation matrix into one global reference frame. But I don't
know how to do with the datas in the overlap area of three different angle of view's images with C/C++.
|
|
|
|
|
It sounds to me like you need to extrude each of the images in the plane of the image, then perform intersection operations[^] to shape the object?
Can you use a package like Blender or somehting to do that rather than writing your own? Alternatively, there are several libraries that will help you do that[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I do some optical measurement in 3D recently. I really don't know how to rotate and splice the datas
in 3D space with the C.
|
|
|
|
|
How to find others tray icon from task bar?
I want to track my application tray icon from another application.
Consider outlook express tray icon it will be display only the time of new message arrival.
Like that My application will display tray icon for some time. At that time i have to do some operation from
another application. For that how can I track that whether tray icon is displayed or not?
So please help me
|
|
|
|
|
I don't think you can track whether a tray icon is visible or not.
Even if you could, there are so many better ways to send messages between processes.
Look at Interprocess Communications[^] and Interprocess Synchronization[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
See if this article is of help to you:
Shell Tray Info[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Why am I not able to handle WM_KEYDOWN on a dialog? Pretranslate is the only way? Also what's the reason the event is not getting dispatched to the dialog?
|
|
|
|
|
Probably because the control with focus is getting the messages, not the dialog.
Add your WM_KEYDOWN handler and add this PreTranslateMessage override and you should be good, so long as your dialog is modal:
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
pMsg->hwnd = this->m_hWnd;
return CDialog::PreTranslateMessage(pMsg);
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for your reply Stuart.
Stuart Dootson wrote:
Add your WM_KEYDOWN handler and add this PreTranslateMessage override and you should be good, so long as your dialog is modal:
I could rather manipulate that the key in pretranslate() itself right?
Stuart Dootson wrote: Probably because the control with focus is getting the messages, not the dialog.
That was my guess, Just to test that I tried deleting all the controls on the dialog. Just a plain dialog but still it's not getting the event. What could be the reason here?
|
|
|
|
|
grassrootkit wrote: I could rather manipulate that the key in pretranslate() itself right?
Should be fine
grassrootkit wrote: What could be the reason here?
I don't know - but Spy++ could tell you if the dialog's getting the WM_KEYDOWN messages?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Okay I'll check them up. Thanks for your responses.
|
|
|
|
|
Hi,
How to install the vs 2008 trial edition after download from mircosoft?
|
|
|
|
|
Looks like your OS lost a handler for "Space" KeyDown? Your subject looks like a train.
samuellhu wrote: How to install the vs 2008 trial edition after download from mircosoft?
You need to stay online. It downloads from their server.
|
|
|
|
|
I am writing an application that enumerates all the subkeys in HKEY_CLASSES_ROOT\CLSID, and then writes all the names of subkeys to an XML file for reference.
It's pretty simple stuff, really. This registry location stores configuration information for all the registered COM classes on my machine, and there are about 4.000 subkeys.
Each subkeys Name is the hexadecimal string representation of a 128-bit number known as a Globally Unique Identifier (GUID). When represented textually, GUIDs are always displayed in the following canonical form:
BDA4A270-A1B1-11D0-8C2C-0080C73925BA
The HKEY_CLASSES_ROOT\CLSID subkeys are named exactly like this, except that they begin and end with curly braces.
I enumerate the subkeys with a simple for loop, saving the GUID to a TCHAR buffer (size, 128 bytes) and everyting works OK, until I hit a subkey about a third of the way down that is a GUID with one of the integers missing. Then the RegEnumKeyEx function stops writing the GUIDs to the TCHAR buffer, but continues on without generating an error code.
The program code then writes the GUID text strings to my XML file (this part works great).
I had to write another function that uses RegEnumKeyEx in a for loop again, but indexes the enumeration to begin at the subkey immediately after the truncated GUID that caused the problem initially, and runs to the final key (total subkey count obtained with RegQueryInfoKey). This works successfully. but the entire process of the determining the source of the error, and writing a seperate enumeration function was quite time consuming (I initially thought it was insufficient memory.).
I'm wondering if anyone knows why RegEnumKeyEx behaves like this. Surely, it doesn't check the text GUID values for validity. I used Registry Editor to search for other keys and associated values for that one malformed GUID, and found about a dozen entries, all with the same exact truncated format (weirdly enough, it's a Visual Studio component!).
Any useful comments are appreciated,...thanks.
|
|
|
|