In C #, the win32 function GetScrollInfo is used to return false and returns that the reference is zero,

Source: Internet
Author: User

In C #, the win32 function GetScrollInfo is used to return false and returns that the reference is zero,

Recently, a project was created to obtain the position of the ScrollBar, because. net could not find this function, so I had to use the function in MFC. GetScrollPos only returned the position at the top of the listview. At this time, I found GetScrollInfo, and I think this function is very good. If you do not want to find the sample code on the Internet, the function is successfully executed, but false is returned. Check msdn, saying that the information is not obtained. Then, I use GetLastError to view the error message, if 0 is returned, there is no error.

Later, I kept searching for the pinvoke website on the internet. There is a more formal call example called:

Public struct SCROLLINFO
{
Public uint cbSize;
Public uint fMask;
Public int nMin;
Public int nMax;
Public uint nPage;
Public int nPos;
Public int nTrackPos;
}

My error is that the class used in this struct declaration is not struct. After the change, GetScrollInfo returns true, and the struct reference also has a value. I would like to share it with you and hope it will be useful to you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.