get string from win32 dll in .NET
来源:互联网 发布:ubuntu系统无法上网 编辑:程序博客网 时间:2024/05/17 03:41
using System;
using System.Runtime.InteropServices;
[DllImport("kernel32")]
publicstaticexternIntPtr LoadLibrary(string lpFileName);
[DllImport("kernel32")]
publicstaticexternBoolean FreeLibrary(IntPtr hResModule);
[DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "LoadStringW", ExactSpelling = true)]
publicstaticexternint LoadString(
IntPtr hInstance,
uint uID,
StringBuilder lpBuffer,
int nBufferMax);
publicstaticString GetStringResource(IntPtr hModuleInstance, uint uiStringID)
{
StringBuilder sb = newStringBuilder(255);
LoadString(hModuleInstance, uiStringID, sb, sb.Capacity + 1);
return sb.ToString();
}
public staticstring GetWin32Resource(string componentName, uint uiResourceId)
{
string str = string.Empty;
IntPtr hMod = LoadLibrary(@"***\test.dll");
if (hMod !=null)
{
str = GetStringResource(hMod, uiResourceId);
FreeLibrary(hMod);
}
return str;
}
- get string from win32 dll in .NET
- get string from assemble in .NET
- Get number from string with regular expression in java
- How to get file extension from string in C++
- Get All IE Info from win32 api
- get number from the string
- 续:Java Tomcat 中调用.net DLL的方法 -- Can't get object clsid from progid
- How to get rid of `deprecated conversion from string constant to 'char*'` warnings in GCC?
- How to get array from string contained identical symbols in Ruby?
- How to get array from string contained identical symbols in Ruby?
- How can I get a String from HID device in Python with evdev?
- Get Each Word from a string
- Get Property Name (string) from MemberExpression
- Win32程序如何调用.net DLL
- Execute a function in any Win32 DLL - Reflection in Win32 DLL?
- win32 string to LPCWSTR in C++ (Unicode)
- Get Dataset from Stored Procedure in Oracle
- [asp.net] Get variables from POST and GET request
- 3Dmax导出动画文件
- 【转】Qt串口通信专题教程
- feature (1)定义和作用
- SharePoint 2010 中如何彻底删除用户
- 在红帽RHEL5上安装OpenNebula-2.0.1
- get string from win32 dll in .NET
- 判断一棵树是否是BST
- 18---java中泛型01(了解泛型)
- COM组件三个最基本的接口类
- 网络--面试题目整理(一)
- 线段求交算法demo
- Linux init详解
- Redis系统性介绍
- Rational Rose生成图片格式