|
I'm trying to capture text from a rich edit textbox. I have a section of code I took from the PInvoke website. it correctly determines the length of the text to be captured, however it doesn't actually capture any text. I'm using this code:
<br />
private static String GetWindowText(IntPtr hWnd)<br />
{<br />
IntPtr txtLength;<br />
IntPtr retValue;<br />
IntPtr zeroVal = new IntPtr(0); <br />
uint WM_GETTEXTLENGTH = 14;<br />
txtLength = SendMessage(hWnd, WM_GETTEXTLENGTH, zeroVal, zeroVal);<br />
<br />
StringBuilder sb = new StringBuilder(txtLength.ToInt32() + 1);<br />
<br />
uint WM_GETTEXT = 13;<br />
retValue = SendMessage(hWnd,WM_GETTEXT,txtLength,sb);<br />
<br />
return sb.ToString(); <br />
}<br />
The retValue variable equals zero after it is updated and sb contains no characters. Any help would be greatly appreciated.
jake
|
|
|
|
|
im trying to make an xml search method
for example this is my xml file
<deportes>
<deporte folder="" nombre="Ajedrez" permit="pp">
<item nombre="Participantes" link="resultados/ajedrez/">
<item nombre="Calendario" link="Resultados/ajedrez/">
<item nombre="Resultados" link="Resultados/ajedrez/">
<deporte folder="" nombre="Apnea">
<item nombre="Resultados Generales" link="">
<item nombre="Dia 1" link="resultados/apnea/apnea_resultados.htm">
what i wanna do its get movinh trought the xml and when i get the looking for attribute the method will give me back an string with this caracteristics
d=0&n=1 where d its equal to the current <deportes> node and n its equal to the current item node where the looking attribute was found for example
d=0&n=1 the atribute nombre = calendario
but if i im on a child of a item node for example <item nombre="Dia 1" ...="">
the result it will be d=1&n=0,0
please if some one can helpme plese email me quickly
|
|
|
|
|
<br />
<?xml version="1.0" encoding="utf-8"?><br />
<Deportes><br />
<Deporte folder="" nombre="Ajedrez" permit="pp"><br />
<item nombre="Participantes" link="resultados/ajedrez/"><br />
</item><br />
<item nombre="Calendario" link="Resultados/ajedrez/" /><br />
<item nombre="Resultados" link="Resultados/ajedrez/" /><br />
</Deporte><br />
<Deporte folder="" nombre="Apnea"><br />
<item nombre="Resultados Generales" link=""><br />
<item nombre="Dia 1" link="resultados/apnea/apnea_resultados.htm" /><br />
</item><br />
</Deporte><br />
|
|
|
|
|
Try checking the "Do not treat <'s as HTML tags" checkbox so we can actually read your xml...
mav
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
<Deportes>
<Deporte folder="" nombre="Ajedrez" permit="pp">
<item nombre="Participantes" link="resultados/ajedrez/">
</item>
<item nombre="Calendario" link="Resultados/ajedrez/" />
<item nombre="Resultados" link="Resultados/ajedrez/" />
</Deporte>
<Deporte folder="" nombre="Apnea">
<item nombre="Resultados Generales" link="">
<item nombre="Dia 1" link="resultados/apnea/apnea_resultados.htm" />
</item>
</Deporte>
|
|
|
|
|
private string DumpIndex(XmlNode node)
{
string sAns = "";
if (node.ParentNode != null)
{
int iPos = -1;
foreach (XmlNode c_Node in node.ParentNode.ChildNodes)
{
iPos++;
if (c_Node.Equals(node))
{
sAns = this.DumpIndex(node.ParentNode);
if (sAns.Length > 0) sAns += ".";
sAns += iPos;
break;
}
}
}
return sAns;
}
|
|
|
|
|
i think that the code its perfect but can u explainme how do i know what node i must send to this funtion first for examle
string dumindex(myfirsnode)
|
|
|
|
|
using System.Xml;
XmlDocument c_Doc = new XmlDocument();
c_Doc.Load(...) or LoadXml(...);
XmlNodeList c_List =
c_Doc.DocumentElement.SelectNodes("//*[nombre='???']");
... or ...
c_Doc.DocumentElement.SelectNodes("//item[nombre='???']");
foreach (XmlNode c_Node in c_List)
{
... Do the DumpIndex with c_Node and whatever else ...
}
I am writing this away from my computer, so I cannot check it. Use the first SelectNodes methods to include all nodes, the second if you want to include only the item nodes. Of ccource the ??? needs to be replaced with the name that you are searching for.
Anyway, you should be able to get the idea on how to use XPath (If you need to learn more, check the w3schools.com site)
|
|
|
|
|
I already read the article in codeproject site that shows how to get the screenshot for the whole desktop screen in http://www.codeproject.com/csharp/cscapturescreen1.asp
BUT what I'm looking for is how to get the updated screen area of desktop, since I'm sending the image data via network so I will reduce the bandwith and sent data size by getting the updated screen area....any suggestions?
|
|
|
|
|
|
you mean that I use Equals like following
Bitmap oBmp = GetDesktopScreen();
Bitmap oBmp2 = GetDesktopScreen();
if(oBmp.Equals(oBmp2))
//What to do in either cases equal or not?????
|
|
|
|
|
|
I'm referring to this article:
http://www.codeproject.com/cs/media/CsTranspTutorial3.asp?df=100&forumid=36208&select=1146413#xxxx
the question is:
I'm using the per-pixel form about the "aqua mala" bottle.
I want add over the image some form component as a label.
How could i do?
|
|
|
|
|
|
I just want an easy way to get tracert (Trace Route) information programmatically in C#...
Can anyone help me plz???
Thnx
|
|
|
|
|
You can simply use Process.Start() to execute tracert and to read back its output.
Otherwise I doubt that there's an easy way...
Regards,
mav
|
|
|
|
|
Tracert basically uses echo information to create a route to your target. That means, it constantly changes the TTL (Time-To-Live) in the IP header of and echo request and then pings all routers and hosts reporting a timeout.
It works this way:
START-----------------NODE1------------------NODE2---------------END
START sends a package with a small TTL (like, 1 hops) to END. As the package reaches NODE1, NODE1 decrements the TTL hop-counter by 1, making it 0. This means, it may not forward the information and will send an ICMP error package back instead. START receives that package and pings NODE1 (with a normal TTL) to get a response time to display, then sends another package to END with a TTL of 2. Game repeats for NODE2.
Thats how the trace information is built. Sophisticated tools will then try a WHOIS on each node and use the address information to draw the approximate location on a map (e.g. by ZIP codes).
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I'm trying to print a form with Labels, textboxes and checkboxes.
I have added the PrintDocument1, printDialog1 and printpreviewDialog1 controls.
I have added some code, when I print preview, the preview is blank, and a blank sheet comes out. When I just hit the print button, it askes me to pick a printer, and then prints a blank piece of paper.
I know I have to somehow 'build' the image of my form, to send to the printer. I have the subroutine (called Drawall), and I was wondering what the code
If I could just print even the first Label (called label1), that would be enough to get going.
Any suggestions? Some of my code is below:
private void button3_Click(object sender, System.EventArgs e)
{
Close();
}
private void PreviewMenu_Click(object sender, System.EventArgs e)
{
try
{
PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
printPreviewDialog1.Document = this.printDocument1 ;
printPreviewDialog1.FormBorderStyle = FormBorderStyle.Fixed3D ;
printPreviewDialog1.SetBounds(20, 20, this.Width, this.Height);
printPreviewDialog1.ShowDialog();
}
catch(Exception exp)
{
System.Console.WriteLine(exp.Message.ToString());
}
}
private void printPreviewDialog1_Load(object sender, System.EventArgs e)
{
}
private void button2_Click(object sender, System.EventArgs e)
{
printDialog1.Document = this.printDocument1;
if (printDialog1.ShowDialog() == DialogResult.OK)
{
this.printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
DrawAll(e.Graphics);
}
private void DrawAll(Graphics g)
{
}
}
Any help would be appreciated...
|
|
|
|
|
Search for "screenshot" on code project. There are a few articles discussing different approaches to tackle this.
Kind regards,
Wout
|
|
|
|
|
You can call InvokePaint() to paint a control on a given graphics object.
If you iterate over all controls in your form you should get what you want.
Something like
private void DrawAll(Graphics g)
{
PaintEventArgs pea = new PaintEventArgs(g, this.ClientRectangle);
foreach (Control c in this.Controls)
this.InvokePaint(c, pea);
} (written from memory, may contain bugs...)
Regards,
mav
|
|
|
|
|
Thanks for you help...
I have got it started, just putting it together.
G
|
|
|
|
|
hi all.
in my server application there are some variables that have to be changed during setup my application on the webserver like the ip address of that server and the port address i suceeded to override the install class to modify the configuration of the setup process to pass these variables from dialogs i added during deployment but the question is
i need to make my user to provide the ip address and port and then the dialog take these variables and modify it and then the setup.exe is created with the new variables values and then other users can double click the setup.exe file and installing it with the new values and the installation don't ask them for new variables
did you get me or not i can explain it in more details
-----------------------------------------------------
when i override my install class to pass variables to the application during installation time it is ok it passes these variables with the new values but each time the user press the setup.exe file it gives him the same dialog to enter the new values of the variables like the ip address and port number but i need to make the user provide it once and then click change values buttons and then it creates setup.exe file with the new embedded values and create that file on the hard desk of the user pc and then he can give the setup.exe file to other users and they click and install the application without asking them to give the values again something like creating server in subseven or prorat or any remote administration tool please any help in that
Miss With The Best And Die Like The Rest
|
|
|
|
|
snouto wrote:
did you get me or not i can explain it in more details
Nope. Figure out what punctation is first. We then might be able to figure out what your saying.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i need to provide file.exe to enable the user to put values in the text boxes and then write these values to the installer.exe file which i will pass these custom data to it and then the file.exe create for me the installer.exe with the new values entered and then i can send this installer.exe to users and install my program safely with the new values changed internally.
Miss With The Best And Die Like The Rest
|
|
|
|
|