Give focus to window automatically

Hello,

This has become absolutely frustrating now...

I have a simple win32 app where I create the main window, and a user-input window. Both are created using CreateWindow(), and each has its own window class registered and own procedure. I am purposefully not using a dialog box template in this case. No matter what I do, I absolutely cannot get the input window to take the focus/come to the forefront. It shows up just as it should, but I have to click it manually to get it to receive focus. I have tried everything I could think of (ShowWindow(), UpdateWindow(), BringWindowToTop(), SetFocus(), SetForegroundWindow(), and even tried to simulate a mouse click by sending a WM_MOUSEMOVE message with arbitrary coordinates to the input window). I believe a couple of those functions have more to do with threads, but nonetheless, nothing has worked. Any ideas?
Try SetActiveWindow, but looking at what you've tried, I don't know why it would work.
1) you mentioned threads... is your app multithreaded?

2) did you by any chance make one window a child of the other window when calling CreateWindow?

3) instead of asking you all of the parameters you're passing to CreateWindow, could you post the code segment where you make the calls to CreateWindow?
how do you fetch messages for both the windows, as both has been registered and must be having message loops,,?

if you can post the code that will be easy for us to tell you the exact problem.
Topic archived. No new replies allowed.