|
Check your list control properties. If you have "Sort" equal to "ascending" or "descending," the final position is not necessarily the one where you inserted your text.
Check the value of InsertItem() after inserting the text;
LVITEM lvi = {0};
..
..
..
INT nRow;
nRow = m_elementList.InsertItem(&lvi);
lvi.iItem = nRow;
strItem.Format(_T(tempstr));
lvi.iSubItem = 1;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_elementList.SetItem(&lvi);
|
|
|
|
|
Thanks. that fixed it. I didn't realize that there was a sorting option on the thing.
|
|
|
|
|
Is it possible to allow the user to edit the contents of the second column and NOT the first column?
Also, when a user selects an item in my CListCtrl, how to I get it to highlight the entire row, and not just the item in the first column?
|
|
|
|
|
b_girl wrote:
how to I get it to highlight the entire row
Use the extended style LVS_EX_FULLROWSELECT .
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I got a own draw controller. And I takes this controller 0.5sec to redraw because it does a lot of stuff and this is okay.
But I wonder if I can speed up some thing. If I move an application over my program, a lot of redraws are done. And since every redraw take 0.5sec it flicker a little too much. So I wonder if there are anyway to cache the last draw result and use that if nothing in my program has changed.
Since I'm using a MemDC in my program I think I should be able to cache a copy of it and use it. But how do I do that.
/Mathias
|
|
|
|
|
If the draw functions are taking too long you can create a boolean that keeps track of if anything has been actually changed in your CMemDC. This is somewhat tedious as you must set it to true for every change made, but then include it in OnDraw(CDC* pDC). You must also use a more sophisticated version of CMemDC from the destructor into a function like CMemDC::Rredraw(), include CMemDC in your CView as a member (do not destroy it, with every OnDraw or OnPaint). You must also update it in OnSize()
J.
----------------------------
|
|
|
|
|
|
I would like to press a button in an mfc application and bring another application to the top. I searched the documentation and found commands like SetForegroundWindow() and ActivateWindow(), but I only made it that the application blinks in the task bar (Win 2000). Can anyone tell me a solution of this problem. It must be working with VC6/VC7(2003) on Win 2000 and NT 4.
|
|
|
|
|
Clicking a button in your app will give it focus, so you need to do this after the button up message. BringWindowToTop() should do the trick.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Starting with Win2000, MSFT desided to restrict ability of not active application to become active (to fight those IE popups).
I'll recommend looking into AllowSetForegroundWindow to understand invented concept.
However, there are several workarounds that can do the trick -- It's not allowed to post them here, but if you email me I'll share them with you...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Why are you not allowed to post them here?
Thank You
Bo Hunter
|
|
|
|
|
Why are you not allowed to post them here?
Because, by doing that I'll be directly undermining MSFTs security efforts and eventually may get into trouble.
In my opinion, this site is directly or indirectly financed by MSFT: why would I post materials undermining MSFTs security efforts on MSFT site?
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
My solution is different, but actually there is an article here that may help you:
http://www.codeproject.com/dialog/dlgboxtricks.asp?target=attachthreadinput
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hi,
I might have posted a similar question earlier, but didn't get any answer. In my SDI application I have a tree control, which is loaded from a xml document. While loading part of the document becomes grayed, if I minimize the application and restore again, the gray portion goes away. Sometimes, when there is no gray portion in the tree control minimizing and restoring creates gray portion in the tree control, but there is no specific rule by which it happens. Was wondering why it is happening, can anybody help?
Thanks
|
|
|
|
|
Has anyone encountered a strange error in VC6, in which suddenly code starts crashing when accessing comctl32. For me it crashes in debug mode as soon as the menu in an app is mouse-overed. Everything seems fine until this seemingly random point in time.
J.
----------------------------
|
|
|
|
|
No, never. I would stronly suspect your code is screwing something up. If you check the stack backtrace in the Debugger you might get some clues.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
I would stronly suspect your code is screwing something up.
It is possible - but it doesn't seem like it. This occurs out of the blue. If there is one thing about the computer they are consistant - The code works, then at some point it starts crashing while in debug mode. Something is causing this sudden problem - and it doesn't seem to be anything that I have done differently. I will check the stack next though
J.
----------------------------
|
|
|
|
|
Reinstalled Windows and it is working properly again.
J.
----------------------------
|
|
|
|
|
Drastic measure, glad to hear it did the trick.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
JWood wrote:
Has anyone encountered a strange error in VC6, in which suddenly code starts crashing when accessing comctl32. For me it crashes in debug mode as soon as the menu in an app is mouse-overed. Everything seems fine until this seemingly random point in time.
I used to see this happen all the time when developing under Windows 95 and later 98. I've never seen it happen under 2000/XP (all I've developed under for a while now). It never seemed to be related to errors in my code, and it never happened when running my app standalone--ONLY when running under the debugger. I could never correlate it with anything in particular. It would happen frequently for a while, then I wouldn't see it for weeks, sometimes months. Very odd.
Also, it did a lot more than screw up the app I was running, mousing over icons on the Windows Taskbar caused it to crash, and any tooltip anywhere in the system (or other apps, including DevStudio) would make it crash. The only solution was to reboot.
So I can't really offer an explanation, or a solution. But it sounds like it might be the same thing. My ultimate solution was to never use the abomination that is 9x/ME again
|
|
|
|
|
So what does XP / 2000 bring to the game that was lacking in 9x?
J.
----------------------------
|
|
|
|
|
How are you guys using WTL in brand new VC7 projects? The compilation fails because of _Module being undefined. I tried using all crap like
#define _Module (*_pAtlModule)
It didnot solve all teh problems though. I had to create a fake module class to do that. Is there a simpler way anyone is using? If not will this be an article material?
Somewhere in the world there is a machine language programmer waiting for that damned assembly language fad to pass. - Stan Shanon
|
|
|
|
|
Stick the following in your stdafx.h file:
#include <atlapp.h>
extern CAppModule _Module;
|
|
|
|
|
Hi,
SafeArrayGetUBound function sets the upper bound to -1. but it returns S_OK. the safeArrayAccessData function also returns S_OK.
this happens only under win 98. everything is ok under win NT 4 and win XP. I use MSComm control and m_comm is a pointer to that. the MSComm object always exists in my dialog based application and is always in binary input mode. It sends 6 byte binary data successfully, but it cannot get the coming 6 bytes.
i need to get each byte of the coming data. i cannot make a big change in the way of receiving the data (i will continue with MSComm) because, I am all finished except for win98.
does someone know a way to fix this problem?
thanks in advance
--------
Here is some of my code:
.
.
.
COleVariant vVar;
dlg_p->m_comm.SetOutput(var_rb); // data sent
Sleep(50); // wait
vVar = dlg_p->m_comm.GetInput(); // received
//vVar.Attach(dlg_p->m_comm.GetInput()); // this doesn't change anything
Sleep(50); // wait
long lLen;
unsigned short data = 0;
HRESULT hr = SafeArrayGetUBound(vVar.parray,1,&lLen);
if(hr == S_OK)
{
lLen++;
UCHAR *pAccess;
hr = SafeArrayAccessData(vVar.parray, (void**)&pAccess);
if(hr == S_OK)
{
// under win98 lLen is 0 here.
if(lLen==6)
// stuff with pAccess[]
SafeArrayUnaccessData(vVar.parray);
}
}
.
.
.
----------
|
|
|
|
|
Hi All
i have a edit control, which i use to display text, within this text there
is usually a web address.
is it possible for me to make this a hyperlink ? or display a hyperlink
within a text box ??
thanks
si
|
|
|
|