CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2001
    Location
    PA
    Posts
    150

    Still not working

    Hello,

    Here is the API function am using. It will move the Grid scroll bar (thumb) but not the contents of the Grid.

    Public Declare Function SetScrollPos Lib "user32" (ByVal hwnd As Long, ByVal nBar As Long, ByVal nPos As Long, ByVal bRedraw As Long) As Long
    **************************************
    Private Sub Command1_Click()
    Dim x As Long, y As Long, z As Long
    y = Grid1.hwnd
    x = 50
    z = SetScrollPos(y, 1, x, 1)

    End Sub
    ***************************************

    Thanks
    Hisham
    Thank You, Hisham

  2. #2
    Join Date
    Jun 2001
    Location
    Northeast Tennessee
    Posts
    15

    Re: Still not working

    that's because what you are doing is just setting the position of the scrollbar, which causes nothing to happen but the scrollbar to move. what you are probably wanting to happen is the events associated with moving a scrollbar which is the scroll event. you will need to use the SendMessage API function with appropriate parameters to send the grid a scroll message. the entire grid should then scroll.

    hope it helps.

    -obiwan


  3. #3
    Join Date
    Aug 2001
    Location
    PA
    Posts
    150

    Re: Still not working

    Could you please tell me what proper message I can send to a flexgrid scroll bar?

    I really appreciate your responses.

    Thanks
    Hisham
    Thank You, Hisham

  4. #4
    Join Date
    Jun 2001
    Location
    Northeast Tennessee
    Posts
    15

    Re: Still not working

    the flexgrid control is an ActiveX control, and i've found its underlying messages aren't documented. you might be able to figure out what message is being sent by subclassing the control or placing a call to the GetMessage API function inside the scroll event of the flexgrid control.

    that's a lot of work. might i ask why you're trying to force the grid to scroll ?

    -obiwan


  5. #5
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Still not working

    Using the window message investifgation tool I posted on palnet source code two days ago I have discovered that if you send a WM_VSCROLL message to an MSFlexGrid control it moves the scrollbar and contents.


    private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, lParam as Long) as Long


    private Const WM_VSCROLL = &h115

    'to scroll a grid upwards, wParam is 0
    public Sub ScrollGridUp(byval fg as MSFlexGrid)

    Dim lRet as Long

    lRet = SendMessage(fg.hwnd, WM_VSCROLL,0,0)

    End Sub


    'to scroll a grid down, wParam is 1
    public Sub ScrollGridDown(byval fg as MSFlexGrid)

    Dim lRet as Long

    lRet = SendMessage(fg.hwnd, WM_VSCROLL,1,0)

    End Sub




    Hope this helps,
    Duncan


    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  6. #6
    Join Date
    Jun 2001
    Location
    Northeast Tennessee
    Posts
    15

    Re: Still not working

    thx a lot for this post. gonna go grab ur tool

    -obiwan


  7. #7
    Join Date
    Aug 2001
    Location
    PA
    Posts
    150

    Re: Still not working

    Thank you very much. That's what I was looking for. Thank you again.

    Thanks
    Hisham
    Thank You, Hisham

  8. #8
    Join Date
    Aug 2001
    Location
    PA
    Posts
    150

    Re: Still not working

    Thak you, that worked.

    Thanks
    Hisham
    Thank You, Hisham

  9. #9
    Join Date
    Jun 2001
    Location
    Northeast Tennessee
    Posts
    15

    Re: Still not working

    i forgot ... we could have used Microsoft Spy++


  10. #10
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Still not working

    Yes - spy allows you to watch messages, but the tool posted on PSC (I would post it here if there was a method of doing so) also allows you to send the message to watch its effect.

    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured