|
Mark T. wrote: Hi Martin, 27 Feb 2007
First, thanks for posting sample code. I have needed to do this same sort of thing in the past, and would like to learn how. (Pressing a button on a running program, or inserting text, or...)
I wrote a test program with a couple buttons on it, and then I tried your sample code. It successfully identified the other program's window (non-zero pointer), but could not find the button.
This call:
hwndChild = FindWindowEx((IntPtr)hwnd,IntPtr.Zero,"Button","A");
returned zero.
1. Any idea what may have gone wrong with this particular case.
2. Where can I learn more about this? For instance, I don't know where you found the value for BN_CLICKED = 245. I searched online and came up blank.
Thanks for any help.
Mark
Hello Mark,
Mark T. wrote: 1. Any idea what may have gone wrong with this particular case.
Is the Text Of your button really "A"?
Mark T. wrote: 2. Where can I learn more about this?
This is a good link:
http://www.codeproject.com/csharp/WindowsAPIsFromCS.asp[^]
P.S.: I'm not answering direct on e-mail questions.
All the best,
Martin
|
|
|
|
|
Hi all
I have Visual studio 2003 with just c# installed I have to read in a access database and show it using the smart device application. I sort of know how to do it on a normal app but as soon as i enter using System.Data.OleDb It cannot find on the smart device library. Is there way to read in a database and show it using a smart device app.
i.e. is there something else i can use apart from OleDb that can be found in smart device library. Oh if this stupid question or it in the wrong form can you tell me that as well
Can any one help
Thanks in advance
James_Bond
|
|
|
|
|
Hi,
I have an application in which there there is an MDI form and all other are its child. But when i try to show one specific form as its child, it does not appear. And also its Load event also does not fire. This form gets appeared from one location but not from any other location.
Can you please give me hint why it is so? Your help would be highly appreciated.
Regards,
Wasif Ehsan.
|
|
|
|
|
set the MdiParent property of the childforms to the mainform..
ChForm frm = new ChForm();<br />
frm.MdiParent = this;<br />
frm.Show();
life is study!!!
|
|
|
|
|
Good day,
How can I make a UserControl inherits from a Form?
I've tried to do this:
public partial class UserControl1 : Form
{
..
}
But when I add a the dll to my test program, I could not find UserControl1 from the listed control and a message appears indicating the no control exist.
Thanks.
-- modified at 5:09 Tuesday 27th February, 2007
|
|
|
|
|
If you want to use your UserControl1 as a UserControl, then you must inherits it from Class UserControl. You cannot create a new usercontrol inherits from a Form.
|
|
|
|
|
The reasoN why i want to create a usercontrol that is derived from a form because i want to create customable panel, that can be minimize or maximize. i've made a usercontrol which is derived from Panel but the problem is when the backcolor of the control is transparent and that control is placed inside my usercontrolpanel, the transparency goes through all the way to the form, that is why i thought i should derived my usercontrol from a form. Please refer to the image linke below for sample output of my usercontrol:
http://www.geocities.com/fritzjeran/SAMPLEOUTPUT.JPG
Any suggestion is appreciated.
Thanks.
|
|
|
|
|
fjlv2005 wrote: customable panel, that can be minimize or maximize
That's easy, you just set the dock style of the control to all, to maximise on the form. Set it to none and the size to 0,0 to minimise.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
how to select a particular erroritem in the errolist and also it description
|
|
|
|
|
kalyanit wrote: how to select a particular erroritem in the errolist and also it description
Sorry, there is some context missing. What are you talking about? Where is this error list?
|
|
|
|
|
Hi All,
I have 2 exe's.What I have to do is to call one exe from the second one with some arguments.How to do it??
NEHA GUPTA
|
|
|
|
|
|
Take a look at the Process.Start method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello,
In the namespace System.Diagnostics you will find Process and ProcessStartInfo.
ProcessStartInfo psi= new ProcessStartInfo();
psi.UseShellExecute = false;
psi.FileName = ???;
psi.WorkingDirectory = ???;
psi.Arguments = @"xxx";
using(Process YourProcess= Process.Start(psi))
{
YourProcess.???;
}
All the best,
Martin
|
|
|
|
|
I need to load large string into RichTextBox.This string is RTF formatted text.If I try passing that string to RichTextBox like:
RichTextBox.Rtf=that string
RichTextBox freeze for several secounds.
I search over internet for solution,and i found article that describe how to load file that is a few megs in size using EM_STREAMIN message.
Unfortunatelly,that article is for VB6 and use file for loading while I have to use RTF formatted string.
Does anybody knows how to implement loading string into RTB using EM_STREAMIN message in C#?
|
|
|
|
|
use threads to solve ut problem
|
|
|
|
|
use threads to solve your problem
|
|
|
|
|
Sorry to say but did you think about this reply before posting?
The original poster claims that the RichTextBox itself is freezing.
If you can tell us how to use threads to keep this from happening (don't forget the UIThread has to render the RichTextBox!), you're my hero...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Sure, create a new RichTextBox, load it in the background thread, then substitute it
for your existing RTB.
|
|
|
|
|
Yes,that could help,but in that case user must wait until whole string is loaded into new RichTextBox before it is substituted with existing RichTextBox.
Is it possible to load RTF file or string in segments into RichTextBox.
Something similar to MS Word or WordPad
where text is appended in RichTextBox in segments while app remain responsible to user.
I asking that because RichTextBox doesn't have "append" method.
|
|
|
|
|
Hi!
Unfortunately, I don't see an easy solution for you. But if you somehow can split the RTF into smaller parts, you could load them one after the other by using the SelectedRtf property and at least throw in a few Application.DoEvents() so that the RTB updates after each loaded part.
The idea behind this is something like this:
rtb.Clear();
for (int i=0; i<parts.Length; i++)
{
rtb.SelectedRtf = parts[i];
rtb.Select(rtb.Text.Length, 0);
Application.DoEvents();
}
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
the boy is right .. no offence .. but check your premise
|
|
|
|
|
Ok, then please show us a working example. If you don't use a workaround like the one suggested by Luc (which isn't what the poster was asking for and, honestly, I'd rather call cheating :P), I really can't see how this should work.
Sure, "use threads" is the default answer when someone ask for making something more responsive, but in this case it's a Control that can become unresponsive for a longer period of time due to calling one of its methods (or setting one of its properties).
With very few exceptions (and calling LoadFile() or setting Rtf don't belong to them) you cannot safely access a control from another thread than the one it was created on.
So if you create the RTB in another thread (apart from the UIThread), then you'll have to marshal each and every call to this other thread.
But even so: You're calling LoadFile() from the other thread and the RTB is blocking the other thread while the large file is being loaded. During this period of time the RTB doesn't update and thus appears unresponsive.
Out of curiosity I actually tried the "create the RTB in another thread" approach and, apart from proving my point, I also found that even the UIThread seems to be blocked while the RTB is loading a large file in a background thread...
If you're interested, I can post the code here.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
give me your Email ID i'll mail you solution
|
|
|
|
|
Please use the Email link from one of my postings to send me a PM with your mail adress. I couldn't send you one because CP claims that your mail adress isn't verified.
Thanks in advance, I'd be very interested in a working solution for loading a large RTF string/file into a RTB without blocking it in the process...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|