How to change window caption?

Y

Yazeed

Hi All,

Window.Caption property in powerpoint is readonly (I DONT KNOW WHY!!!),
however im trying to change it, the only way i know is to use P/Invoke to
change that caption, but its not working, here is code snippet from my class:

//Declaration
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string strclassName, string
strWindowName);

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr
wParam, string lParam);

private const int WM_SETTEXT = 0x000C;

//in my method
IntPtr HWND = FindWindow(null, "Test.pptx"); //This returns 0

IntPtr result= SendMessage(HWND , WM_SETTEXT,
IntPtr.Zero,"Caption Changed");

HWND always return 0 and also if i used Application.Windows[1].HWND in
sendMessage method, the caption doesnt change.

So is it possible to change the caption??

Thanks in advance
 
L

Lucy

I would also like to know WHY you can't change it through the object model
(Window.Caption) but you can change it in Excel?!?!?

It seems silly to me to be able to do:

Wb.Windows[1].Caption = "My Excel Caption";

But you can't do:

Pres.Windows[1].Caption = "My PowerPoint Caption";

I want the caption to include text that is relevant to the open presentation
so setting Pres.Application.Caption won't work.

Is there any other easier and simpler way to do this? (like you can in Excel)
 

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