Click here to Skip to main content
Rate this: bad
good
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:
struct SCROLLINFO {
    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
}
[DllImport("user32.dll")]
[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 {
        System.Diagnostics.Trace.WriteLine(Marshal.GetLastWin32Error());      
        // ERROR 1421 HERE!
    }
    return _typeScroll;
}
 
Can you help me?
Thank you.
Posted 22-May-13 4:42am
Edited 5-Jun-13 1:07am
v4
Comments
Sunasara Imdadhusen at 5-Jun-13 8:56am
   
Are you using any third party library?
Dario Michael at 7-Jun-13 5:08am
   
No. Is a normal ListView.
But I use this application in remote desktop.

1 solution

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

Solution 1

Hi,
 
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 );
  Permalink  
Comments
Dario Michael at 21-Nov-13 8:54am
   
Hi,
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
0 Maciej Los 205
1 Richard MacCutchan 185
2 DamithSL 170
3 Tomas Takac 146
4 OriginalGriff 132
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 29 Aug 2013
Copyright © CodeProject, 1999-2014
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