我正在使用以下代码:
const int GWL_STYLE = (-16);
const UInt32 WS_POPUP = 0x80000000;
const UInt32 WS_CHILD = 0x40000000;
[DllImport("user32.dll", SetLastError = true)]
static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong);
Run Code Online (Sandbox Code Playgroud)
在某个地方......
SetWindowLong(this.Handle, GWL_STYLE,
((GetWindowLong(this.Handle, GWL_STYLE) & ~(WS_POPUP)) | WS_CHILD));
Run Code Online (Sandbox Code Playgroud)
这会在32位和64位机器上正常运行吗?
如果没有,如果我编译我的应用程序作为x86进程运行,它仍然可以在64位计算机上正常工作吗?
如何在32位和64位计算机上重写以下代码?
我在我的程序中使用以下函数:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr GetParent(IntPtr hWnd);
Run Code Online (Sandbox Code Playgroud)
我的问题是:这种方法安全稳定吗?我的开发机器是Windows XP,到目前为止我没有发现它的使用有任何问题.我想知道我是否可以在不同的版本(例如Windows Vista,Windows 7,等等),不同的cpus(x64)等中遇到问题.你们可以就此提供一些反馈吗?如果有一些潜在的问题我怎样才能克服它们?
提前致谢.
朱波罗卡