|
Sytem.Diagnostics.Process.Start("Notepad.exe") will run notepad.
I don't know that notepad exposes a RCW or Win32 API such that it can be embedded in WinForms.
To open a text editor as a child window within an MDI application you may consider implementing the text editor.
Sorry I misunderstood you.
|
|
|
|
|
Starting NotePad sessions from your app is easy (see Process.Start() [^]. Running NotePad sessions "within" your app's main form is hard, if not impossible.
/ravi
|
|
|
|
|
I would like to run notepad "within" my app
|
|
|
|
|
Did you take a look at AnAppaDay[^]? That link points to a download (with source) in which the author has written an app that hosts other applications inside it.
|
|
|
|
|
Basically, you start Notepad as a seperate process. Then you have to call into the Win32 API FindWindow, IIRC, to get the handle to the Notepad window, then call SetParent to make the Notepad window a child of your app's window.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That sounds marvelous, but does it really work, the SetParent documentation states
"The new parent window and the child window must belong to the same application."
Luc Pattyn
|
|
|
|
|
Luc Pattyn wrote: That sounds marvelous, but does it really work,
Yep. Try this. Create a new Windows Forms app and drop a button and a panel on it. Expand the panel to take up most of your form and anchor it on all four sides. Then drop this code in:
using System.Runtime.InteropServices;
using System.Diagnostics;
.
.
.
[DllImport("user32.dll", EntryPoint="SetParent", SetLastError=true)]
private static extern IntPtr SetParent(IntPtr hwndChild, IntPtr hwndParent);
.
.
.
private void button1_Click(object sender, EventArgs e)
{
Process p = Process.Start("Notepad.exe");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, Panel1.Handle);
}
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi, is it possible if i can reference the asp:link button id in javascript so within the javascript function i can do something with the link button like make button enabled
i tried doing something like that in javascript didn't work. Can somebody help me in it.
<asp:linkbutton id="myLnkBtn" runat="server" onclientclick="Showme">
function Showme()
{
myLnkBtn.Enabled=true;
}
|
|
|
|
|
try myLnkBtn.disabled = false;
|
|
|
|
|
Hi,
I got the following piece of code from a property and I'm struggling to understand what is does exactly. Please can someone explain.
get{ return this.Context != null; }
Regards,
ma se
|
|
|
|
|
if this.Context is "null" it returns false otherwise it returns true.
Are you a student... I hope.
led mike
|
|
|
|
|
I am a little new to building WIndows Services and was curious if i could just create a single project named company.windowservice and deploy create multiple services in here? If so when installing the service would all services created within this single dll have to be installed as well? Any ideas? Thanks...
|
|
|
|
|
I'm trying to communicate with a piece of test equipment on our LAN, and I thought TcpClient would be a quick and easy to do this... I'm using VS2005, and here's what's happening...
I establish a connection to the server (the test equipment), create a stream, and write data to the server. I get the response back, and I'm happy. Then I try to send another message without closing the connection or the stream, and the write occurs, but the read freezes.
If I close the stream and connection to the server, and then build them up again, everything works fine. It just seams like a very inefficient way to do it!
I must have a basic misunderstanding of either TcpClient or the stream GetStream returns...
Any idea what going on?
|
|
|
|
|
weecabin wrote: Any idea what going on?
Can't be sure because you provided no information about the protocol you are working with.
led mike
|
|
|
|
|
Hey all,
I have a C# program that opens a word document for editing.
I need to have it open, then locate a particular line and column in the word doc, then print a text value in the spot located.
Does anyone know how I should go about this?
Thank you!
Dave
|
|
|
|
|
sorry if I was vague. I just need to know if there is a snippet of code out there that I could use to find a coordinate in a word document.
|
|
|
|
|
Can you give us more information as to what information you have that define what will be selected?
|
|
|
|
|
dspyank wrote: then locate a particular line and column in the word doc
Well the location is (line,column) so that is very confusing.
dspyank wrote: then print a text value in the spot located
What does that mean? Insert text at that location? If so you need to go look at the Word Object Model documentation.
led mike
|
|
|
|
|
Mike,
led mike wrote: then print a text value in the spot located
locate a point ( Line 4 Column 65 )
Then have my program write to that point.
I will check out the documentation.
Sorry I was so confusing, but thanks for your help!
Dave
|
|
|
|
|
hello
i'm using the visible poperty to hide the panel but it doesn't hide the controls on the panel.
is there any other way other than through the visible property.
|
|
|
|
|
Saira Tanwir wrote: is there any other way other than through the visible property.
They hide that information in the documentation[^]
but the property should work for all the child controls of the panel. If it doesn't then you must not have the other controls as children of the panel.
led mike
|
|
|
|
|
plz guide me on making child control on a panel.
i simply add controls by draging them from the toolbar onto the panel
|
|
|
|
|
Control visibility is hierarchical, if you hide a control (by setting Visible=false)
all its children are also hidden; other controls, that are not children of it,
will not be affected even if their coordinates are such that they overlap and seem
to "belong" to the panel.
So it all boils down to: make sure the controls you want to hide by hiding the panel,
have been added to Panel.Controls, and not directly to Form.Controls
Luc Pattyn
|
|
|
|
|
do we add controls to Panel by Panel.Controls property or is there any other method.
do tell cause i'm pretty new to C#.Net
|
|
|
|
|
to add controls to a panel, you program it like this:
Label lbl=new Label();
myPanel.Controls.Add(lbl);
if you are using Visual Studio Designer, just have a look at the code
it generates for you, and you will find such statements in a method
called "InitializeComponent" it generated for you
you are not supposed to edit this method, since that could confuse (maybe crash?) the
designer afterwards.
Adding a new control to a panel with Designer is automatic: if you click inside the panel
to indicate where and how large the new control is going to be, it is automatically added
to the panel, not to the form.
But copying with Designer, I don't know how to specify where it belongs. Just dragging
is NOT sufficient. You can get it right by trial and error, keep looking at the Property
pane, for the Location property, it is always relative to the parent, so if, while dragging
your new control suddenly has much smaller x,y values then it has been adopted by the
panel !
Luc Pattyn
|
|
|
|