Solved

Delphi Interface like MS Outlook with Multiple documents open at once

Posted on 2008-10-12
8
361 Views
Last Modified: 2013-11-23
I would like to develop an application that has the same structure as Outlook in terms of being able to have multiple email sopen at once and use alt-tab to switch between the documents and to be able to see a list in the taskbar at the bottom.  I thought this would be using MDI in Delphi but this just seems to allow multiple child forms open inside a parent form, and alt-tab switching doesn't seem possible.  Does anyone know how this can be achieved?
0
Comment
Question by:alanrogerson2
[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
  • 4
  • 4
8 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 22697129
you will use SDI, which is the default in delphi.
just create your main form and then create another form, for the email. go to project options and remove it from the aut creation list.

then, whenever you want to creatopen a new email do (pseudo code):

anemailform:=theemailform.create(application);
emailforms.add(anemailform);// this is a list of email forms so that you can keep track of them in an easy fashion.
anemailform.loademail(whatever);

so basically your applicaiton will have at least 2 forms:
- the main form, created automatically
- the email form, created manually, from code.

and then tehre can be any number of forms for configuration and stuff like that.
0
 

Author Comment

by:alanrogerson2
ID: 22697460
Thanks for your help.

I have done this but it doesn't list the forms as separate forms that you can alt-tab between.  Do you think it should?
0
 
LVL 28

Expert Comment

by:2266180
ID: 22697578
now I understand what you mean. sorry, got confused the first time.

I don't have outlook so I would like you to make a small test for me:
- open outlook with one email. look at the processlist in task manager (specfically the processes number from the status bar)
- open another email. check the processes number. did it grow with 1 unit? if so, do you have another outlook process there?
if the answers are yes, then the explanation and your solution is simple:
- launch your application with a parameter like "myapp.exe /email=whatever" then in the dpr check for the parameter:
if pos('/email',paramstr(1))>0 then
  application.createform(temailform, emailform)
else
  application.createform(tmainform, mainform);

if there is no new process for an email, it becomes a little more complicated.
to get the window to appear in the taskbar place the following line in the email form oncreate event:
  setwindowlong(handle, GWL_EXSTYLE, getwindowlong(handle, GWL_EXSTYLE) or WS_EX_APPWINDOW );

for solving the alt-tab thing I have no suggestions. but I have an idea.
install windowse (http://www.greatis.com/delphicb/windowse/)
open an email window from outlook and start windowse then and on the window tab look at the style and extended style values. better yet, make a screenshot and post it here. I will then make some tests with those styles to see which one is used. but there is a chance that this behaviour is not done via window styles, in which case it will become pretty hard to figure out what it is.
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!

 

Author Comment

by:alanrogerson2
ID: 22697654

I have got the forms to appear in a list on the taskbar... Thanks for that.  Now all I need to solve is how to be able to Alt-Tab between them.  I attach a screenshot from WinDowse...
 
screenshots.doc
0
 

Author Comment

by:alanrogerson2
ID: 22697673
I meant to say that outlook.exe did not increment number of processes when i opened up a new email.  All emails seem to be generated by a single process yet windows let's the user switch between them as though they are different programs.
0
 
LVL 28

Accepted Solution

by:
2266180 earned 500 total points
ID: 22697813
*please*, next time attach the picture itself not a doc file. EE will automatically generate a thumbnail for the image so we don't have to donwnload the doc, open it and then see what it is in ;) you can attach multiple images with no problems.

after fiddling with the styles, I thought to make a small search since I had some weird behaviour (window not refreshing and could not be closed). I found this article:

http://delphi.about.com/od/formsdialogs/l/aa073101b.htm

all your email form needs to look like is this (tested and works fine, both button in taskbar and alt-tab):
type
  TForm2 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  end;
 
var
  Form2: TForm2;
 
implementation
 
{$R *.dfm}
 
procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do begin
    ExStyle := ExStyle or WS_EX_APPWINDOW;
    WndParent := GetDesktopwindow;
  end;
end;

Open in new window

0
 
LVL 28

Expert Comment

by:2266180
ID: 22697817
also, anotehr aricle you might want to read on: http://www.delphi3000.com/articles/article_1493.asp?SK=
0
 

Author Closing Comment

by:alanrogerson2
ID: 31505431
Thanks very much. This works.  You are very clever!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

739 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