|
The SB_LINEUP/DOWN is exactly what you say. And it comes from the SetScrollSizes, more or less 1/100 of the size.cy.
But what I said... is to get the WM_MOUSEWHEEL and multiply this SB_LINEUP with a coeficient. In order to make more than one line on each movement.
By default:
OnMouseWheel ()
{
if you are scrolling up
OnVScroll(SB_LINEUP, 0, NULL);
else
OnVScroll(SB_LINEDOWN, 0, NULL);
}
And what I am telling
OnMouseWheel ()
{
if you are scrolling up
OnVScroll( 3 * SB_LINEUP, 0, NULL);
else
OnVScroll( 3 * SB_LINEDOWN, 0, NULL);
}
with this you can use the normal Line size to Up/Down keys (for example) scrolling with accuracy, but do it faster with the mouse wheel. I you change the size of the line (another very good solution) then you will ALWAYS have that scroll velocity.
It is up to you and the needs of your project.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thank you veOnVScroll( 3 * SB_LINEUP, 0, NULL);ry much, you're sure right there!
It's great advice and sure I'm going to do so! At first I didn't see that way.
Thanks one more time!
|
|
|
|
|
I'm doing this:
<br />
BOOL CMyView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) <br />
{<br />
int pos =GetScrollPos( SB_VERT );<br />
if (zDelta>0) <br />
OnVScroll(3*SB_LINEUP,pos,NULL);<br />
else if (zDelta<0)<br />
OnVScroll(3*SB_LINEDOWN,pos,NULL);<br />
return TRUE;<br />
}<br />
When I scroll by LINEDOWN it's OK, but when I do the oposite (SB_LINEUP) it has no effect, scrolling it slow again.
Why?
Thanks!
|
|
|
|
|
Just handle the WM_MOUSEWHEEL message yourself - then you can scroll up / down by as big or small amounts as you like.
If you *don't* handle it, DefWindowProc will turn it into WM_VSCROLLs for you - which is making your life hard.
Iain.
|
|
|
|
|
Hi friends
How to move a window using its mousemove function
thanx
-RisKhan-
|
|
|
|
|
You can use of MoveWindow.
|
|
|
|
|
do you mean you want to move your window by dragging it by clicking on anywhere on the dialog?
|
|
|
|
|
|
Handle WM_NCHITTEST and always return HTCAPTION.
|
|
|
|
|
Just a little aside note.
"Moving your window by dragging it by clicking on anywhere on the dialog" is OK in one particular case: it has no menu, no system menu, no maximize/minimize/close button, no scrollbars and is not resizeable.
Returning always HTCAPTION from WM_NCHITTEST message handler leads in the impossibility of using menus,... and all enumerated above.
A little bit better approach is to apply the trick only for the client area.
Here is an example:
UINT CMyDialog::OnNcHitTest(CPoint point)
{
UINT nRet = CDialog::OnNcHitTest(point);
if(HTCLIENT == nRet)
{
nRet = HTCAPTION;
}
return nRet;
}
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mr. Ovidiu Cucu
It works fine !!!
But another problem, i like to move window in one direction ( in Horizontal only, y value is same), is it possible ?
-RisKhan-
|
|
|
|
|
Add the following line of code in your LButton Down handler.
<br />
PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));<br />
|
|
|
|
|
I have written one small program in Visual Studio 6.0 which just goes on allocating the memory using 'new' operator. My thinking was that it will give 'memory full' error once all the physical memory and page file memory is full. So I executed the program nad start observing the Task Manager. As the program is executing, the task manager was showing reduced available size of the physical memory. Once the physical memory is full, it start showing higher PF Usage. When my program game me the 'Memory full' error, the PF usage was just 2.8 GB. My PF size is 4 GB. So still 1.2 GB was unused. Why should the program give 'Memory full' error when there is still 1.2 GB available. My physical memory (RAM) is 512 MB. Any idea why is it so?
Following is the program.
int main(int argc, char* argv[])
{
double dMemAllocated=0;
char *c[64003];
char *s[64003];
int i=0;
while (1)
{
try {
c[i] = new char[40*1024];
s[i] = new char[40*1024];
if(i > 64000)
break;
if((c[i] == NULL) || (s[i] == NULL))
{
cout << "Memory full. Memory Allocated = " << dMemAllocated;
getchar();
}
cout << i++ << "\n";
}
catch(...)
{
cout << "Memory Allocated = " << dMemAllocated;
getchar();
}
dMemAllocated += 80*1024;
}
cout << "Memory Allocated = " << dMemAllocated;
getchar();
return 0;
}
|
|
|
|
|
The remaining memory is reserved for the system and cannot be accessed from your program.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
But I even tried increasing the PF size to 6.5 GB from 4 GB. Still my program was giving 'memory full' error after using approximately 2.8 GB of PF.
|
|
|
|
|
You can increase it to 200GB or more... the virtual memory size for a Win32 process is 4GB.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
There is a limititation because there is a VC-Project (compiler/linker) setting to limit the working set to 2 GB. Which can be changed, but suddenly I dont remember.
Greetings from Germany
|
|
|
|
|
If it can be changed, then it is great. Can you please let me know when you remember it? Is it achieved by changing the compiler option? Or changes required are in registry etc?
|
|
|
|
|
|
Salut Florin,
As stated in MSDN "The /LARGEADDRESSAWARE option tells the linker that the application can handle addresses larger than 2 gigabytes" but AFAIK you cannot pass beyond how much memory a process can handle, i.e. 4GB for Win32(see my first answer).
Ovidiu Cucu
Microsoft MVP - Visual C++
Cofounder CODEXPERT.RO
|
|
|
|
|
I guess I need another cup of coffee
Florin Crişan
|
|
|
|
|
Me too!
Ovidiu Cucu
Microsoft MVP - Visual C++
Cofounder CODEXPERT.RO
|
|
|
|
|
I think only Vista (Amongst microsoft OS) is 64 bit OS. And I heard that it has problems. So I am try to avoid it.
So much memory is required becuase it is multiuser application and each user can fetch upto big set of data in memory for processing. So even if one user takes 20 MB, then 100 simultaneous users can occupy 2 GB.
|
|
|
|
|
Actually, there are 64-bit editions of XP Professional, Server 2003 and Vista.
Anyway, you may want to consider processing the data in smaller chunks (you may not need to load whole files in the memory). Allocating more than the physical memory will seriously degrade performance (virtual memory is much slower).
You might also want to try distributing the workload to several machines
But, of course, this is just generic advice – I don't really know what your application does
Florin Crişan
|
|
|
|
|
... and by files I mean data, even if it comes from a database
Florin Crişan
|
|
|
|