Windows应用程序出现在前时,白屏出现 [英] White screen occurs in windows application while the application comes bring to front

查看:164
本文介绍了Windows应用程序出现在前时,白屏出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在开发Windows应用程序(示例).我正在尝试从另一个应用程序中拉出该应用程序(放在最前面).我使用了以下代码,

Hi All,

I am developing a windows application(Sample). I am trying to pull up the application (bring to front) from another application. I used the following codes,

getProcess = Process.GetProcessesByName("Sample");

if (getProcess.Length > 0)
{
    WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
    app_hwnd = getProcess[0].MainWindowHandle;
    GetWindowPlacement(app_hwnd, ref wp);
    wp.showCmd = 1;
    ShowWindow(app_hwnd, 9);
    SetForegroundWindow(app_hwnd);
}


工作正常.每当单击输入设备按钮时,我就调用了此函数.我每次都重复同样的内容,然后我的
示例"应用程序显示空白屏幕.我该如何解决?我不想显示白屏.

在此先感谢.


It''s working on fine. I called this function, whenever an input device button is clicked. I repeat the same each and every time fast then my
"Sample" application shows a blank white screen. How can I solve this solution? I don''t want to display a white screen.

Thanks in advance.

推荐答案

它似乎并不知道它正在成为焦点.要查看是否是这种情况,请为主窗体的Focus事件添加一个事件处理程序,并使其显示对话框或进行系统日志输入.
It doesn''t seem to know that it''s getting the focus. To see if this is the case, add an event handler for the main form''s Focus event, and have it display a dialog, or make a system log entry.


这篇关于Windows应用程序出现在前时,白屏出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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