|
Not a real "solution", just a theoretical long-shot. How are you gonna clip the area that you need to capture under the cursor?
No, don't asnwer - once you're there, you need to realize that you'll have to run this CPU-intensive task on each mouse-move.
It would have been more realistic to answer that it's not possible, even though one could think of a dozen workarounds. It would have even been more rewarding if you explained the difference between a control and a picture, and would have explained that one (with a bit of work) can fetch it's text[^] if it ain't a drawing - asking whether his project would be limited by this.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: No, don't asnwer - once you're there, you need to realize that you'll have to
run this CPU-intensive task on each mouse-move.
Actually, sod that, I will answer - seeing you thought it necessary to one vote. Read what he actually asked, not what you took it to mean. At no stage did he mention basing the read on mouse position. You have overcomplicated the problem, and haven't actually answered what he asked.
This is what he really asked:
"hi i am using window 7, and vs2008.net c#
i want to capture my screen image and identify words from a certain section.
is this possible? anyidea how its implemented? i am trying to make a school project. thanks"
Now, where does that say anything about mouse position? So, my answer still stands.
|
|
|
|
|
Pete O'Hanlon wrote: Actually, sod that, I will answer - seeing you thought it necessary to one vote. Read what he actually asked, not what you took it to mean. At no stage did he mention basing the read on mouse position. You have overcomplicated the problem, and haven't actually answered what he asked.
You're right, I interpreted his question and jumped to a conclusion. He doesn't say anything about capturing the text under the mouse-cursor.
And yes, I strongly disagreed with someone whose answers are usually valuable - hence the one. I can see my mistake and will rectify it after posting this reasoning. Next time, I'll make it a two if I simply disagree. 1's imply a lot of crap, which it certainly is not.
Pete O'Hanlon wrote: Now, where does that say anything about mouse position? So, my answer still stands.
It indeed does not say that.
Bastard Programmer from Hell
|
|
|
|
|
Don't worry about the one vote. You had me doubting my memory though, which at my age, I can't afford.
|
|
|
|
|
Pete O'Hanlon wrote: Don't worry about the one vote.
Cool
Just noticed that one can only flag it as a good/bad answer. A bad answer translates to a one-vote. I'm off to the suggestions-forum; it'd be nice to have a "hold on" or "say what?" indicator.
Pete O'Hanlon wrote: You had me doubting my memory though, which at my age, I can't afford.
You already forgotten that kids forget things too? You were more alert than I was when answering the TS.
Bastard Programmer from Hell
|
|
|
|
|
neodeaths wrote: is this possible?
Only in theory, as we have yet to find a CPU that can do OCR for different fonts at high speed.
In pratice, there are controls that can hold text, and controls that don't hold the text but who are simply displaying drawn pixels.
neodeaths wrote: i am trying to make a school project.
Too complicated for a school-project. First, it's not always possible to read the "word" under the cursor, as it might not be saved in memory as a text; as said, it might have been drawn. Although it's possible to have the computer guess what words there are in the picture, it's slow and error-prone.
Bastard Programmer from Hell
|
|
|
|
|
its my suggestion to my teacher for my school project as we are supposs to think of an application to do, i have not talk to him about it yet, just want to see how complex and what i should know before i decide what to do.
from what i have read about ocr its pretty deep, and will probably have a very long time complexity to run.
still considering though
|
|
|
|
|
neodeaths wrote: its my suggestion to my teacher for my school project as we are supposs to think of an application to do
What kind of application where you planning? Perhaps there's another way to get the required input, like the ClipBoard ?
neodeaths wrote: just want to see how complex and what i should know before i decide what to do.
A good project would be any project that has been done already. Ask the students of the previous year; at least you'll now it's viable within the given time.
neodeaths wrote: from what i have read about ocr its pretty deep, and will probably have a very long time complexity to run.
With some people (like me) doing a lot of travelling by mouse, with the cursor hitting a lot of words when I'm working.
Bastard Programmer from Hell
|
|
|
|
|
While you are deliberating, you should consider whether Eddie has actually answered the question you asked. In my opinion, he's interpreted your question - you need to decide whether his interpretation is actually what you were asking.
|
|
|
|
|
hi i am using window 7, and vs2008.net c#
to create a simple
to use my mouse to click a certain area of my desktop when like
every 12pm click on the 50,50 of my screen
is this possible? if so please give advice on the website and class file i should check out. thanks
|
|
|
|
|
This StackOverflow question[^] has the answer to your question.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class Form1 : Form
{
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
public Form1()
{
}
public void DoMouseClick()
{
int X = Cursor.Position.X;
int Y = Cursor.Position.Y;
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
}
}
0100000101101110011001000111001011101001
|
|
|
|
|
In order to control a PLC with a "complex data structure" the PLC class expects a structure that is unmanaged.
This structure runs fine:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public class PinStructureQuality
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public int[] iPinValues = new int[24];
public PinStructureQuality()
{
iPinValues = new int[24];
}
}
The problem I have is that I don't know at the time this Class is constructed whether I have 10, 24 or any other number of pins. I would like to read this from a settings file or an XML file containing a parameter telling what the size the array is.
The line
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
causes the problem, since the value 24 must be known in front.
Does anybody have an idea on how to solve this?
|
|
|
|
|
What's the C declaration? I suspect you want to marshal as a pointer not as a fixed size array within the structure.
|
|
|
|
|
the structure is directly used in the API provided with the PLC. This is the declaration of the wrapper:
public void WriteAny(int variableHandle, object value);
and my call to it is:
public void SetAllLow()
{
for (int i = 0; i < iNrIO; i++)
_PinStructureQuality.iPinValues[i] = (int)(65535);
try
{
if (e._ErrorCode == 0)
adsClient.WriteAny(hcomplexStruct, _PinStructureQuality);
}
catch
{
e._ErrorCode = 1;
e._ErrorMessage = "Could not write pinning data to PLC";
ErrorEvent(this, e);
e._ErrorCode = 0;
e._ErrorMessage = "";
}
}
The reason I want to use this WriteAny call is that it allows me to sent also strings and other types in the same structure.
|
|
|
|
|
Member 7889751 wrote: I don't know at the time this Class is constructed whether I have 10, 24 or any
other number of pins. I would like to read this from a settings file or an XML
file containing a parameter telling what the size the array is.
Why does the second preclude the first?
|
|
|
|
|
The easiest way to deal with variable length arrays with P/Invoke is to create your array as a normal .NET array where variable length is no issue.
When you need to pass it you can use GCHandle[^] to pin the data and pass the GCHandle's pointer. Make sure you free the GHHandle after you are done with it! This assumes the native code can somehow work out the length of the data being passed - if it attempts to read outside of the allocated memory, strange things will happen
|
|
|
|
|
Hi Experts
can u please guide me how to download a file which is in Network location( \\10.101.....)where we pass credentials OF particular server and downloading a file from that server to local Machine in asp.net
Regards
venu
|
|
|
|
|
On the local network? You can just use File.Open etc (any of the normal ways to read a file from System.IO), if you have permissions to read it. Remember that ASP.net runs as its own user, though, so setting up the network permissions might be tricky.
|
|
|
|
|
ya i dont have permissions to read it but i have a user name and password who has the permission to read so i have to pass this parameters in the code and to read the file
|
|
|
|
|
Getting network resources under a different user name is (on Windows anyway) pretty tricky. You'd probably do better asking your network admin for read permissions on that file.
|
|
|
|
|
I am working in a c# code generator project. This first version was mostly hacked out in a couple of weeks.
, Now I am having qualms , regarding if I should publish it or simply keep it for myself ( I mean , not out of selfishness , but due to the fact that a comercial product needs a lot more work than an only-for-your-eyes tool, plus I get the impression that code generators are not very popular these days ).
Currently the tool generates the following :
Stored procedures for the tables (SQL Server only)
Business objects
Data Access Layer
A basic navigation menu
A list view for the objects.
Any feedback will be greatly appreciated.
|
|
|
|
|
Most developers worth paying build their own code generator as part of their "framework". Most of us also run up against this same question, should I publish? I predict that almost no one will actually pay money for it if/when you do publish (remember we all built our own).
There is one benefit you will gain from it if you do go on to publish it. You will learn the difference between corporate and commercial grade software. What a corporate or you will accept to get the job done and what you can actually sell are very different animals.
Good luck!
[edit]
By all means you should write an article and publish that way, this will also be instructive without the staggering burden of trying to make a commercial product. It may get ragged mildly as being like many others but so what!
[/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for the feedback.
One of my thoughts was to polish it enough so that even a non-programmer could use it ( but that is an altogether different creature which would probably take months to complete ).
As-is it would probably be usefull only for novice programmers ( < 1 year experience ).Anyhow , I started this project because the company I'm in makes everything by hand and I couldn't stand the tedium of writting n-tier apps by hand.
|
|
|
|
|
Armando de la Torre wrote: I couldn't stand the tedium of writting n-tier apps by hand.
Yup thats why we wrtie em. Mine started life in VB5 back in the 90s and even then I snaffled it from another dev I was working with. It's been rewriten in 3 different languages using different protocols and targetting different databases, currently Oracle and SQL Server. Still does basically the same thing for the database but now does all the WCF model and DAL stuff with an initial ViewModel shell but this is not really valid any more.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
That's fair enough, but there are already code generators on the market. Some are paid for, and some are free. It would be worth taking a look at what they have to offer and see how they are packaged.
|
|
|
|