|
cross posting is frowned upon. Everyone here is helping on voluntarily basis.
If I understood your question correct I think it is a little over your head. (and over mine for that matter) My initial thought would be that you'll have to dig deep down into the bowls of Windows somewhere hooking up some sort of plugin that understands the event changes, more specifically for mouse events and/or draw events and writing a service that uses that plugin.
But that's just quick thinking.
|
|
|
|
|
V. wrote: you'll have to dig deep down into the bowls of Windows somewhere hooking up some sort of plugin that understands the event changes There is no specific event; the mouse-cursor could even be hidden with a bitmap floating over it, acting like a cursor.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I didn't think it would be one event .
|
|
|
|
|
V. wrote: I didn't think it would be one event I don't think it would be at all.
Even if you handle all WM_MOUSEMOVE and other messages, you'd still be guessing what the actual cursor looks like.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Please do not remove questions from Q&A that people have responded to, in depth.
thanks, Bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
Well, you could get this information for the standard cursors using GetCursorInfo, which retrieves the details of the current cursor whether or not your application owns it. There is, however, a big catch, and that's the fact that the reference to the cursor is a handle and I can't see any cursor function that will allow you to match a handle to a cursor. What you could do, though, is load every standard cursor (via the API and not the .Net functionality), and capture the handle there - this handle is global, so when it's loaded once, the same reference is used regardless of what application attempts to load the same cursor.
|
|
|
|
|
If all you want to know whether a URL was loaded or not, you do not need to look at mouse cursor, your application will be lot more robust if you decided to do some kind of Async call and then time-out from your receiver.
Shape of mouse cursor is way down on the totem pole of events and in any case its user-interface thing and No good application design should depend on the tail of responses.
That said, all mouse cursors have a constant value (IMHO they used to be called Handles back in the days of WIN32 API) that does not change across application.
If this was the only way out, I'd write a WIN SDK C++ app in which I create full sized transparent always-on-top window with no borders that scans all mouse events. and return the base WndProc unhandled ... Dabble a bit in Spy tool that comes with visual studio.
|
|
|
|
|
You might want to check who you replied to. I don't really want to do any async calls to check whether or not a URL was loaded.
|
|
|
|
|
Sorry... Reply was meant for original poster...
|
|
|
|
|
"Make the necessary changes to Example 5-14 to make the Employee
class a subclass of the Citizen class. Display some properties from
the Citizen class, such as the SSN and Age. The output should look
something like:
Citizen's Information:
SSN: 555-55-5555
Age: 36
Job Information:
Company Name: Pille Mandla
Company ID: 123-WxYz"
I'm about halfway done with my certification e-book/course… This was one of the little homework assignments…
I realize I could have done it two different ways, I was wondering if there was any other way of accomplishing this…
I realize it is just a simple program, but… As far as performance wise (let's pretend it's a larger program), which way is the most optimal?
Here is what I done:
using System;
public class Citizen
{
private string ssn;
private string age;
public string SSN
{
get { return ssn; }
set { ssn = value; }
}
public string Age
{
get { return age; }
set { age = value; }
}
public void DisplayCitizenInfo()
{
Console.WriteLine("Citizen's Information:");
Console.WriteLine("SSN: {0}", ssn);
Console.WriteLine("Age: {0}\n", age);
}
public Citizen()
{
Console.WriteLine("Please enter the citizens Social Security number: ");
SSN = Console.ReadLine();
Console.WriteLine("Please enter the citizens age: ");
Age = Console.ReadLine();
}
}
public class Employee : Citizen
{
private string name;
private string id;
public string Name
{
get { return name; }
set { name = value; }
}
public string Id
{
get { return id; }
set { id = value; }
}
public void DisplayInfo()
{
Console.WriteLine("Employee's name: {0}", name);
Console.WriteLine("Employee's id: {0}", id);
}
}
class MyClass
{
static void Main(string[] args)
{
Employee emp = new Employee();
Console.Write("Please enter the employee's name: ");
emp.Name = Console.ReadLine();
Console.Write("Please enter the employee's id: ");
emp.Id = Console.ReadLine();
emp.DisplayInfo();
}
}
|
|
|
|
|
In this example, you've got some stuff wrong. For a start, why do you have a separate method to display the information from each class. You would have been better off overriding a method here. Similarly, I would look at changing the way that you gather information - the Citizen constructor violates way too many good practices. If I were writing this, I would look at something like this
public class Citizen
{
public string Ssn;
public int Age;
public virtual void GetDetails()
{
SSN = GetInput("Please enter the citizen's Social Security number: ");
Age = GetAge();
}
public virtual void DisplayInfo()
{
Console.WriteLine("Citizen's Information:");
Console.WriteLine("SSN: {0}", Ssn);
Console.WriteLine("Age: {0}{1}", Age, Environment.NewLine);
}
protected string GetInput(string message)
{
Console.WriteLine(message);
return Console.ReadLine();
}
private void GetAge()
{
bool success = false;
int age;
while (!success)
{
string tempAge = GetInput("Please enter the citizen's age: ");
bool success = int.TryParse(tempAge, age);
if (!success)
{
Console.WriteLine("Unfortunately, you did not enter a valid integer (or whatever message you like here");
}
}
}
}
public class Employee : Citizen
{
public string Name;
public string Id;
public override void GetDetails()
{
base.GetDetails();
Name = GetInput("Please enter the employee's name:");
Id = GetInput("Please enter the employee's id:");
}
public override void DisplayInfo()
{
base.DisplayInfo();
Console.WriteLine("Employee's name: {0}", Name);
WriteLine("Employee's id: {0}", Id);
}
} As you can see, the classes are now largely self contained. We have some common functionality handled very simply for us, and we have a consistent interface that we are coding to. Actually, while I'm demonstrating this, it's a good idea to consider why I'm using fields, rather than properties. There's a commonly held belief that you MUST expose properties rather than fields, but in simple cases like this, that's a load of horse-hooey. If you are only using a property to store a value, and your class isn't doing something like Serialization, then you don't need a property there.
Note that I've just knocked this together in the editor and I've not had much sleep, so there may be the odd minor typo in there. I apologise if that is the case.
|
|
|
|
|
Okay, thank you for your response and your feedback/constructive criticism…
I myself haven't had much sleep when I finished this little exercise… I should have set it up a little better…
This exercise came at the end of chapter 5, it was discussing the basics of inheritance, properties, read-only and const keywords…
I'm guessing the book just wanted me to practice writing code for inheritance and properties…
With that said, I do realize I could have just created an object in the main method to ask the user to enter a Social Security number and age…
I just want to practice, and throwing in a constructor…
|
|
|
|
|
Have you guys ever found a bug or misbehaviour that you were unable to correct?
I´ve had a bug haunting me for weeks that makes me wonder if there are unsolveable bugs out there.
I lack experience since ive only been coding proffessionally for 5 years.
If you had one,what was it and what made you give up?
(I´m coding in C#, thats why i posted it on this forum.)
|
|
|
|
|
Söderlund wrote: I´m coding in C#, thats why i posted it on this forum Well, it's the wrong place, this forum is for technical questions; try the Lounge[^] for this type of discussion.
Veni, vidi, abiit domum
|
|
|
|
|
|
What is ur bug.... I think in one of the Dilbert's cartoon, they'd once shown using a real hammer to debug the application and against properly aimed hammer, no bugs (or hard drives carrying the bugs) stand a chance.
|
|
|
|
|
I am working on automatically find which webcam is working properly on my machine. Condition: 1) If you have two webcam one working and another one is not working. And the not working is in 0th position so is comes first so code taking 0th position.
2) If you installed a virtual webcam and integrated webcam already present so how to identify that which is a virtual or working webcam.
|
|
|
|
|
For each (char)character I wrote in textBox1, the webBrowser1.Navigate is fired.
The problem is that the mouse cursor JUMP from my textbox1 into webBrowser1, and I don't figure out WHY is doing that on this PARTICULAR PAGE(see code). On other pages i see is working fine, but here, is going nuts. I think is (part) because of the webBrowser1.Navigate method, and (part) because of the page. I need help on this matter. Its impossible for me to resolve it.
private void textBox1_TextChanged(object sender, EventArgs e)
{
webBrowser1.Navigate("http://translate.google.com/?hl=en&tab=wT#en|ro|" + textBox1.Text);
}
Thanks.
|
|
|
|
|
It's doing that probably because the page is coded to set one of its textboxes as the one that souls have the focus. There's nothing you can do to change that behavior. A better solution would be to not use Google's Translate page but instead use a service to do the translation and your code just displays the result in a textbox. You're relying on things that you have no control over.
|
|
|
|
|
ok, thanks... but is a very big loss,pity,...eh. |
|
|
|
|
|
Can you direct me to a sample for using what you suggesting: "use a service to do the translation"?
It is real? There are dictionaries other than sites on internet? I downloaded one with 30k word + samples, synonyms and explanations for each word, but i never been able to put it in practice. Its a very elaborate PERSONAL project... and i'm single(no help from anybody). I am crazy to even think to such a project. But, please enlighten me -- i do it for fun, and with love for what i like.
Thanks again.
|
|
|
|
|
|
is there any C# developer in Thailand?
|
|
|
|
|
Yes.
There are C# developers in Thailand.
However, this is not a jobs board.
The only instant messaging I do involves my middle finger.
|
|
|
|
|