|
HI,
I wish to draw(in MFC) a simple rectangle box onto a constant refreshing picture.i tried to create two Picture control object and overlap one over the other. However, the box always get erased because of the refreshing picture.
If anyone knows how to slove this problem please help me..^^..
|
|
|
|
|
Hello All,
Is the Windows NT/2000 GINA system the same one used by Windows XP ? If I already have a custom GINA DLL that is usable in Win NT/2K, can I use this GINA in Win XP ?
Thanks all,
Bio.
|
|
|
|
|
Hi
I've just placed a CListCtrl into my dialog in a VC5 project.
I should be able to enable 'Owner data' in the style property of the CListCtrl. But i don't find it, i only find 'owner data fixed'.
However, if i place a CListCtrl in a VC6 project i find it & can enable it.
Anyone knows how to get this working in a VC5 project?
Best regards
Jens
|
|
|
|
|
hi Jens ! Still struggling with your VC5 project
DWORD d=m_List.GetExtendedStyle();
d|=LVS_OWNERDATA;
m_List.SetExtendedStyle(d);
(I expect you t say there is no SetExtendedStyle in VC5 .. Am I right ?)
~RaGE();
|
|
|
|
|
yeah you were right
btw, i think owner data fixed in vc5 is the same as 'owner data' in vc6.
Now need to work around 'SetItemCountEx' which is not a member function (again ) of CListCtrl. Damn vc5 can suck sometimes. Any ideas to work around this prob. let me know
Just edited Thinks this will do the trick:
m_itemcount= 100;
m_virlist.SendMessage(LVM_SETITEMCOUNT, m_ItemCount)
Greetings
|
|
|
|
|
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 />
}
|
|
|
|
|
|