|
uhm, doesn't want to display any data in the list.
I've put it on 'owner data fixed'
I fill the array correctly. I'm sure of that because i've written the array to a log file too.
But the list isn't displaying anything.
void CTestVirtList::OnGetdispinfoVir(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM* pItem= &(pDispInfo)->item;
CWknItem rWkn = m_arLabels.ElementAt(pItem->iItem);
if (pItem->mask & LVIF_TEXT) //valid text buffer?
{
// then display the appropriate column
switch(pItem->iSubItem)
{
case 0:
lstrcpy(pItem->pszText, rWkn.m_WknId);
break;
case 1:
lstrcpy(pItem->pszText, rWkn.m_WknName);
break;
default:
ASSERT(0);
break;
}
*pResult =0;
}
But the code above (OnGetdispinfover) doesn't get called i see now. (i've put a messagebox into the function)
Anyone have any ideas?
Greetings
Jens
|
|
|
|
|
Did you miss the m_virlist.Invalidate() ?
~RaGE();
|
|
|
|
|
JensB wrote:
btw, i think owner data fixed in vc5 is the same as 'owner data' in vc6.
I agree.
JensB wrote:
m_itemcount= 100;
m_virlist.SendMessage(LVM_SETITEMCOUNT, m_ItemCount)
yup.
m_virlist.SendMessage(LVM_SETITEMCOUNT, (WPARAM)m_ItemCount, (LPARAM)LVSICF_NOINVALIDATEALL
)
~RaGE();
|
|
|
|
|
Did you miss the m_virlist.Invalidate() ?
No, that's just the strange part of it
I did a invalidate() but control doesn't ask for the data.
Jens
|
|
|
|
|
I'll paste the code that is executed
CWknItem MyItem;
MyItem = m_arLabels.ElementAt(2);
AfxMessageBox(MyItem.m_WknId);
m_virlist.SendMessage(LVM_SETITEMCOUNT, (WPARAM)m_ItemCount, (LPARAM)LVSICF_NOSCROLL);
m_virlist.Invalidate();
// Invalidate -> should call the function who takes care of setting data in ctrl
In .h header file:
afx_msg void GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult);
Message map:
ON_NOTIFY(LVN_GETDISPINFO, LIST_VIR, GetDispInfo)
void CTestVirtList::GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
AfxMessageBox(" in getdispinfo");
...
}
Doesn't seem like it gets into that function
|
|
|
|
|
MSDN :
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
ON_NOTIFY_REFLECT(LVN_GETDISPINFO, GetDispInfo)
END_MESSAGE_MAP()
~RaGE();
|
|
|
|
|
There are only three possibilities :
Your m_virlist has not LVS_OWNERDATA style.
There are no item in your list.
You are not handling the LVN_GETDISPINFO correctly.
Usually, a lot of GetDispInfo messages are sent when using virtual lists, os you should be able to make sure (using Spy++) that your app is sending it or not. If yes, then you don't handle it correctly, if not, the style LVS_OWNERDATA is not set.
~RaGE();
|
|
|
|
|
ok, the problem is setting the LVS_OWNERDATA style.
I thought i had set that style but it was the owner draw style.
Then i tried to add the style by using:
DWORD d = m_virlist.SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE,0,0);
d |= LVS_OWNERDATA;
m_virlist.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE,0,d);
but it sure doesn't work neither.
I've let the spy do its job, and i don't see any LVN_GETDISPINFO messages passing.
Greetings
Jens
|
|
|
|
|
btw, rage i don't think i can set the extended style like that.
I've already changed it to this:
if ( m_virlist.ModifyStyleEx(0, LVS_OWNERDATA,0) )
{
AfxMessageBox("accepted");
}
It show the messagebox "accepted". but doesn't work. And don't get the DISPINFO message neither
I'm running out of inspiration
|
|
|
|
|
Can you try and use SetWindowLong and GetWindowLong to change styles ?
~RaGE();
|
|
|
|
|
Noop doesn't work.
But i've chosen not to work with Virtual List anymore because i have a file with about 7000 employees in it.
In a normal list it takes about 56 seconds to load.
In the virtual list, it is loaded into the array after 49 seconds. So almost no speed improvements (the Dbase IV database slows it down alot). I don't see any reason why i still would use the virtual list. (more memory used too).
So, i'll drop this question. (I tried in VC6 the same code and it worked already, so the problem is the VC5)
Greetings
Jens
|
|
|
|
|
JensB wrote:
In the virtual list, it is loaded into the array after 49 seconds
That's because you are not using the cache. If you do, you only have to load the item currently displayed in the listview. You put the items coming before and after in the cache (but just a few ones, actually the ones that could be displayed if the user goes up or down). The rest will be loade progressively.
but I agree. Let's use BeginWaitCursor( ); and EndWaitCursor( ); or a typical "Maunder Progress Bar" ...
~RaGE();
|
|
|
|
|
Using the task manager in Win XP you can switch to a user that is already running. (right click on the user and click connect - type in password - click ok).
What is the API function to do user switching?
|
|
|
|
|
|
Can you tell me the code to delete a file in Vc++ 6.0?
thank you very much.
|
|
|
|
|
|
You can use SHFileOperation to delete a file
or
You can use the API _unlink()
Ankush
|
|
|
|
|
I have a string, such as "Hello World!"
I want copy it to clipboard, so that, after that, when I right click in a word process application ( such as: NotePad, WordPad, Word...), there is a "paste" menu command show for me to paste that string "Hello World!"
My code is wrong (GlobalUnlock) but I dont know how to fix it (I am following code in MSDN sample)
thanks!
BOOL CopyToClipBoard(LPSTR lpszString)<br />
{<br />
LPTSTR lptstrCopy; <br />
HGLOBAL hglbCopy; <br />
INT cch; <br />
<br />
OpenClipboard(hWnd);<br />
EmptyClipboard(); <br />
<br />
cch=strlen(lpszString);<br />
hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (cch + 1) * sizeof(TCHAR)); <br />
if (hglbCopy == NULL) <br />
{ <br />
CloseClipboard(); <br />
MessageBox(hWnd,"errror on GlobalAlloc()","Error",MB_ICONERROR);<br />
return FALSE; <br />
} <br />
<br />
lptstrCopy = (LPTSTR)GlobalLock(hglbCopy); <br />
memcpy(lptstrCopy, lpszString, cch * sizeof(TCHAR)); <br />
lptstrCopy[cch] = (TCHAR) 0;
<br />
<br />
if(!GlobalUnlock(hglbCopy))
MessageBox(hWnd,"errror on GlobalUnlock()","Error",MB_ICONERROR);<br />
return FALSE; <br />
}<br />
<br />
if(!SetClipboardData(CF_TEXT, hglbCopy))<br />
{<br />
MessageBox(hWnd,"errror on SetClipboardData()","Error",MB_ICONERROR);<br />
return FALSE; <br />
}<br />
<br />
if(!CloseClipboard())<br />
{<br />
MessageBox(hWnd,"errror on CloseClipboard()","Error",MB_ICONERROR);<br />
return FALSE; <br />
} <br />
<br />
return TRUE;<br />
}
|
|
|
|
|
|
|
Here is one solution.
HANDLE cbData = ::GlobalAlloc(GMEM_MOVEABLE, STRING_SIZE + 1);
PTSTR pData = static_cast<ptstr>(::GlobalLock(cbData));
_tcscpy(pData, theString);
::GlobalUnlock(cbData);
COleDataSource *pODS = new COleDataSource;
pODS->CacheGlobalData(CF_TEXT, cbData);
pODS->SetClipboard();
Kuphryn
|
|
|
|
|
Hi,
I would like to develop a kind of news displaying app with a transparent window. Unfortunately my machine does not support alpha-blending overlays.
Therefore, I want to have an inactive always-on-top window that doesn't capture mouse events. Instead, all events shall be passed to the underlying windows, just as if my window would not exist.
Is that possible?
Thanks,
Chris
|
|
|
|
|
|
I have tried this. It doesn't work, because the currently active application still becomes inactive when I click into my window.
Any other suggestion?
Chris
|
|
|
|
|
I'm not sure - can we use the == operator on the basic_string templte, as in the following manner:
#include <iostream>
#include <string>
string s1 = "Hello" ;
string s2 = "Hello" ;
string s3 = "hell" ;
cout << (s1 == s2)
cout << (s1 == s3)
In some other languages (as in Java), == checks for equlity of memory location. Does basic_string have an overloaded == operator?
|
|
|
|