Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[MASM] Scrolling Problem - Nfo Viewer

Featured Replies

Posted

Hi every one,

I'm trying to code a nfo viewer with a scrolling effect for the text.

I followed the exemple of Jowy (irc nfo viewer v2) but i've a problem that i don't manage to find.

When the top of the text is touching the top of the Dialog, it scrolls back, so i can't see the whole text...i'd like (of course :P )that the text continues for the bottom of the text arrives at the top of the dialog.

Here 's the code of the scrolling i did :

invoke GetClientRect,hWnd,ADDR NfoRect
mov hdc,FUNC(GetDC,hWnd)
mov chdc,FUNC(CreateCompatibleDC,hdc)
mov hbmp,FUNC(CreateCompatibleBitmap,hdc,NfoRect.right,NfoRect.bottom)
invoke SelectObject,chdc,hbmp
m2m rClientNfo.right,NfoRect.right
m2m rClientNfo.bottom,NfoRect.bottom
sub rClientNfo.bottom,210
dec rClientNfo.right invoke FrameRect,chdc,ADDR rClientNfo,hpen
invoke SetTextColor,chdc,Cyan
invoke SetBkColor,chdc,TRANSPARENT invoke IntersectClipRect,chdc,rClientNfo.left,rClientNfo.top,rClientNfo.right,rClientNfo.bottom
invoke SelectObject,hdc,hNFOFont invoke DrawText,hdc,ADDR hViewMap,-1,ADDR rScroll,DT_CALCRECT + DT_NOPREFIX + DT_TOP + DT_NOCLIP m2m rScroll.right,rClientNfo.right
sub rScroll.right,5
add rScroll.top,GETV(rClientNfo.bottom)
add rScroll.bottom,eax invoke ReleaseDC,hWnd,hdc mov TimerID,FUNC(SetTimer,hWnd,IDC_TIMER,SCROLLSPEED,NULL)
mov ID,1 .elseif uMsg == WM_PAINT
invoke BeginPaint,hWnd,addr ps
mov hdc,eax invoke SelectObject,chdc,hNFOFont
invoke DrawText,chdc,hViewMap,-1,ADDR rScroll, DT_TOP + DT_NOPREFIX + DT_NOCLIP
invoke BitBlt,hdc,220,210,NfoRect.right,NfoRect.bottom,chdc,0,0,SRCCOPY
invoke EndPaint,hWnd,addr ps .elseif uMsg == WM_TIMER
add rScroll.top,GETV(ScrollOffset)
add rScroll.bottom,eax
.if SDWORD PTR rScroll.top >= GETV(rClientNfo.bottom)
mov ScrollOffset,-1
.ELSE
.if SDWORD PTR rScroll.bottom <= GETV(rClientNfo.top)
mov ScrollOffset,1
.endif
.endif invoke InvalidateRect,hWnd,NULL,FALSE .elseif uMsg==WM_CTLCOLORDLG
return hBrush
ret

Could you see what do i wrong?

Thanks for your Help ;)

Regards.

Edited by papa bango

  • 1 month later...

Hi every one,

I'm trying to code a nfo viewer with a scrolling effect for the text.

I followed the exemple of Jowy (irc nfo viewer v2) but i've a problem that i don't manage to find.

When the top of the text is touching the top of the Dialog, it scrolls back, so i can't see the whole text...i'd like (of course :P )that the text continues for the bottom of the text arrives at the top of the dialog.

Here 's the code of the scrolling i did :

invoke GetClientRect,hWnd,ADDR NfoRect
mov hdc,FUNC(GetDC,hWnd)
mov chdc,FUNC(CreateCompatibleDC,hdc)
mov hbmp,FUNC(CreateCompatibleBitmap,hdc,NfoRect.right,NfoRect.bottom)
invoke SelectObject,chdc,hbmp
m2m rClientNfo.right,NfoRect.right
m2m rClientNfo.bottom,NfoRect.bottom
sub rClientNfo.bottom,210
dec rClientNfo.right invoke FrameRect,chdc,ADDR rClientNfo,hpen
invoke SetTextColor,chdc,Cyan
invoke SetBkColor,chdc,TRANSPARENT invoke IntersectClipRect,chdc,rClientNfo.left,rClientNfo.top,rClientNfo.right,rClientNfo.bottom
invoke SelectObject,hdc,hNFOFont invoke DrawText,hdc,ADDR hViewMap,-1,ADDR rScroll,DT_CALCRECT + DT_NOPREFIX + DT_TOP + DT_NOCLIP m2m rScroll.right,rClientNfo.right
sub rScroll.right,5
add rScroll.top,GETV(rClientNfo.bottom)
add rScroll.bottom,eax invoke ReleaseDC,hWnd,hdc mov TimerID,FUNC(SetTimer,hWnd,IDC_TIMER,SCROLLSPEED,NULL)
mov ID,1 .elseif uMsg == WM_PAINT
invoke BeginPaint,hWnd,addr ps
mov hdc,eax invoke SelectObject,chdc,hNFOFont
invoke DrawText,chdc,hViewMap,-1,ADDR rScroll, DT_TOP + DT_NOPREFIX + DT_NOCLIP
invoke BitBlt,hdc,220,210,NfoRect.right,NfoRect.bottom,chdc,0,0,SRCCOPY
invoke EndPaint,hWnd,addr ps .elseif uMsg == WM_TIMER
add rScroll.top,GETV(ScrollOffset)
add rScroll.bottom,eax
.if SDWORD PTR rScroll.top >= GETV(rClientNfo.bottom)
mov ScrollOffset,-1
.ELSE
.if SDWORD PTR rScroll.bottom <= GETV(rClientNfo.top)
mov ScrollOffset,1
.endif
.endif invoke InvalidateRect,hWnd,NULL,FALSE .elseif uMsg==WM_CTLCOLORDLG
return hBrush
ret

Could you see what do i wrong?

Thanks for your Help ;)

Regards.

yup, I used the same source and when I messed with this part:

mov hdc,FUNC(GetDC,hWnd)

that exact same thing happened, but it does not seem like you touched that...

May I suggest that you post the whole .exe source next time... since something else is effecting that ...you need to show the whole source

But I can Help you....

here is that original source (in the About):

http://forum.tuts4yo...showtopic=19575

I am not sure if it's this person "Jowy" or not but the above member posted it 3 years ago... and it works like a charm .....

let me know how you make out B)

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.