Click here to Skip to main content
13,095,921 members (54,249 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello at all,
I have a custom OnScroll event in my ListView.
For this event I use the GetScrollInfo method (user32.dll).
But, when I use rdp client for use my application on the cloud,
I receive this error: 1421 "ERROR CONTROL ID NOT FOUND".

This is the code:
    public uint cbSize;    // set to sizeof (SCROLLINFO)
    public uint fMask;     // values to set or get
    public int nMin;       // minimum range value
    public int nMax;       // maximum range value
    public uint nPage;     // page size
    public int nPos;       // current position
    public int nTrackPos;  // current tracking position

[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);

private ScrollEventType GestisciScroll(ScrollEventType TipoScrollPrefedinito) {
    SCROLLINFO _info = new SCROLLINFO();
    _info.fMask = (uint)SIF_ALL;
    ScrollEventType _typeScroll = TipoScrollPrefedinito;
    if (GetScrollInfo(this.Handle, SB_VERT, ref _info)) {
        if ((_info.nPos + _info.nPage) > _info.nMax)
            _typeScroll = ScrollEventType.Last;
        else if (_info.nPos == 0)
            _typeScroll = ScrollEventType.First;
    } else {
        // ERROR 1421 HERE!
    return _typeScroll;

Can you help me?
Thank you.
Posted 22-May-13 3:42am
Updated 5-Jun-13 0:07am
Sunasara Imdadhusen 5-Jun-13 8:56am
Are you using any third party library?
Dario Michael 7-Jun-13 5:08am
No. Is a normal ListView.
But I use this application in remote desktop.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


I have this working, try it.

private struct ScrollInfoStruct
            public int cbSize;
            public int fMask;
            public int nMin;
            public int nMax;
            public in<b></b>t nPage;
            public int nPos;
            public int nTrackPos;
[DllImport("user32.dll", SetLastError=true) ]
private static extern int GetScrollInfo(IntPtr hWnd, int n, ref ScrollInfoStruct lpScrollInfo );
Dario Michael 21-Nov-13 8:54am
I tried it and it works locally but In RDP doesn't work.
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 29 Aug 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100