The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: shankle on February 25, 2005, 02:17:06 PM

Title: setscrollinfo/scrollinfo/getscrollinfo
Post by: shankle on February 25, 2005, 02:17:06 PM
In WM_Size I set the parms for scrollinfo. Then use setscrollinfo.

When I get to WM_Paint and use getscrollinfo, the location of the scrollinfo has been moved
and garbage is in it.
I set cbsize and fmask before each one.

Went up on Microsoft and am using the same procedure that they have for scroll bar text.

IT'S GOT TO BE STUPID!!!!
Any suggestions would be appreciated.
JPS

Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: P1 on February 25, 2005, 02:38:22 PM
Post your code for review, or at least a sample made from your code for analyzes.

Regards,  P1  :8)
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: P1 on February 25, 2005, 06:01:48 PM
The example has two EndWhile labels.  Fix this and we will move on.

Regards,  P1  :8)
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: shankle on February 26, 2005, 01:43:38 AM
Here is the revised jpsscr.zip. Sorry about the extra EndWhile.

Regards,
JPS

[attachment deleted by admin]
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: shankle on February 28, 2005, 01:02:32 AM
Thanks to those who helped.
DON'T spend any more time on this.

The program  involves two windows.
1st window - consists only of headings at the top of the screen.
2nd window- consists of data that can be scrolled that fills the screen below the headings.

The problem seemes to be in the way I defined the CREATEWINDOWEX api.

1st window - has to have NULL and WS_OVERLAPPEDWINDOW
2nd window - has to have WS_TOP_MOST and WS_EX_MDICHILD or WS_VSCROLL

There are other problems but they are just a matter of Assembler logic.

Windows will be the death of me.....
Thanks again,
JPS
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: petezl on February 28, 2005, 10:21:19 AM
JPS,  Are you saying that the altered window styles cured your problem with the ScrollInfo structure?

Only, I recently started with a clean sheet of paper to explore (understand) the in's and out's of ScrollInfo and the associated messages.
I found that with XP I couldn't read or write to members of the structure directly. In the end I used temp variables like tempnPos, tempnPage etc for on the fly use and updated (syncronised) the ScrollInfo struct at the critical times.
So what I observed is that the only way to modify stuct members was to use the full SetScrollInfo command.
Peter.
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: six_L on February 28, 2005, 04:34:57 PM
for P1,
i'v seen your five star, I think you are a professional coder. but your answer can't figure out his problem.
mov   hOvlay,eax
;here, crash be happened
invoke ShowWindow, hOvlay, SW_SHOW
invoke UpdateWindow, hOvlay

I Think you should have a little earnest.

regards.
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: shankle on March 02, 2005, 01:16:44 AM
Sorry for the delay in answering you Petezl. Was in hospital.
I think the way I had the CreateWindowEx defined confused the scrolling commands.
I was immediately able to go to the end of the file where before I could scroll only a
few pages.
Do to my limited knowledge of windows I am probably not handling the 2 windows properly.

Still working on the program but I think I am over the major hurdle.
Love the cat...
Regards,
JPS
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: tenkey on March 03, 2005, 02:41:41 AM
You are using the same WndProc for both windows, but you are always using hOvlay in some of your WndProc code.

WM_PAINT is being sent to both windows, but you always update the Ovlay scroll bars, and you are incorrectly always updating hOvlay (BeginPaint-EndPaint). BeginPaint and EndPaint should always use the window receiving the message, the hWnd argument of WndProc.

WM_SIZE is also sent to both windows, so you should only be updating the information for the receiving window, again it is hWnd.

If you want two windows with different behaviors, you should create two window procs, and set the lpfnWindowProc field appropriately. Then, within the WndProc, use only the hWnd argument, not the global variables you have stored.

WM_SIZE is also sent when a window is being created, before hOvlay receives a value from CreateWindowEx. Another reason for using the hWnd argument and not the global hOvlay.
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: shankle on March 03, 2005, 12:17:57 PM
Thank you TENKEY.
Had no idea I was doing that much incorrectly. Will try your suggestions.
Don't see how I got anything to work being that wrong....
Thanks,
JPS
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: petezl on March 04, 2005, 10:20:15 PM
JPS,
Sorry for the delay in getting back to you too.
I did compile and run your rogram but there were problems with the paint proc which has already been pointed out. I did a scroll skeleton and tried changing just about everything but still couldn't write or read directly from the ScollInfo struct without using the ful Get/SetScrollInfo api.

Peter.
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: shankle on March 05, 2005, 02:31:04 PM
Petzel,

I've made the changes that Tenkey suggested. Added another wndproc, got rid of hOvlay and
made it hWnd. That took care of the multiple windows problem.
Now I'm in the process of trying to covert Petzold's C code into Assembler, that processes
scrolling. Not being a C programmer I'm having a few difficulties. As a guide I am studying
Petzold's Sysmets3 scrolling program. My program will still not scroll correctly.

JPS     
Title: Re: setscrollinfo/scrollinfo/getscrollinfo
Post by: petezl on March 05, 2005, 03:44:07 PM
If you send me your email addr via PM I will send you what I have done (file size is too large to post in the forum)  The scroll stuff is entirely my version written from scratch so is not intended as a demonstration piece but is well commented. Might at least point you in the right direction...

Peter.