How to Avoid MS-Project Add-in Windows Showing in Taskbar?

A

Anonymous

I am developing a MS-Project add-in using Delphi.

Add-in forms are showing in the taskbar, and I want them to behave like (for
example) Project's Options dialog, which doesn't.

I have been unable to find anything in Project's type library which gives
back the hWnd.

Any ideas *other* than making it a toolwindow (WS_EX_TOOLWINDOW)? Please
something less lame than "change Project's window title into something
unique, FindWindow and then change the title back".
 
J

John Flynn

There are some tricks in an article called the "Big Brother Delphi Code
Toolkit" but I think it makes it essentially a toolwindow. See
http://delphi.about.com for more info.

I have just spent today putting into Project a simple COM add-in myself
using Delphi, and while the window shows up in the taskbar, it doesn't worry
my users. But please let me know if you find something better!!
 
M

Mark Durrenberger

I thougt (and without investigating) that you could set a form property
called "ShowInTaskbar" to true or false

I'll look around and see if I can find where I read that...
Mark

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
M

Mark Durrenberger

Yes for each form you show in your add in you can set a flag "ShowInTaskBar"
to true or false.

Mark

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
A

Anonymous

Mark Durrenberger said:
Yes for each form you show in your add in you can set a flag
"ShowInTaskBar"

Delphi does not have a ShowInTaskBar property. I *can* add the
WS_EX_TOOLWINDOW exstyle but that would result in a small titlebar without
minimize/maximize icons -- and that is not what I want.

So unless you know how ShowInTaskBar actually does its thing...
 
J

John Flynn

The code I referred to (I looked up the article again) suggests setting up
the following in the FormCreate event (within Delphi) -

procedure TForm1.FormCreate(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE)
or WS_EX_TOOLWINDOW );
ShowWindow(Application.Handle, SW_SHOW);
end;

A simple test shows this works standalone - haven't time to try it within an
ActiveX control, but shouldn't be an issue.
 
A

Anonymous

Well... sort of!

Just do: Application.Handle := FindWindow('JWinproj-WhimperMainClass', nil);
This sets Application's handle to MS-Project, and now the window won't show
in the taskbar.

BUT how do you get MS-Project's HWnd? FindWindow is nice, assuming there is
only a single application with that classname, otherwise you may obviously
get the wrong one...
 
A

Anonymous

No. That is a solution for a standalone exe; this will NOT help you in a
dll.

As I said,
Application.Handle := FindWindow('JWinproj-WhimperMainClass', nil);
will solve the problem, but unless you have a 100% way of getting Project's
hWnd, using FindWindow as above runs the (small) risk of having some moron
code his application with the same classname -- and then your dialogs may
appear in the wrong application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top