Click here to Skip to main content
15,923,120 members
Home / Discussions / C#
   

C#

 
Generalform at runtime Pin
Member 114126618-Jun-04 22:45
Member 114126618-Jun-04 22:45 
GeneralRe: form at runtime Pin
Heath Stewart19-Jun-04 7:00
protectorHeath Stewart19-Jun-04 7:00 
GeneralYahoo and C# Pin
MeterMan18-Jun-04 21:55
MeterMan18-Jun-04 21:55 
GeneralRe: Yahoo and C# Pin
Nick Parker19-Jun-04 4:41
protectorNick Parker19-Jun-04 4:41 
GeneralRe: Yahoo and C# Pin
MeterMan19-Jun-04 6:44
MeterMan19-Jun-04 6:44 
GeneralRe: Yahoo and C# Pin
Heath Stewart19-Jun-04 6:50
protectorHeath Stewart19-Jun-04 6:50 
GeneralRe: Yahoo and C# Pin
Heath Stewart19-Jun-04 6:48
protectorHeath Stewart19-Jun-04 6:48 
GeneralRe: Yahoo and C# Pin
MeterMan19-Jun-04 10:14
MeterMan19-Jun-04 10:14 
First and formost thank you as always for your help. Nick thank you as well. I like how you give me an idea and force me to run with it. In any case I have a question.

I like your method of using the FindWindow apposed to having to search in spy++ every time. I somewhat have It working but here is the deal. I have the following.
I have a little application that comes up to enter the class name and enter the window name. Here is where I run into the problem. I can see in spy++ that I have say for notepad for instance. I have classname NotePad and then a subwindow class named Edit. I have something like this

public class Win32
	{

		public const uint WM_SETTEXT    = 0x000C;

				
		[DllImport("user32.dll")]
		public static extern int FindWindow(
			string lpClassName,  // class name
			string lpWindowName  // window name
			);
		[DllImport("user32.dll")]
		public static extern long SendMessage(
                       int hWnd, //handle to destination
                       uint msg, //message
                       uint wparam, //message parameter
                       string text // what i want to display as text
                       );


then i have in my form a button event as follows

private void button1_Click(object sender, System.EventArgs e)
		{
		// Determine the handle to the NotePad window.
		int i=Win32.FindWindow(txtClsNm.Text ,txtWndNm.Text);
                // Post a message to Notepad
		Win32.SendMessage(i,Win32.WM_SETTEXT,0,"Testing my program");
		}


The trouble I'm having is this. As you stated I could call FindWindow using the previous window as the parent. I kinda see what your talking about My question though is how do I let the function know? Example, if Edit Class is a sub of NotePad what do I call in order for it to address Edit?
I tried passing with the textbox for the class name NotePad Edit but that doesn't seem to work. So basically I'm asking kick me in the arse and let me buy a clue Big Grin | :-D
If I Call NotePad and then the Window Name of Untitled The title bar changes to Testing my program so I know I'm at least on the the right track. Thanks again Hope to not be too much of a pest in my learning days Frown | :(



Win32newb
"Don't Laugh, I can't help it I was born this way Big Grin | :-D "
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 15:24
eggie519-Jun-04 15:24 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 15:51
eggie519-Jun-04 15:51 
GeneralRe: Yahoo and C# Pin
MeterMan19-Jun-04 16:41
MeterMan19-Jun-04 16:41 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 16:46
eggie519-Jun-04 16:46 
GeneralRe: Yahoo and C# Pin
Heath Stewart20-Jun-04 9:46
protectorHeath Stewart20-Jun-04 9:46 
GeneralRe: Yahoo and C# Pin
MeterMan20-Jun-04 10:43
MeterMan20-Jun-04 10:43 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 17:49
eggie519-Jun-04 17:49 
GeneralRe: Yahoo and C# Pin
MeterMan19-Jun-04 18:25
MeterMan19-Jun-04 18:25 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 19:21
eggie519-Jun-04 19:21 
GeneralRe: Yahoo and C# Pin
MeterMan20-Jun-04 16:38
MeterMan20-Jun-04 16:38 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 19:11
eggie519-Jun-04 19:11 
GeneralRe: saving collection automaticaly into form`s code file. Pin
Mazdak18-Jun-04 22:18
Mazdak18-Jun-04 22:18 
GeneralRe: saving collection automaticaly into form`s code file. Pin
Member 114126618-Jun-04 22:52
Member 114126618-Jun-04 22:52 
QuestionNewbie Q: C# ASPX Popup? Pin
Joel, Just Joel18-Jun-04 16:04
Joel, Just Joel18-Jun-04 16:04 
AnswerRe: Newbie Q: C# ASPX Popup? Pin
Heath Stewart18-Jun-04 18:37
protectorHeath Stewart18-Jun-04 18:37 
GeneralRe: Newbie Q: C# ASPX Popup? Pin
Joel, Just Joel21-Jun-04 15:34
Joel, Just Joel21-Jun-04 15:34 
GeneralFind me that record... Pin
aberger5618-Jun-04 12:05
aberger5618-Jun-04 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.