|
this.Controls contains a set of all controls.
Since you need to access only a particular control, have a check (case or if statement) just for that type of control.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
I'm working on a project which is by C# language. I want to produce a Dictionary which is similar to Narcis or Easylingo that able the user to use the mouse and just move the cursor on the WORD in any application then the program detect the word and will find the meaning for that particular word.
My question is How I can detect the word which is under the Mouse Cursor on the screen in any application such as Microsoft office or Web browsers, etc.
I'm looking for any tips and guide or any Codes which can help me.
Your cooperation is highly appreciated.
|
|
|
|
|
I wonder if you can't grab an image of the area around the mouse position (like snaggit or something) and run that through some OCR library to parse out any text.
If you think you are going to be able to write a generic hook into any program to grab the text, good luck with that.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You're going to have to OCR the screen around the mouse. There is no consistent way to get the text under the mouse cursor in every application window. WM_GETTEXT is not supported by every window.
|
|
|
|
|
Sounds like a CPU-hogging "solution".
Bastard Programmer from Hell
|
|
|
|
|
Yep, but you could make it less of a hog by only doing the OCR on a right-click.
|
|
|
|
|
I still think it's an exotic solution; you'd have to account for the resolution of the current desktop, and copy a part of it without knowing the size of the font under the word.
Bastard Programmer from Hell
|
|
|
|
|
Yep, it is. But I don't know of another way to get the text under the mouse that works with all controls...
|
|
|
|
|
Do any of you use the VS2010 Profiler regularly? If so, in what cases do you use it? I know there are plenty of paid profilers around, as well as free (IIRC, not entirely sure).
I ask because I recently ran into some terribly slow performance in a database-driven application. I did not have access to any 3rd-party profiling applications. So I ran the profiler in VS. It helped me discover that I had mistakenly created a loop which opened the database connection, queried it and the closed the connection for EACH iteration in the loop. This took approximately 27 seconds seeing as how there was close to 2,000 records in the table. The profiler told me that the majority of the time was taken up by DbConnection.Disconnect() inside this method. That's when I found the problem. Once I fixed it I can now run the same code with MORE THAN 2,000 records in the table and it takes ~7 seconds.
I think I should start using the profiler more often. Haha. Any input would be nice. I wasn't entirely sure if this was the correct forum but I develop C# applications.
|
|
|
|
|
I can't comment on the VS profiler as I use the JetBrains profiler. I'm surprised that you saw such a problem though - if your connections were pooled, they should just be returned to the pool (and taken from there), which is not an expensive operation.
|
|
|
|
|
Well, if it makes any difference I am using OLE DB with a Microsoft Access 2007 database. But either way, it happened. I thought it was odd as of last night because I had just recently read a thread here on CP concerning connection pooling and such. But I don't know. I have never developed an application that was entirely database-driven until this one. So I'll take any advice I can get, if you have any for me. :-P
|
|
|
|
|
In the normal sense it isn't possible to pool connections with MS Access because the is no such thing as a 'connection' in terms of network connections possible with that.
Your experience would suggest it isn't pooling any other associated resource either.
|
|
|
|
|
Matt U. wrote: I have never developed an application that was entirely database-driven until this one
Get rid of Access and use SQL Server express. Let me say that with emphasis GET RID OF ACCESS, seriously the absolute best thing you could do for both your application and yourself is move to SQL Server express, there are tools that will help move the structure and data.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The database is not mine. It belongs to the plant manager. I have pitched the idea, along with numerous advantages, improvements, etc., with using SQL Server Express (including that it is 100% free). However, is there a way to pull SQL Server data into Access? He generates daily, weekly and monthly reports, which he must send to various individuals throughout the company. That is his biggest issue with the idea.
|
|
|
|
|
Matt U. wrote: However, is there a way to pull SQL Server data into Access?
Certainly, I'm not sure of the connection type any more but you could use Access as a front end to a SQL Server database, there is [used to be] a migration wizard. If your current design has 2 MDFs (database and UI) then the change is very simple. If not you may need to refactor some of your Access code.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Use a profiler if you have a problem or if you have time to learn about it.
However don't over optimize.
|
|
|
|
|
I know Luc does not visits Q & A and I really want to learn this thing. I have had brilliant reply from SA but I need more. I am learning greedy. Sorry.
Here[^] is a question of mine if you wich to respond. I totally appreciate if you wish to downvote.
Thanks.
Edit: No disrespect to anyone else who can help me out. I am fan of these guys so I posted this way. Sorry if I offended you.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
modified on Friday, June 17, 2011 4:30 PM
|
|
|
|
|
It's alright. You only want an answer from Luc, so we'll all feel free to ignore this because apparently only SA and Luc know the answer.
|
|
|
|
|
I only post when I want SA to correct me and direct me to his correct post
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You too huh?
|
|
|
|
|
No disrespect to you Sir Pete and others too but I am a fan of these two guys. My fanhood has dominated here. Sorry for that. You have taught me a lot of things and I wish you could help me more. I totally respect anyone who replies to a post with a decent reply but I am totally a fann of these guys. Sorry if this post of mine meant any disrespect of any of you CPians. Really sorry if you sorry if you feel this way Pete.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I appreciate that you didn't mean anything by it, but there have been some really good new posters coming through the forums recently (letting me take more of a back seat - thanks guys and girls), and a post like this could demotivate them.
|
|
|
|
|
Again, really sorry. It's just the respect I have for them. This does not mean I do not consider anyone else. I know what I owe to this community. I know what I was and what I am. Not just technical things but life as well.
Sorry for anyone who feels I am beyond the limits. Please help people regardless of what they feel and say. That's whta makes CP different from other places guys. We are a community and not a random username on the web.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
So, thrown on the scrapheap; a boy of my tender years.
The best things in life are not things.
|
|
|
|
|
I don't know if ou remember this or not but I had rough time with you and Judah in my initial posts. I really thank you for being gentle after that. I would have ripped off the guy forever if I was you.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|