本文整理汇总了C#中System.Runtime.InteropServices.HandleRef类的典型用法代码示例。如果您正苦于以下问题:C# HandleRef类的具体用法?C# HandleRef怎么用?C# HandleRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HandleRef类属于System.Runtime.InteropServices命名空间,在下文中一共展示了HandleRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetWindowLongPtr
// This static method is required because legacy OSes do not support
// SetWindowLongPtr
internal static IntPtr SetWindowLongPtr(HandleRef hWnd, int nIndex, IntPtr dwNewLong)
{
if (IntPtr.Size == 8)
return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
else
return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
}
示例2: CompilationMutex
internal CompilationMutex(String name, String comment) {
#if !FEATURE_PAL // No unmanaged aspnet_isapi mutex in Coriolis
// Attempt to get the mutex string from the registry (VSWhidbey 415795)
string mutexRandomName = (string) Misc.GetAspNetRegValue("CompilationMutexName",
null /*valueName*/, null /*defaultValue*/);
if (mutexRandomName != null) {
// If we were able to use the registry value, use it. Also, we need to prepend "Global\"
// to the mutex name, to make sure it can be shared between a terminal server session
// and IIS (VSWhidbey 307523).
_name += @"Global\" + name + "-" + mutexRandomName;
}
else {
// If we couldn't get the reg value, don't use it, and prepend "Local\" to the mutex
// name to make it local to the session (and hence prevent hijacking)
_name += @"Local\" + name;
}
_comment = comment;
Debug.Trace("Mutex", "Creating Mutex " + MutexDebugName);
_mutexHandle = new HandleRef(this, UnsafeNativeMethods.InstrumentedMutexCreate(_name));
if (_mutexHandle.Handle == IntPtr.Zero) {
Debug.Trace("Mutex", "Failed to create Mutex " + MutexDebugName);
throw new InvalidOperationException(SR.GetString(SR.CompilationMutex_Create));
}
Debug.Trace("Mutex", "Successfully created Mutex " + MutexDebugName);
#endif // !FEATURE_PAL
}
示例3: SetWindowLong
public static IntPtr SetWindowLong(HandleRef hwnd, Win32Native.WindowLongType index, IntPtr wndProcPtr)
{
if (IntPtr.Size == 4)
return Win32Native.SetWindowLong32(hwnd, index, wndProcPtr);
else
return Win32Native.SetWindowLongPtr64(hwnd, index, wndProcPtr);
}
示例4: Profile
public Profile(string path)
{
Handle = new HandleRef (this, NativeMethods.CmsOpenProfileFromFile (path, "r"));
if (Handle.Handle == IntPtr.Zero)
throw new CmsException ("Error opening ICC profile in file " + path);
}
示例5: BuildWindowCore
protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
DestroyHost();
_host = new WinFormsAvaloniaControlHost {Content = _content};
UnmanagedMethods.SetParent(_host.Handle, hwndParent.Handle);
return new HandleRef(this, _host.Handle);
}
示例6: Client
//private static readonly int CDINDEX_ID_LEN = 28;
//private static readonly int ID_LEN = 36;
public Client()
{
handle = new HandleRef(this, mb_New());
UseUtf8 = true;
AutoSetProxy();
}
示例7: Unregister
internal static void Unregister(HandleRef unmanaged)
{
lock (Instance)
{
Instance.UnregisterImpl(unmanaged.Handle);
}
}
示例8: SnapshotManager_Open
internal static extern void SnapshotManager_Open(
HandleRef self,
/* from(DataSource_t) */ Types.DataSource data_source,
/* from(char const *) */ string file_name,
/* from(SnapshotConflictPolicy_t) */ Types.SnapshotConflictPolicy conflict_policy,
/* from(SnapshotManager_OpenCallback_t) */ OpenCallback callback,
/* from(void *) */ IntPtr callback_arg);
示例9: DrawPie
/// Drawing methods.
/// <devdoc>
/// </devdoc>
public void DrawPie(WindowsPen pen, Rectangle bounds, float startAngle, float sweepAngle)
{
HandleRef hdc = new HandleRef( this.dc, this.dc.Hdc);
if( pen != null )
{
// 1. Select the pen in the DC
IntUnsafeNativeMethods.SelectObject(hdc, new HandleRef(pen, pen.HPen));
}
// 2. call the functions
// we first draw a path that goes :
// from center of pie, draw arc (this draw the line to the beginning of the arc
// then, draw the closing line.
// paint the path with the pen
int sideLength = Math.Min(bounds.Width, bounds.Height);
Point p = new Point(bounds.X+sideLength/2, bounds.Y+sideLength/2);
int radius = sideLength/2;
IntUnsafeNativeMethods.BeginPath(hdc);
IntUnsafeNativeMethods.MoveToEx(hdc, p.X, p.Y, null);
IntUnsafeNativeMethods.AngleArc(hdc, p.X, p.Y, radius, startAngle, sweepAngle);
IntUnsafeNativeMethods.LineTo(hdc, p.X, p.Y);
IntUnsafeNativeMethods.EndPath(hdc);
IntUnsafeNativeMethods.StrokePath(hdc);
}
示例10: SHGetFolderLocation
public static extern int SHGetFolderLocation(
HandleRef hwndOwner,
int nFolder,
IntPtr hToken,
int dwReserved,
out IntPtr ppidl
);
示例11: RazorBitmapFormAntiparents
public RazorBitmapFormAntiparents()
{
InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer, false);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, true);
SimpleParticlesWorld.Size = this.ClientSize;
this.task = Task.Factory.StartNew(() =>
{
using (Graphics graphics = this.CreateGraphics())
{
IntPtr hdc = IntPtr.Zero;
try
{
hdc = graphics.GetHdc();
HandleRef handleRef = new HandleRef(graphics, hdc);
while (!this.IsTerminate)
{
this.commonStopwatch.Restart();
this.updateStopwatch.Restart();
SimpleParticlesWorld.Update();
this.updateTime = this.updateStopwatch.ElapsedMilliseconds;
this.renderStopwatch.Restart();
Array.Clear(this.array, 0, this.array.Length);
SimpleParticle particle;
int pointBase;
for (int i = SimpleParticlesWorld.Particles.Count - 1; i >= 0; --i)
{
particle = SimpleParticlesWorld.Particles[i];
//foreach (SimpleParticle particle in SimpleParticlesWorld.Particles)
//{
pointBase = (this.size.Height - (int)particle.y) * this.size.Width + (int)particle.x;
if (0 <= pointBase && pointBase < this.array.Length)
{
this.array[pointBase] = particle.c;
}
}
SetDIBitsToDevice(handleRef, 0, 0, this.size.Width, this.size.Height, 0, 0, 0, this.size.Height, ref this.array[0], ref this.bitmapInfo, 0);
this.renderTime = this.renderStopwatch.ElapsedMilliseconds;
this.commonTime = this.commonStopwatch.ElapsedMilliseconds;
}
}
finally
{
if (hdc != IntPtr.Zero)
{
graphics.ReleaseHdc(hdc);
}
}
}
});
}
示例12: BuildWindowCore
/// <summary>
/// コントロール作成
/// </summary>
/// <param name="hwndParent">親ウィンドウ</param>
/// <returns>
/// 作成されたコントロールの HandleRef
/// </returns>
protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
Dispatcher.ShutdownStarted += DispatcherOnShutdownStarted;
return new HandleRef(this,
_wnd.CreateWindow(hwndParent.Handle)
);
}
示例13: BuildWindowCore
protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
// Let our base class create the standard window. We will simply
// use it as the parent of our HwndSource.
// HandleRef hwndChild = base.BuildWindowCore(hwndParent);
HwndSourceParameters? optCreationParameters = CreationParameters;
if (_thread != null)
{
// Asynchronously create the HwndSource on the worker thread.
_thread.Dispatcher.BeginInvoke((Action)delegate
{
_hwndSource = CreateHwndSource(optCreationParameters, hwndParent.Handle);
});
}
else
{
// Synchronously create the HwndSource on the UI thread.
_hwndSource = CreateHwndSource(optCreationParameters, hwndParent.Handle);
}
UpdateRootVisual(Source);
return new HandleRef(this,_hwndSource.Handle);
}
示例14: BuildWindowCore
protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
HwndListBox = IntPtr.Zero;
_hwndHost = IntPtr.Zero;
_hwndHost = CreateWindowEx(0, "static", "",
WsChild | WsVisible,
0, 0,
_hostHeight, _hostWidth,
hwndParent.Handle,
(IntPtr) HostId,
IntPtr.Zero,
0);
HwndListBox = CreateWindowEx(0, "listbox", "",
WsChild | WsVisible | LbsNotify
| WsVscroll | WsBorder,
0, 0,
_hostHeight, _hostWidth,
_hwndHost,
(IntPtr) ListboxId,
IntPtr.Zero,
0);
return new HandleRef(this, _hwndHost);
}
示例15: RealTimeMultiplayerManager_SendUnreliableMessage
internal static extern void RealTimeMultiplayerManager_SendUnreliableMessage(
HandleRef self,
/* from(RealTimeRoom_t) */IntPtr room,
/* from(MultiplayerParticipant_t const *) */IntPtr[] participants,
/* from(size_t) */UIntPtr participants_size,
/* from(uint8_t const *) */byte[] data,
/* from(size_t) */UIntPtr data_size);