Click here to Skip to main content
11,928,352 members (50,661 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# .NET C#4.0
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 4:42am
Edited 5-Jun-13 1: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>
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 | Mobile
Web03 | 2.8.151126.1 | Last Updated 29 Aug 2013
Copyright © CodeProject, 1999-2015
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