Click here to Skip to main content
15,891,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to run ms word application in my program. I have call the exe but I want to run under a frame means I do not want to show the border.or any method to remove the frame or border of external exe. Here is sample code which I got but not working
C#
Public Class Form1
    Inherits System.Windows.Forms.Form
    Declare Function ShowWindow Lib "user32" (ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Boolean
    Private Const SW_MINIMIZE As Integer = 6
    Private Const SW_MAXIMIZE As Integer = 3
    Private Const SW_RESTORE As Integer = 9

    Declare Function SetParent Lib "user32" (ByVal hWndChild As System.IntPtr, ByVal hWndNewParent As System.IntPtr) As System.IntPtr
#Region " Windows Form Designer generated code "

 
    Private Sub wordMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wordMenu.Click
        Dim pinfo As New ProcessStartInfo("WINWORD")
        Dim p As Process = System.Diagnostics.Process.Start(pinfo)
        p.WaitForInputIdle()
        SetParent(p.MainWindowHandle, Label1.Handle)

    End Sub
End Class

'Here this fellow explain how to run winword under a label.. But it is not working.... or any method to remove frame of called exe
Posted
Updated 13-Oct-13 19:29pm
v2

First thing which caught my eye is: should be "winword.exe" instead of "WINWORD". And it's not a good idea, to run Word. Would you consider using Word automation instead? Or something else? Well, you will run this application, and what are you going to do with it? The user can run it without your help.

—SA
 
Share this answer
 
Answered here[^].
 
Share this answer
 

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