[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Windows Focus problems

Posted on 2006-07-03
6
Medium Priority
?
341 Views
Last Modified: 2012-06-21
Dear experts,

I'm developing a Delphi application and I have a lot of problems when I show forms. Let me explain:

My aplication initially have 2 forms, all of them hided: the main is hided by Application.ShowMainForm, and the second setting visible to False. The goal of this application is to help ANOTHER application: for example: when the other app needs to show a dialog to open a file, via tcpip contacts my app and is my app who shows the form. Ok, the application is working well, but I have a lot a problems setting the focus on the forms: For example, first time a form is showed all works well, the form is showed as the active form, but subsequent calls, don't show the form (I have to use ALT-TAB to see it), or sometimes the form is showed blinking on the taskbar.

On mainform I'm using a component to put my app on the system tray, and on form create I use

SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
ShowWindow(Application.Handle, SW_HIDE);

to make sure that no forms are showed on the task bar.

So, my first question is: How to put a form as active form ALLWAYS and this have the focus so the user things that this form is from other app? I used some APIs like SetWindowForeground or setWindowActive ... but more APIS or things I try, more nightmare comes.

Other question is: how to activate an application as the taskbar does?

Thanks in advance.
0
Comment
Question by:david-marti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:flasht
ID: 17031271
ShowWindow(FormHandle,SW_Normal) ;
0
 
LVL 3

Expert Comment

by:flasht
ID: 17031295
Dont really understand what the problem is... maybe set your form as a child of that application?
Windows.SetParent();
0
 

Author Comment

by:david-marti
ID: 17031667
Ok, I agree that my explanation is awfull, but after a deep review of my application I solved the problem setting Windows.SetForegroundWindow(application.Handle) before showing the form.

Thanks to all that answer the question.
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 17033479
try also SetActiveWindow with parameter Form1.Handle after showing the form...
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18288997
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question