Click here to Skip to main content
15,904,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 5-Dec-10 23:33pm
v3
Comments
#realJSOP 6-Dec-10 7:52am    
Just because something that is suggested doesn't work, do NOT vote it a 1. You don't vote a 1 on a response that is an honest attempt at helping you. I suggest that you change your vote.

1 solution

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.
 
Share this answer
 
Comments
damubooks 6-Dec-10 5:52am    
Hi,
Thanks for your quick response. I am sure this is not any focus error. I tried that one but I didn't get any errors.I am sure this is happened while the application repaint or rendering controls each and every time while the application is coming to front. I did the same with some other application but I am not getting this issue. In my application there are many controls and background images are applied. So I am getting this issue with my application only.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900