本文整理汇总了C#中IntPtr类的典型用法代码示例。如果您正苦于以下问题:C# IntPtr类的具体用法?C# IntPtr怎么用?C# IntPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntPtr类属于命名空间,在下文中一共展示了IntPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Metafile
// Usually called when cloning images that need to have
// not only the handle saved, but also the underlying stream
// (when using MS GDI+ and IStream we must ensure the stream stays alive for all the life of the Image)
internal Metafile (IntPtr ptr, Stream stream)
{
// under Win32 stream is owned by SD/GDI+ code
if (GDIPlus.RunningOnWindows ())
this.stream = stream;
nativeObject = ptr;
}
示例2: CheckEnvironment
static int CheckEnvironment(IntPtr L)
{
LuaScriptMgr.CheckArgsCount(L, 0);
bool o = Util.CheckEnvironment();
LuaScriptMgr.Push(L, o);
return 1;
}
示例3: SetEnabledFading
static public int SetEnabledFading(IntPtr l) {
try {
int argc = LuaDLL.lua_gettop(l);
if(argc==2){
UnityEngine.Cloth self=(UnityEngine.Cloth)checkSelf(l);
System.Boolean a1;
checkType(l,2,out a1);
self.SetEnabledFading(a1);
pushValue(l,true);
return 1;
}
else if(argc==3){
UnityEngine.Cloth self=(UnityEngine.Cloth)checkSelf(l);
System.Boolean a1;
checkType(l,2,out a1);
System.Single a2;
checkType(l,3,out a2);
self.SetEnabledFading(a1,a2);
pushValue(l,true);
return 1;
}
pushValue(l,false);
LuaDLL.lua_pushstring(l,"No matched override function to call");
return 2;
}
catch(Exception e) {
return error(l,e);
}
}
示例4: GetProcessPath
public static string GetProcessPath(IntPtr hwnd)
{
uint pid = 0;
GetWindowThreadProcessId(hwnd, out pid);
Process proc = Process.GetProcessById((int)pid);
return proc.MainModule.FileName.ToString();
}
示例5: AddMatrix
public static int AddMatrix(IntPtr l)
{
try {
int argc = LuaDLL.lua_gettop(l);
if(matchType(l,argc,2,typeof(int),typeof(UnityEngine.Matrix4x4))){
UnityEngine.MaterialPropertyBlock self=(UnityEngine.MaterialPropertyBlock)checkSelf(l);
System.Int32 a1;
checkType(l,2,out a1);
UnityEngine.Matrix4x4 a2;
checkValueType(l,3,out a2);
self.AddMatrix(a1,a2);
pushValue(l,true);
return 1;
}
else if(matchType(l,argc,2,typeof(string),typeof(UnityEngine.Matrix4x4))){
UnityEngine.MaterialPropertyBlock self=(UnityEngine.MaterialPropertyBlock)checkSelf(l);
System.String a1;
checkType(l,2,out a1);
UnityEngine.Matrix4x4 a2;
checkValueType(l,3,out a2);
self.AddMatrix(a1,a2);
pushValue(l,true);
return 1;
}
pushValue(l,false);
LuaDLL.lua_pushstring(l,"No matched override function to call");
return 2;
}
catch(Exception e) {
return error(l,e);
}
}
示例6: AddChild
static int AddChild(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 1)
{
GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 1, typeof(GameObject));
GameObject o = NGUITools.AddChild(arg0);
LuaScriptMgr.Push(L, o);
return 1;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(GameObject)))
{
GameObject arg0 = (GameObject)LuaScriptMgr.GetLuaObject(L, 1);
GameObject arg1 = (GameObject)LuaScriptMgr.GetLuaObject(L, 2);
GameObject o = NGUITools.AddChild(arg0,arg1);
LuaScriptMgr.Push(L, o);
return 1;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(bool)))
{
GameObject arg0 = (GameObject)LuaScriptMgr.GetLuaObject(L, 1);
bool arg1 = LuaDLL.lua_toboolean(L, 2);
GameObject o = NGUITools.AddChild(arg0,arg1);
LuaScriptMgr.Push(L, o);
return 1;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: NGUITools.AddChild");
}
return 0;
}
示例7: LsaLookupSids
internal static extern uint LsaLookupSids(
SafeLsaPolicyHandle handle,
int count,
IntPtr[] sids,
ref SafeLsaMemoryHandle referencedDomains,
ref SafeLsaMemoryHandle names
);
示例8: OpenCounter
// The app name should either be a valid app name or be 'null' to get the state service
// counters initialized
private static void OpenCounter(string appName) {
try {
// Don't activate perf counters if webengine.dll isn't loaded
if (! HttpRuntime.IsEngineLoaded)
return;
// Open the global counters
if (_global == IntPtr.Zero) {
_global = UnsafeNativeMethods.PerfOpenGlobalCounters();
}
// If appName is null, then we want the state counters
if (appName == null) {
if (_stateService == IntPtr.Zero) {
_stateService = UnsafeNativeMethods.PerfOpenStateCounters();
}
}
else {
if (appName != null) {
_instance = UnsafeNativeMethods.PerfOpenAppCounters(appName);
}
}
}
catch (Exception e) {
Debug.Trace("Perfcounters", "Exception: " + e.StackTrace);
}
}
示例9: reg
static public void reg(IntPtr l) {
getEnumTable(l,"UnityEngine.ColorSpace");
addMember(l,0,"Gamma");
addMember(l,1,"Linear");
addMember(l,-1,"Uninitialized");
LuaDLL.lua_pop(l, 1);
}
示例10: reg
public static void reg(IntPtr l)
{
getTypeTable(l,"UnityEngine.AvatarBuilder");
addMember(l,BuildHumanAvatar_s);
addMember(l,BuildGenericAvatar_s);
createTypeMetatable(l,constructor, typeof(UnityEngine.AvatarBuilder));
}
示例11: reg
public static void reg(IntPtr l)
{
getTypeTable(l,"UnityEngine.AudioHighPassFilter");
addMember(l,"cutoffFrequency",get_cutoffFrequency,set_cutoffFrequency,true);
addMember(l,"highpassResonanceQ",get_highpassResonanceQ,set_highpassResonanceQ,true);
createTypeMetatable(l,constructor, typeof(UnityEngine.AudioHighPassFilter),typeof(UnityEngine.Behaviour));
}
示例12: reg
static public void reg(IntPtr l) {
getEnumTable(l,"UnityEngine.BlendWeights");
addMember(l,1,"OneBone");
addMember(l,2,"TwoBones");
addMember(l,4,"FourBones");
LuaDLL.lua_pop(l, 1);
}
示例13: IntToEnum
static int IntToEnum(IntPtr L)
{
int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
OffMeshLinkType o = (OffMeshLinkType)arg0;
LuaScriptMgr.Push(L, o);
return 1;
}
示例14: reg
public static void reg(IntPtr l)
{
getEnumTable(l,"UnityEngine.Experimental.Director.PlayState");
addMember(l,0,"Paused");
addMember(l,1,"Playing");
LuaDLL.lua_pop(l, 1);
}
示例15: SendFileToPrinter
public static bool SendFileToPrinter( string szPrinterName, string szFileName )
{
// Open the file.
FileStream fs = new FileStream(szFileName, FileMode.Open);
// Create a BinaryReader on the file.
BinaryReader br = new BinaryReader(fs);
// Dim an array of bytes big enough to hold the file's contents.
Byte []bytes = new Byte[fs.Length];
bool bSuccess = false;
// Your unmanaged pointer.
IntPtr pUnmanagedBytes = new IntPtr(0);
int nLength;
nLength = Convert.ToInt32(fs.Length);
// Read the contents of the file into the array.
bytes = br.ReadBytes( nLength );
// Allocate some unmanaged memory for those bytes.
pUnmanagedBytes = Marshal.AllocCoTaskMem(nLength);
// Copy the managed byte array into the unmanaged array.
Marshal.Copy(bytes, 0, pUnmanagedBytes, nLength);
// Send the unmanaged bytes to the printer.
bSuccess = SendBytesToPrinter(szPrinterName, pUnmanagedBytes, nLength);
// Free the unmanaged memory that you allocated earlier.
Marshal.FreeCoTaskMem(pUnmanagedBytes);
return bSuccess;
}