|
Hi,
I have a ListView in which I have used WM_NCCALCSIZE to give me an area at the top where I can draw my own info (above the header). This is fine except that it messes up the vertical scrolling. The last list item (in report view) doesn't appear. (My additional NC area is about 18 pixels high, which is about the height of one item.)
It seems that the ListView still thinks its client area is the original size, and so does not allow scrolling down as far as the last line. I have tried using SetScrollInfo to increase its max scroll point, and this works in that I can click down and see the last line appear, but on releasing the mouse, it jumps back up a line, and reverts to the original scroll-bar behaviour.
Does anyone have any ideas on how I can fix this? (If I apply the same code to other types of control they work fine, it's just listviews that don't.)
Thanks,
Paul.
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
Just a wild guess here. Could it be that the list view expects to only have a CHeaderCtrl at the top, and adjusts its scrolling only based on the header control. How about making the CHeaderCtrl ownerdraw and adding the extra space to the header instead of the list control itself?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I think it must be something to do with that, though turning off the header doesn't make it any better.
You can try it easily by subclassing a ListView control, then handling WM_NCCALCSIZE and adding something like
lpncsp->rgrc[0].top += 20;
Now, add a load of items to the list, and you will see that the vertical scroll-bar doesn't allow you to scroll right to the bottom of the client area. The bottom items get clipped.
I can't find any way of telling the ListView how big to consider its client area to be.
The closest I have to a solution is to fiddle the scroll bars on scrolling:
SCROLLINFO si = { sizeof(si), SIF_RANGE };
m_pList->GetScrollInfo(SB_VERT, &si);
si.nMax = m_pList->SendMessage(LVM_GETITEMCOUNT);
m_pList->SetScrollInfo(SB_VERT, &si);
This allows me to scroll to the bottom, and shows me the bottom item when scrolling, but on releasing the mouse button it jumps back up one notch.
I know you like a challenge, and will no doubt find me a solution!
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
Can anyone help me out please. I have been searching the internet for ages now trying to find a decent tutorial about this topic. If you know where there is one please paste it here
|
|
|
|
|
In Win32 Api!
WM_SETFONT
In MFC
CWnd::SetFont
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Hi all,
I want to get through a proxy server which needs NTLM authentication.
I want to know the following:
1) Username and password (IE and FF can do this without interacting with the user)
2) How to set up the headers
I am using WinInet (CInternetSession).
Thanks!
Geert
http://geert.yoki.org
|
|
|
|
|
HI
I am getting an application path from file.
and i have all the dll in the folder named component.
for eg, C:\Program Files\Demo\Components and i am retreiving dll one by one and formed the new string
for eg. str="regsvr32 /u " +"C:\Program Files\Demo\Components\demo.dll";
and i am passing it to ShellExecute but it does not work what should i do or which function should i use.
Cheers
|
|
|
|
|
To load and unload libraries use LoadLibrary and FreeLibrary functions.
|
|
|
|
|
i want to unregister the dll freelibrary will just free the library after use.
thanx for replying.if you have any other solution please reply
cheers
|
|
|
|
|
Anonymous wrote:
str="regsvr32 /u " +"C:\Program Files\Demo\Components\demo.dll";
make is something like this
CString str="regsvr32 /u " +"C:\\Program Files\\Demo\\Components\\demo.dll";
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Anonymous wrote:
for eg. str="regsvr32 /u " +"C:\Program Files\Demo\Components\demo.dll";
There are few problems with the code.
1. You are trying to pass the parameter along with the exe name, which is not suggested.
so make two strings like :
string sFile(_T("regsvr32"));
string sParam(_T("/u \"C:\\Program Files\\Demo\\Components\\demo.dll\""));
2. Also note the dll path wrapped with double quote above.
Now call
::ShellExecute(hWnd,_T("open"),sFile.c_str(),sParam.c_str(),0,SW_SHOW);
suhredayan There is no spoon.
|
|
|
|
|
i am not able to use getvolumeinformation in my vc++ code.
can u give me one example how to i use getvolumeinformation in my code
|
|
|
|
|
|
aloktambi wrote:
can u give me one example how to i use getvolumeinformation in my code
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello everybody. I have a problem with the handles used by one of my samples.
A sample code is:
do<br />
{<br />
WriteXML(); <br />
Sleep(1000); <br />
}while (1); <br />
In the WriteXML method I write a string into a file a file using CStdioFile. The code is working well but I have noticed that the handles used by my application are continuously growing. I use the handle.exe utility from Sysinternals in order to track the handles and almost all of them are used by File.
After that I have implemented a new WriteXML method which is using the CreateFile, WriteFile and CloseHandle methods and the same result. The handles are still continuously growing.
Anyone has any idea how I can solve this issue?
Thank you
|
|
|
|
|
Handle leak occours only if you don't close any opened handle. Without seeing your code its difficult to say where is the problem.
suhredayan There is no spoon.
|
|
|
|
|
Thank you for your reply.
Here is the code used for writing the log now:
HANDLE hFile = CreateFile(FilePath.GetBuffer(), <br />
FILE_ALL_ACCESS, <br />
0, <br />
NULL, <br />
CREATE_ALWAYS, <br />
FILE_ATTRIBUTE_NORMAL, <br />
NULL); <br />
DWORD dwBytesWritten; <br />
WriteFile(hFile, <br />
m_szToWriteData.GetBuffer(0), <br />
m_szToWriteData.GetLength(),<br />
&dwBytesWritten, <br />
NULL); <br />
CloseHandle(hFile);
I do call CloseHandle(hFile) but if I check the handle count they are always increasing with 1 each time I do log into the file.
|
|
|
|
|
I believe that you should call CString::ReleaseBuffer after having used CString::GetBuffer (Check in MSDN for confirmation) Of course it has nothing to do with files, and I don't know if this may cause the loss of handle resource you are talking about. Actually I don't know what happens really when one forgets to call CString::ReleaseBuffer (memory leak ?) Maybe someone can help overthere ?
|
|
|
|
|
Thank you for your reply.
I have tried to use ReleaseBuffer but no luck. I think that ReleaseBuffer it might cause memory leaks (as you have mentioned) but is not related with the continuously growing of handles - which is the my main problem.
Anything else that I can try.
Thank you.
|
|
|
|
|
For what you are doing, GetBuffer() is not necessary. Remove it.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
micutzu wrote:
Anyone has any idea how I can solve this issue?
What makes you think there is an issue? How do you know that the handle count is not simply a high-water mark?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Well I am using the handle.exe utility from Sysinternals in order to track applications performances and handle usage seems an extremely important issue for me.
Here is a sample of the log generated by handle.exe
748: File C:\samples\Logs<br />
74C: File C:\samples\Logs<br />
750: File C:\samples\Logs<br />
754: File C:\samples\Logs<br />
758: File C:\samples\Logs<br />
75C: File C:\samples\Logs<br />
760: File C:\samples\Logs<br />
764: File C:\samples\Logs<br />
768: File C:\samples\Logs<br />
76C: File C:\samples\Logs<br />
770: File C:\samples\Logs<br />
774: File C:\samples\Logs<br />
778: File C:\samples\Logs<br />
77C: File C:\samples\Logs<br />
780: File C:\samples\Logs<br />
784: File C:\samples\Logs<br />
788: File C:\samples\Logs<br />
78C: File C:\samples\Logs<br />
790: File C:\samples\Logs<br />
794: File C:\samples\Logs<br />
798: File C:\samples\Logs
And since the logging operation is done each second than the amount of extra handles per minute is 60. Considering this I thing that the handle count is an issue.
Thank you for your comments.
|
|
|
|
|
Hi,
I want to display a grpah in a dialog according to the data input from user. A two cordinate graph with markings at specific points according to user's input.
Which way to go ?? ActiveX ??
- KK
- KK
|
|
|
|
|