|
Sorry I posted in wrong board.
... it's now here...
I've already consulted Computer Hope, didn't find what I needed there. The most difficult part is to compute "Yesterday"
|
|
|
|
|
Hi,
I Have a Problem with this code ; below code is in turbo c++ and don't Know How To Convert it to c#2.0 code ?
#define COM 0x3f8
void Init_Serial(unsigned int Parity)
{
//Init Serial
int c;
outp(COM+3,0x80);//DLAB=1
outp(COM,0x0c); //Baud rate 9600
outp(COM+1,0x00);
outp(COM+3,Parity);
c= inp(COM+5);
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/c8zc5kah.aspx[^]
The above link is an example showing how to use serial ports in C#. It will show you how to setup, open, send data, and so on...
It is even easier than C++ in WindowsNT; though not as easy as Win 9X (read DOS) days with direct hardware access...
|
|
|
|
|
i saw that theres a way to host an internet explorer window inside winform application and also that i can host any application that has an activex like adobe acrobat, microsoft word, excel etc.
how can i (if at all) create a winform that can host any application ? a window that just enables me to run every regular application that i have inside it ?
thanx,
|
|
|
|
|
ActiveX is via interop with COM and for IE I'd suggest the "Web Browser" control (it is just IE)
|
|
|
|
|
for ie hosting on my winform im indeed using webform control, and for other apps that arrive with activex i can add the activex to my winform. my question is, how can i host other applications that doesnt arrive with activex ?
and another question: i used the code on this website to produce a transparent and clickthrough enabled, but i wish to have controls on the page that arent transparent and clickthrough, how can i acheive this ?
thanx,
|
|
|
|
|
From what I know/understand you can only use COM and "managed" (read .NET code) inside a C# project.
(note ActiveX is just a small part of COM)
If the it is possible to host non-COM objects I don't know how, if you' just wish to start another process then http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx[^] will help you...
I'm not sure what you mean by "wish to have controls on the page that arent transparent and clickthrough"
Do you want to have a form with a button of a z-index of 1 and overlay say a picture box with a z-index of 2 but when you click on the picture box where the button is location it will process a click on the button?
|
|
|
|
|
algoaddict wrote: for ie hosting on my winform im indeed using webform control, and for other apps that arrive with activex i can add the activex to my winform. my question is, how can i host other applications that doesnt arrive with activex ?
You have to launch the other application, wait for it's message pump to start, then grab it's main window handle and, using a P/Invoke call to the Win32 API function SetParent, change it's parent window to a host control on your form, like a Panel:
[DllImport("user32.dll", EntryPoint = "SetParent", SetLastError = true)]
private static extern IntPtr SetParent(IntPtr hwndChild, IntPtr hwndParent);
Process p = Process.Start("notepad.exe");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, panel1.Handle);
WARNING! This will not work for every application out there! It's dependant on the hosted application rending it's own window. Using this technique CAN and WILL cause rendering problems with these applications and there's nothing you can do about it.
The hosted application will act just like it does if opened on the desktop. The user can minimize the app, resize it's window, yada, yada, yada, inside your application window, just like your app was the Desktop. They can even CLOSE THE HOSTED APPLICATION, and there's nothing you can do to stop that from hanppening!
algoaddict wrote: but i wish to have controls on the page that arent transparent and clickthrough, how can i acheive this ?
You can't. Like I said in the article, it's the entire form, including all of it's child controls, or nothing.
|
|
|
|
|
Hello,
I'm building a base class to hold information taken from a robot movement file.
This means I have several lines, each with a set of points, and sometimes commands, between the points. Each point has some data (coordinates, orientation, zone, speed, work object, and a few more).
I'm using Eran Kampf's Sharp3D math library.
I would like a sugestion on how to implement the base class.
So far, I've done the following:
using Sharp3D.Math.Core
using Sharp3D.Math.Geometry3D
namespace ModelClass
{
#region Class constants
public enum Linetypes
{
undefined = -1,
laser = 0,
water = 1,
glue = 2,
primer = 3,
rough = 4
}
public enum Polysides
{
undefined = -5,
none = -1,
right = 0,
left = 1
}
#endregion
public class Point7D
{
// Represents a point in 3D space
Vector3F vector;
// Represents the quaternion of vector associated with point
QuaternionD quaternion;
// Point name descriptor
string name;
}
(...)
public class RobotPoint : Point7D
{
#region Constants
public enum zones
{
undefined,
fine,
z0,
z1,
z5
}
public enum speeds
{
undefined,
v5,
v10,
v100,
v1000
}
const string ActiveTool = "ActiveTool";
const string AuxPointData = "[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]";
#endregion
#region Internal fields
// Workplace definition
string workplace;
// Tool defined for the point
string tool;
// Zone definition
zones zone;
// Speed definition
speeds speed;
#endregion
}
public class PolyLine7D
{
#region Internal Fields
List<RobotPoint> pointList;
string name;
Linetypes type;
Polysides polyside;
#endregion
}
public class Model
{
#region Internal Fields
List<PolyLine7D> _ModelPolylines;
string _ModelFileName;
#endregion
}
}
Should the class PolyLine implement itself a static method for creating a list, instead of having the Model class do it?
Same question for the Model class if I want to have more than one file opened at the same time? In such case, I would create a Hashtable, with the _ModelFileName as a key.
Thanks for any help you can give me.
|
|
|
|
|
Hi guys,
I need some help please, example I have a string as follows T12322322232O, how do I parse everything between T and O using regex?
Please help.
sasa
|
|
|
|
|
If you mean you want to capture "everything between T and O using regex", then something like
"T(?'Data'.*)O" should work. If the regex Matches, there'll be a Group named "Data" whose Value contains the digits.
If that's not what you mean, then please post more details.
|
|
|
|
|
This sounds like a homework problem...
look for how to check for start and end (it is on MSDN)
|
|
|
|
|
|
hi, can anyone tell me how I could make c# search an xml file (i.e an RSS feed) for one of the components in the file (such as the title)
thanks,
Jacob
-- modified at 18:31 Tuesday 28th August, 2007
hmm, what i ment was like, i guess more like a dictionary, i was just saying rss to make it easyer, but it didnt,
say i have a dictionary and i have like
<dictionary>
<word>
<wordString>Example</wordString>
<Description>i duno =P</Description>
</word>
<word>
<wordString>Chair</wordString>
<Description>you sit on it</Description>
</word>
</dictionary>
so you would search for 1 word instead of of ts of words.
-- modified at 20:12 Tuesday 28th August, 2007
i want it so if i search "chair", it comes up with the description of the chair, and if i search Example it comes up with the description
|
|
|
|
|
if you use System.Xml you can do something like
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("http://www.someDomain.com/rssfile.rss");
XmlNodeList myList = xmlDoc.GetElementsByTagName("title");
foreach (XmlNode x in myList)
{
Console.WriteLine(x.Value);
}
|
|
|
|
|
hmm, what i ment was like, i guess more like a dictionary, i was just saying rss to make it easyer, but it didnt,
say i have a dictionary and i have like
<dictionary>
<word>
<wordString>Example</wordString>
<Description>i duno =P</Description>
</word>
</dictionary>
so you would search for 1 word instead of of ts of words.
|
|
|
|
|
What I posted will find every tag of that name
Example:
<rootElement>
<title>1</title>
<title>2</title>
<title>3</title>
<title>4</title>
<title>5</title>
<title>6</title>
<title>7</title>
<title>8</title>
<title>9</title>
</rootElement>
would output the following to the console
1
2
3
4
5
6
7
8
9
If you wish to use sub elements the example you posted then after the .getElementsByTagName("word")
check each node the node list as before see if there is more than one use .ChildNodes.Count on each value in the node list. If it is > 1 then it has more an just a text node under it. To goto the first child use .FirstChild to move down one level to <wordString> and .NextSibling to goto the <Description> tag
oh and hint hint
if .NextSibling == .LastChild then your at the end
|
|
|
|
|
By using XPath and selectsinglenode
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Is jacobparker trying to read one word or them all??
Now I'm lost...
|
|
|
|
|
|
Christian Graus gave the correct answer then, I misunderstood your request...
|
|
|
|
|
What's the best way for me to read the xml information and populate the textbox fields?
I may have about 4 different textboxes, few numericupdown controls. Any suggestion for me to read the xml file and then set some controls mentioned above, accoring to the xml data?
For example, textbox1.text would get the value from xml which has value of "mumma", and also the numericUpDown value to be 3 as said on xml file?
Thanks!
|
|
|
|
|
I have an application that creates hotspots for an imagemap in a asp page. It has the function to place rect, circle, and polygon(I.E. COORDS="639, 161, 671, 129, 699, 160, 669, 190") hotspot shapes.
Another function on my mapping tool increases/decreases the sizes of the hotspots. This function is easy with rects and circles(increase radius or add/subtract the points on the rect), but I'm having an issue the polygon translation. I didn't want to instance the drawing class and have to convert to a in memory polygon object and translate back to a the coords... So, question is... anyone know the math to make this happen quickly? Looking for the quick fix with little overhead for my app.
|
|
|
|
|
I don't know this would be useful or not (and I think you already know this!)but this is all it's math
it can be done using rectangle technique and i'm think is fast enough for normal size shapes
you can assume all your shapes you are going to resize are in a rectangle (x1,y1),(x2,y2) which the first one is top left and the second is bottom right
so for resizing the shape you can resize the rectangle and map the changes to your shape
the easiest way is to get one point as a reference inside the rectangle for fixing the shape
the rectangle would be used for calculating the ratio if you get the ratio directly you wouldn't need the ectangle points
for example I suppose that I have a polygon with (10,10),(21,21),(15,40) and I want to resize it to 2X (the ratio)
I assume my reference point to (10,10)
my new resized polygon without fixing to its position is (20,20),(42,42),(30,80)
my referene point is (20,20) in new polygon so it has linear transform (10,10) from the actual reference so I must subtract it and my refDiff would be (10,10)
the resized fixed position polygon would be (10,10),(32,32),(20,70)
but if you dont have the ratio you must find ir from the rectangle which "x1 is Min of all x"
"x2 is Max of all x" "y1 is Min of all y" and "y2 is Max of all y"
you cn find the ratio from changing the first ractangle Width and Height from the second one and use the ratio as before
so the formula foreach point would be
Xn=ratioAtx*xn-refxDiff
Yn=ratioAty*yn-refyDiff
I think this is the easiest way to do that in math and implementing it is depend on yourself (sorry if you didn't mean this)
hope this would be useful
|
|
|
|
|
I think I have to plug my values into a matrix and scale the vectors based off of a reference point(like you said) which I'm just going to cheat and find the average of the X coords and the Y coords for that reference point. But the Matrix.Scale method doesn't support a certain reference point so i would have to extend the method and thats a pain, or i'm just lazy. But if anyone has done such a thing(scaling a 2d polygon from a reference point) please assist. Thanks!
|
|
|
|
|