Hallo,
ich arbeite an GUI Anwendung mit Mono unter Ubuntu und habe folgendes Problem:
ich brauche eine native C++ Function aus einer library.
Diese native Function unter Windows ist im User32.dll und hat folgende Parameter:
BOOL GetScrollInfo(
_In_ HWND hwnd,
_In_ int fnBar,
_Inout_ LPSCROLLINFO lpsi
);
hyperlink - https://msdn.microsoft.com/en-us/library/windows/desktop/bb787583(v=vs.85).aspx
Jetzt möchte ich entsprechende Funktion auch unter Ubuntu haben, damit mein GUI weiterfunktioniert.
// C# Code
public class ExListView : ListView
{
struct SCROLLINFO
{
public uint cbSize;
public uint fMask;
public int nMin;
public int nMax;
public uint nPage;
public int nPos;
public int nTrackPos;
}
private enum SBTYPES
{
SB_HORZ = 0,
SB_VERT = 1,
SB_CTL = 2,
SB_BOTH = 3
}
#if (UX_PLATFORM)
// wie kriege ich äquivalent von Win32 API(core DLLs) unter Linux?
#elif (WINDOWS)
[DllImport("user32.dll")] // unter Windows
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);
#endif
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_VSCROLL)
{
SCROLLINFO scrollinfo = new SCROLLINFO();
scrollinfo.cbSize = (uint)Marshal.SizeOf(typeof(SCROLLINFO));
scrollinfo.fMask = (int)ScrollInfoMask.SIF_ALL;
if (GetScrollInfo(this.Handle, (int)SBTYPES.SB_VERT, ref scrollinfo))
{
min = scrollinfo.nMin;
max = scrollinfo.nMax;
pos = scrollinfo.nPos;
smallchange = 1;
largechange = (int)scrollinfo.nPage;
}
}
base.WndProc(ref m);
}
}
Wie kann man das vermeiden?
Vielen Dank im Vorraus!
Gruß, Beka.