Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

I have created winform application which evaluates Microsoft word.

Here, my application top position is 470 and I want to set Microsoft word bottom equal to the top position of my application, that is, 470.

What I have tried:

I tried this code:
if (handle != IntPtr.Zero)
                                {
                                    try
                                    {
                                        WinApiUtil.SetWindowPos(handle, IntPtr.Zero, 0, 0, Screen.PrimaryScreen.Bounds.Width, 480, WinApiUtil.SWP_NOZORDER | WinApiUtil.SWP_NOSIZE | WinApiUtil.SWP_SHOWWINDOW);
                                    }

                                    catch
                                    {

                                    }
                                }


Can anyone please help me.


Thanks
Posted
Updated 26-Apr-19 2:54am
Comments
Maciej Los 8-Jan-19 4:20am    
What's wrong with your code?

1 solution

C#
Microsoft.Office.Interop.Word.Application wordApp = new
Microsoft.Office.Interop.Word.Application();
wordApp.Visible = true;

 d = wordApp.Documents;
 aDoc = d.Open(ref oFilename, ref nil, ref readOnly, ref nil,
    ref nil, ref nil, ref nil, ref nil, ref nil, ref nil, ref nil,
        ref isVisible, ref nil, ref nil, ref nil, ref nil);


For moving and change size of the Word window using this code:
set Microsoft word bottom equal to the top position of application
C#
aDoc.Activate();

aDoc.Application.Width = this.Width;
aDoc.Application.Height = this.Height;

aDoc.Application.Move(this.Left, this.Top);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900