当前位置:网站首页>C # introducing WinAPI to pass the character set of Chinese string parameters
C # introducing WinAPI to pass the character set of Chinese string parameters
2022-07-28 02:26:00 【foenix66】
C# introduce WINAPI Pass Chinese string parameter character set problem
C# Can pass DllImport introduce WinAPI. The complete introduction statement contains dll file name ( route ),CharSet Character set ,EntryPoint Function entrance ,SetLastError Whether to set before calling WinAPI function SetLastError value
[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "MessageBox", SetLastError=false)]
public static extern int MyMessageBox(IntPtr hWnd, String text, String caption, uint type);
CharSet The default value is not CharSet.Auto, It is CharSet.Ansi
WinAPI The character set used in the string parameter of the function is in different versions Windows The system is not unified ,XP Previous systems were usually Ansi Character set ,Windows7 and NT System is Unicode Character set . Usually use CharSet.Auto Parameters , It's always right to let the system choose automatically ( But I don't know why the default parameter is not CharSet.Auto), Unless you specify to call AbcW Wide character set or AbcA Function version of narrow character set .
If you don't specify CharSet, System default use CharSet.Ansi, If you pass a Chinese string , The probability is that the call will fail , Or garbled .
边栏推荐
- [Star Project] small hat aircraft War (V)
- 组原必备知识点
- 学会这招再也不怕手误让代码崩掉
- Day6 函数和模块的使用
- MySQL high availability and master-slave synchronization
- A lock faster than read-write lock. Don't get to know it quickly
- Flex development web page instance web side
- Understand the "next big trend" in the encryption industry - ventures Dao
- 小程序毕设作品之微信校园浴室预约小程序毕业设计成品(1)开发概要
- Talk to ye Yanxiu, an atlassian certification expert: where should Chinese users go when atlassian products enter the post server era?
猜你喜欢

C # using ABP warehouse to access the database error record set

Record a production deadlock
![53: Chapter 5: develop admin management service: 6: develop [admin administrator exit login, interface]; (one point: when we want to modify a value with a certain coding method, the new value should b](/img/9a/674308c7a21fa2be0943ca7967e274.png)
53: Chapter 5: develop admin management service: 6: develop [admin administrator exit login, interface]; (one point: when we want to modify a value with a certain coding method, the new value should b

Vxe table/grid cell grouping and merging

APP如何上架App Store?

MySQL高可用和主从同步

MySQL数据库InnoDB存储引擎中的锁机制(荣耀典藏版)

54: Chapter 5: develop admin management services: 7: face warehousing process; Face login process; The browser turns on the video debugging mode (so that the camera can also be turned on in the case o

Promise从入门到精通 (第2章 Promise的理解和使用)

QGIS mapping: vector data mapping process and export
随机推荐
[advanced ROS] Lecture 9 robot model motion based on rviz and arbotix control
Wechat campus bathroom reservation applet graduation design finished product (2) applet function
Wechat campus maintenance and repair applet graduation design finished product of applet completion work (4) opening report
The cooperation between starfish OS and metabell is just the beginning
What problems should be avoided when using BigDecimal type? (glory Collection Edition)
结构伪类选择器—查找单个—查找多个—nth-of-type和伪元素
Promise from getting started to mastering (Chapter 3: customize (handwriting) promise)
[深入研究4G/5G/6G专题-42]: URLLC-14-《3GPP URLLC相关协议、规范、技术原理深度解读》-8-低延时技术-2-基于slot的调度与Slot内灵活的上下行符号配比
[机缘参悟-53]:阳谋立身,阴谋防身
Leetcode hot topic Hot 100 - > 3. longest substring without repeated characters
新零售业态下,零售电商RPA助力重塑增长
重要安排-DX12引擎开发课程后续直播将在B站进行
This operation may not be worth money, but it is worth learning | [batch cutting of pictures]
Principle and implementation of focal loss
How MySQL uses indexes (glory Collection Edition)
Record a production deadlock
Lock mechanism in MySQL database InnoDB storage engine (glory Collection Edition)
[Star Project] small hat aircraft War (V)
Day6 函数和模块的使用
Synchronized details