我基本上有启动键盘的代码,但它以字母数字部分打开,编辑框是带数字的NumericUpDown.因此,我想打开tabtip.exe,即在Windows 8.1中使用numerpad聚焦的屏幕键盘.这是我当前打开tabtip的代码,但默认情况下它也不会使用numpad打开:
using System.Runtime.InteropServices; //added for keyboard closure
using System.Windows.Interop; //Keyboard closure - must add reference for WindowsBase
//Added for keyboard closure
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
public static extern bool PostMessage(int hWnd, uint Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(String sClassName, String sAppName);
//open keyboard
void openKeyboard()
{
ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(startInfo);
}
//close keyboard
void closeKeyboard()
{
uint WM_SYSCOMMAND = 274;
uint SC_CLOSE = 61536; …Run Code Online (Sandbox Code Playgroud) 我在使用if语句来检测我的numericupdown对象是否是一个字符串时遇到了一些麻烦,因此我不使用十进制变量来调整它.我看到有一种类型的命令,但我在使用它时遇到了麻烦.以下是我要看的内容:
if(typeof sentNUD.Value == string)
{
//Do string arguments here
}
else
{
//do decimal arguments here
}
Run Code Online (Sandbox Code Playgroud)
if语句的语法虽然错误但我收到错误.如何正确设置if语句?我尝试了一下,但我无法理解如何正确地做到这一点.谢谢.
我正在为两个不同的人创建一个项目,我想通过define更改图标。例如:
#if customer1
//add code to select c:\path to resources\myimage1.ico for exe icon
#else
//add code to select c:\path to resources\myimage2.ico for exe icon
#endif
Run Code Online (Sandbox Code Playgroud)
我知道您可以在此处手动选择所需的图标:
https://msdn.microsoft.com/zh-CN/library/339stzf7.aspx
但是使用git定义方式对我们来说很有意义,因此我们不必继续重新上传别人的图像。我们可以简单地将定义放到其中并使用该图像。谢谢。
我正在查看一些带有指针的东西,它就像一个缓冲区,用于存储数组大小约为 800 的数据。它在各种索引处循环并按顺序放置数据集。
假设我们有 1001 和一个空格,然后是 0110,它将用“1001 0110 1001 0110 1001”填充缓冲区,依此类推...
所以我想要做的是找到它当前所在的索引并将其从“1001 0110”更改为“0101 0110 0101 0110”之类的内容。
所以,基本上我想找到缓冲区的索引并在它进入其输出例程之前更改里面的数据。
这是我正在看的东西:
char *p1;
char p2[800];
int setIndex = 0;
if (p1 >= &p2[p2_length - 1]) p1 = &p2[0];
else ++p1;
Run Code Online (Sandbox Code Playgroud)
为了更改 p2 所在位置的值,我应该将“setIndex”设置为什么?例如:p2[setIndex],setIndex 是什么?我是否只是将 setIndex 设置为指针地址值或该地址处的值?我有点困惑。谢谢你。
编辑:
感谢 Barmar,这个答案对我有用。
setIndex = p1 - p2;
p2[setIndex] = '1'; //or whatever value you want to change to
Run Code Online (Sandbox Code Playgroud)