gpt4 book ai didi

c#BeginUpdateResource 收藏

转载 作者:行者123 更新时间:2023-11-30 16:29:48 25 4
gpt4 key购买 nike

我想以编程方式将字符串资源添加到可执行文件。仅出于示例目的,假设我正在尝试添加一个名为“String SO”的字符串,它包含“stringVal”的值

如果这对任何人有帮助 - 如果我要通过 VS.net 执行此操作,我只需右键单击我的项目 => 资源 => 添加新字符串资源等。

我正在使用以下 Win32 API:

[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr BeginUpdateResource(string pFileName,
[MarshalAs(UnmanagedType.Bool)]bool bDeleteExistingResources);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool UpdateResource(IntPtr hUpdate, uint lpType, uint lpName, ushort wLanguage, byte[] lpData, uint cbData);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool EndUpdateResource(IntPtr hUpdate, bool fDiscard);

所以,我在网上找到了几个页面,但似乎没有一个对我正在尝试做的事情有帮助。如果你们中的任何人能够找到任何东西,我将不胜感激。

否则,我将不胜感激任何可能有帮助的片段。谢谢你,埃文

最佳答案

github 上有一个非常有用的用于许多资源任务的库 .

许多类和函数确实将这些窗口 API 调用包装在 UpdateResource(...) 等周围

希望对您有所帮助。

关于c#BeginUpdateResource 收藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6111981/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com