Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ICQ floating contacts..Top-Most Forms?

Posted on 1999-10-17
20
Medium Priority
?
252 Views
Last Modified: 2011-09-20
How does ICQ handle the "Floating Contacts" when you drag a contact outside the ICQ GUI itself?...is each contact a new form which is set as Top Most?...

How can I have MANY top-most forms from a single application?

Thank you,

Nadia
0
Comment
Question by:peimbert
[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
  • 8
  • 4
  • 3
  • +4
20 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 1400 total points
ID: 2133230
Hi Nadia,

they have the following flags set:
 WS_POPUP
 WS_VISIBLE
 WS_CLIPSIBLINGS
 WS_BORDER
 WS_SYSMENU
 WS_MINIMIZEBOX
(WS_EX_TOPMOST )

i did a test an it seems to work for instance if you have 3 forms ,one main(form1) and 2 small forms..

on each of form2 and form 3 formcreate event do:

var
wnd:thandle ;
begin
wnd:=form3.handle;
setwindowpos(wnd,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);

and on form1 (maybe a buttonclick or whatever event) do
form1.show;
form2.show;


hope that helps
Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2133232
sorry on form2
wnd:=form2.handle;
 
or better still save some code and just do
setwindowpos(form2,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);

im sure you know what i mean ;-)
0
 
LVL 17

Expert Comment

by:inthe
ID: 2133236
btw
if you need any cool dragdrop compoent check out:

http://www.melander.dk/delphi/dragdrop/
they have some good ones..
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:inthe
ID: 2133237
btw
if you need any cool dragdrop components check out:

http://www.melander.dk/delphi/dragdrop/
they have some good ones..
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2133294
I think you nailed that one Barry ;-)
0
 

Author Comment

by:peimbert
ID: 2133750
Hi Barry,

Somehow it doesn't seem to be working!!
Do you have any extra parameters set on the form's configuration?.....

What do I do if I want to create dynamical forms...i.e. tform.create(nil) .... ???

Are you sure it's Form2.Handle ???.....the only one that *Kind of* worked was Form2.WindowHandle ...

thank you,

Nadia
0
 
LVL 17

Expert Comment

by:inthe
ID: 2133868
no i created 3 standard forms in delphi(4) and added the code and it worked ok.
if you want i'll make an example and mail to you to try and see if it works ok.
when you want to create the forms dynamically will they have been already designed in delphi ide ?
0
 
LVL 6

Expert Comment

by:edey
ID: 2133911
Note that topmost forms in delphi don't tend to stay topmost unless, in your application.onDeactivate you put:

application.restoreTopMosts;

Anyway, hope it works out for you.  If it doesn't, I have written an app (a post-it note sort of thing) that can display many topmost windows (also handles some neat stuff with WM_NCHITTEST)

GL
Mike
0
 

Author Comment

by:peimbert
ID: 2133929
Hi inthe, I know what my problem is!

The solution you post is valid while the main form is active or top most.

What happens if I want to hide my main form and keep the other ones set to top most ?

P.S.  I got the dynamically created forms working now :)
0
 

Author Comment

by:peimbert
ID: 2133937
Why is it that when I set my main form to top most, and then I hide it with visible := false all of the top most forms become "normal" forms again...i.e. they don't keep their top most property active anymore?

thanks a lot,

nadia
0
 
LVL 17

Expert Comment

by:inthe
ID: 2133949
what swp_()  flags are you setting when using setwindowpos ?
something like swp_noownerzorder may help or :
you can override the CreateParams procedure for any child forms you want to make independent of the main form:

procedure CreateParams(var Params : TCreateParams); override;

var
  Form2: TForm2;

implementation


procedure TForm2.CreateParams(var Params : TCreateParams);
begin
  inherited CreateParams(Params);
  Params.WndParent := GetDesktopWindow;
end;

and call showwindow(form2.handle,sw_hide); on form create to hide from taskbar..
0
 
LVL 17

Expert Comment

by:inthe
ID: 2133969
my main form is like this (form create not dynamic for simplicity sake):

implementation

uses Unit2, Unit3;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Form3.Show;
end;



forms 2 and 3 are like:

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm2 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure CreateParams(var Params : TCreateParams); override;
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

procedure TForm2.CreateParams(var Params : TCreateParams);
begin
  inherited CreateParams(Params);
  Params.WndParent := GetDesktopWindow;
end;

procedure TForm2.FormCreate(Sender: TObject);
var
wnd:thandle ;
begin
wnd:=Form2.handle;
ShowWindow(Form2.Handle, SW_HIDE);
SetWindowLong(Form2.Handle, GWL_EXSTYLE,
  GetWindowLong(Form2.Handle, GWL_EXSTYLE)
    or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
setwindowpos(wnd,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);

end;

end.
0
 
LVL 6

Expert Comment

by:edey
ID: 2133978
Note that topmost forms in delphi don't tend to stay topmost unless, in your application.onDeactivate you put:

application.restoreTopMosts;

Anyway, hope it works out for you.  If it doesn't, I have written an app (a post-it note sort of thing) that can display many topmost windows (also handles some neat stuff with WM_NCHITTEST)

GL
Mike
0
 
LVL 17

Expert Comment

by:inthe
ID: 2133986
Hi Mike
just a tip that might be of use to someone
i remember making a "postit" type program and i remember to save time only make one form and added it to the repository with a name then it is easy to call formname.create().
0
 
LVL 6

Expert Comment

by:edey
ID: 2134024
Yeah, a good idea that may not be immediately obvious.  Can be a great time saver when coding projects with very similar/identical forms

GL
Mike
0
 
LVL 7

Expert Comment

by:jconde
ID: 2134037
Hi,

maybe this will help:

It's 2 forms....form1 is created automatically and form2 is created dynamically.

UNIT1
------------------
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
     procedure Desactivar(Sender: TObject);
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
uses
  Unit2;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  x:TForm2;
begin
  X := TForm2.Create(nil);  setwindowpos(X.Handle,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);
end;

procedure TForm1.Desactivar(Sender: TObject);
begin setwindowpos(Application.Handle,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnDeactivate := Desactivar;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Form1.Visible := False;
end;

end.

UNIT2
-------------

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm2 = class(TForm)
    procedure FormClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit1;

{$R *.DFM}

procedure TForm2.FormClick(Sender: TObject);
begin
Form1.Visible := True;
end;

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := CaFree;
end;

end.


I set the FormStyle property of Form1 to fsStayOnTop.

Hope this helps a bit,

Jorge
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2134680
listenning..

btw.. peimbert, I see your name is NADIA .. are you female ?
0
 

Author Comment

by:peimbert
ID: 2134810
jconde:  Thank you, that's just what I was looking for.  I will post some points up for you ok?

Bryan7:  Yes I am (female).  My 1st name is Nadia!!!....I guess yours is Bryan lol :)

thanks all!!

nadia
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2136495
hm.. cool.. I only knew of a fem. programmer at E-E .. how old are you ?
I remember this name, Nadia, from an old tv-serie I used to look at, where is that name from ?
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6842441
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

662 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