Getting MS-Project's HWnd from add-in

A

Anonymous

I am developing a MS-Project add-in using Delphi. After much investigation,
I have concluded that to avoid having and its forms showing in the taskbar,
I have to get Project's HWnd.

Sadly, I have been unable to find anything in Project's type library which
gives back the HWnd. MSDN's site yields no relevant functions/properties
that I managed to find.

Any ideas how can I get it? (Please something less lame than "change
Project's window title into something unique, FindWindow and then change the
title back")

TIA.
 
M

Mark Durrenberger

Try this

Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal IPClassName As String, _
ByVal IpWindowName As String) As Long

in your code:

strWindowCaption = Application.Caption
lngHwnd = FindWindow(vbNullString, strWindowCaption)


--
_________________________________________________________
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

Sorry, it's the only option I was able to come up with...
after quite a bit of effort.

What's wrong with using findwindow?

Good luck,
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

Thanks for the effort, but I specifically said I do NOT want to use
FindWindow. I'm trying to figure out a MS-Project function/property that
will give me its hWnd.
 
F

Fredrik Wahlgren

FindWindow Should work just fine since you search for thr class name, not
the caption

/ Fredrik
 
A

Anonymous

FindWindow will work ASSUMING some idiot doesn't create an application with
the same class name, in which case the dialogs will appear in the wrong
window!
 

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