要求是在当前桌面上打开所有窗口。我试图从 node-ffi 调用 EnumWindows,它给出的处理程序长度为 0。
节点参考链接:node-ffi模块
我的代码片段:
/**
@Name :Parthasarathy Balakrishnan
@Version : V0.1
@Date : 18/03/2013 */
var ffi = require('ffi'),
ref = require('ref'),
int = ref.types.int,
assert = require('assert'),
bindings = require('bindings'),
buffer = require('buffer')
var user32,Kernel32;
var lpEnumFunc;
var invokeCount=0;
/**EnumWindows API CALL
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc,_In_ LPARAM lParam);
Parameters
lpEnumFunc [in]
Type: WNDENUMPROC
A pointer to an application-defined callback function. For more information, see EnumWindowsProc.
lParam [in]
Type: LPARAM
An application-defined value to be …Run Code Online (Sandbox Code Playgroud) 我需要能够在Windows机器上列出所有活动的应用程序.我一直在使用这段代码......
Process[] procs = Process.GetProcesses(".");
foreach (Process proc in procs)
{
if (proc.MainWindowTitle.Length > 0)
{
toolStripComboBox_StartSharingProcessWindow.Items.Add(proc.MainWindowTitle);
}
}
Run Code Online (Sandbox Code Playgroud)
直到我意识到当在他们自己的窗口中打开多个文件时,这不会列出像WORD或ACROREAD这样的情况.在那种情况下,使用上述技术仅列出最顶层的窗口.我假设这是因为即使打开了两个(或更多)文件,也只有一个进程.所以,我想我的问题是:如何列出所有窗口而不是其底层进程?