473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do you find the class name?

How do you find a programs ClassName? I used:

Expand|Select|Wrap|Line Numbers
  1. private void button2_Click(object sender, EventArgs e)
  2. {
  3. string lpClassName = "Notepad";
  4. string lpWindowName = "Untitled - Notepad";
  5. IntPtr hWnd = FindWindow(lpClassName, lpWindowName);
  6. SetForegroundWindow(hWnd);
  7. string z = "TEXT";
  8. const int WM_SETTEXT = 0x0C;
  9. SendMessage(hWnd, WM_SETTEXT, IntPtr.Zero, z);
  10. SendKeys.Send("This is my text");
  11. }
for notepad and it worked just fine, but when I try:

Expand|Select|Wrap|Line Numbers
  1. private void button2_Click(object sender, EventArgs e)
  2. {
  3. string lpClassName = "Wordpad";
  4. string lpWindowName = "Document1 - WordPad";
  5. IntPtr hWnd = FindWindow(lpClassName, lpWindowName);
  6. SetForegroundWindow(hWnd);
  7. string z = "TEXT";
  8. const int WM_SETTEXT = 0x0C;
  9. SendMessage(hWnd, WM_SETTEXT, IntPtr.Zero, z);
  10. SendKeys.Send("This is my text");
  11. }
for Wordpad it either just stalls, puts "This is my text" into the textbox in my program, or just puts it in notepad (if it's open). How do I find what the ClassName is?
Dec 11 '07 #1
0 894

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
4
by: Arjen | last post by:
Hi, I have a class with some attributes. For example class person with name as attribute. I have add multiple persons in an arraylist. Now I need a function to get/find a person by the name...
2
by: Chris Fink | last post by:
This should be relatively simple but I am unable to find an asp:button tag in a datalist footer. I have tried it numerous ways including the FindControl method from the many events that the...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
7
by: Marc Fauser | last post by:
How can I find the textbox (handle?) e.g. from http://www.microsoft.com/ on the right top corner from my program? And how can I identify the textbox again, if a new browser window is opened with...
5
by: Joerg Battermann | last post by:
Hello there, I have a custom type defined via Public Class Requirement Public IDNumber As Integer Public Name As String Public Description As String Public VersionPlanAttributes As New _
4
by: John Wolff | last post by:
Pardon me for such a newbie question. I've only been using C# for 14 months, and most of the stuff has been relatively basic. I have a serializable "Contact" class that has a number of...
1
by: Shiva48 | last post by:
Thanks to Gannon11 and ro351988- Moderator. I give below the complete Java file and pls help me to rectify the errors. package com.wrox.proj2ee.ch10.app; import java.io.*; import...
3
by: Allan Bredahl | last post by:
Hi All I'm trying to use a Generic.List declared as follows (Example): Public Class MyObj { Public String Name; Public Integer Age; }
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.