与部分窗口标题FindWindow函数(在Windows,C) [英] FindWindow with partial window title (Windows, C)

查看:525
本文介绍了与部分窗口标题FindWindow函数(在Windows,C)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有API类似于FindWindow函数(),但通过偏题搜索窗口?
其原因是,我需要手柄具有在标题而是不断其它部分变化的修复部分的一个窗口。
因此,例如窗口标题可以是:

Is there any API similar to FindWindow() but that searches the windows by partial title? The reason is that I need to the handle to a window that has a fix part on the title but the other part changes constantly. So for example the window title could be:

数据库中读取:XYDB

DataBase read: XYDB

数据库中读取:WZDB

DataBase read: WZDB

在例子中的修复部分是数据库中读取:

in the examples the fix part is "DataBase read:"

code AP preciated。
谢谢

Code appreciated. Thanks

推荐答案

使用EnumWindows的一个例子:

An example using EnumWindows:

BOOL CALLBACK WorkerProc(HWND hwnd, LPARAM lParam) {
    static TCHAR buffer[50];

    GetWindowText(hwnd, buffer, 50);
    if(_tcsstr(buffer, "window name goes here")) {
        // do something with hwnd here
        return FALSE;
    }

    return TRUE;
}

然后调用它是这样的:

And then call it like this:

EnumWindows(WorkerProc, NULL);

这篇关于与部分窗口标题FindWindow函数(在Windows,C)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆