|
hi,
i have a problem when i send a HttpRequest!
first i send a request to get the session_id than a login request and after that a other request....
after that i begin with the request for session_id and than the problem arise when i send the login request...
i get a timeout error when i call request.GetRequestStream (); by why!?!
cu
<br />
request for session id:<br />
-----------------------<br />
HttpWebRequest get_request = (HttpWebRequest)WebRequest.Create("https://www.myzone.at/webkeeper/Controller");<br />
get_request.CookieContainer = new CookieContainer();<br />
<br />
HttpWebResponse get_response = (HttpWebResponse) get_request.GetResponse();<br />
get_response.Cookies = get_request.CookieContainer.GetCookies(get_request.RequestUri);<br />
<br />
String sessionid = "Cookie: ";<br />
sessionid += get_response.Cookies[0].ToString();<br />
<br />
login request:<br />
--------------<br />
HttpRequestResponse login_request = new HttpRequestResponse("https://www.myzone.at/webkeeper/Controller", "POST", "action=login&login=Anmelden&brand=myzone&username=xxxxxx&password=xxxxxxb&x=83&y=13");<br />
login_request.SESSION_ID = sessionid;<br />
login_request.SendRequest();<br />
<br />
<br />
<br />
sendrequest method:<br />
-----------------------------------------<br />
public string SendRequest()<br />
{<br />
string responseFromServer="";<br />
<br />
try<br />
{<br />
if((RequestMethod.ToUpper() != "GET") && (RequestMethod.ToUpper() != "POST"))<br />
throw new WebException(RequestMethod+ " is not a valid method. Use GET or POST.");<br />
<br />
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(URL);<br />
request.Method = RequestMethod;<br />
request.Headers.Add(SessionId);<br />
<br />
if(RequestMethod.ToUpper()=="POST") <br />
{<br />
byte[] byteArray = Encoding.UTF8.GetBytes (PostData);<br />
<br />
request.ContentType = "application/x-www-form-urlencoded";<br />
<br />
request.ContentLength = byteArray.Length;<br />
<br />
Stream requestStream = request.GetRequestStream (); <------------ here arise the timeout when i send the 2nd login request...<br />
<br />
requestStream.Write (byteArray, 0, byteArray.Length);<br />
requestStream.Close ();<br />
}<br />
<br />
HttpWebResponse response = (HttpWebResponse) request.GetResponse();<br />
Stream dataStream = response.GetResponseStream ();<br />
StreamReader reader = new StreamReader (dataStream);<br />
responseFromServer = "HTTP/" + response.ProtocolVersion + " " + response.StatusDescription + " ";<br />
responseFromServer += response.Headers.ToString();<br />
<br />
reader.Close ();<br />
dataStream.Close ();<br />
response.Close ();<br />
}<br />
<br />
catch (WebException e)<br />
{<br />
throw CatchHttpExceptions(responseFromServer = e.Message);<br />
}<br />
catch (Exception e)<br />
{<br />
throw new Exception(responseFromServer = e.Message);<br />
}<br />
<br />
return responseFromServer;<br />
}<br />
|
|
|
|
|
I think the problem is that you don't close your original response. It's been a while since I used these objects, but I seem to remember getting that problem if I didn't properly clean up after every request.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
hi,
and whats that, here i close it! hmmmmm....
<br />
reader.Close ();<br />
dataStream.Close ();<br />
response.Close (); <--------------<br />
cu
|
|
|
|
|
It might not be the problem, but in your sample code I didn't see where the original request and response were closed:
HttpWebRequest get_request = (HttpWebRequest)WebRequest.Create("https://www.myzone.at/webkeeper/Controller");
get_request.CookieContainer = new CookieContainer();
HttpWebResponse get_response = (HttpWebResponse) get_request.GetResponse();
get_response.Cookies = get_request.CookieContainer.GetCookies(get_request.RequestUri);
String sessionid = "Cookie: ";
sessionid += get_response.Cookies[0].ToString();
login request:
--------------
HttpRequestResponse login_request = new HttpRequestResponse("https://www.myzone.at/webkeeper/Controller", "POST", "action=login&login=Anmelden&brand=myzone&username=xxxxxx&password=xxxxxxb&x=83&y=13");
login_request.SESSION_ID = sessionid;
login_request.SendRequest();
Also, I assume you have tried changing the request timeout value of the request object and setting it to a high enough value.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
hi, yeahhhhh i found the error ))
i forgot to close the get_response: get_response.Close();
now all works perfect )
cu
|
|
|
|
|
I got a hard problem I don't know how to solve...
How do I, with the classes in item.cs, make elecrisity go from a battery throu two cords and back to the battery again. I'll implement the ohm's later...
How do the cord know when it should flow elecrisity.
item.cs:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace NiklasUlvinge.ChipsEater
{
abstract class Item
{
public Item[][] input;
public int x;
public int y;
public abstract Strom Output
{
get;
}
public abstract Point[] Snap
{
get;
}
protected Item(int X, int Y)
{
x = X;
y = Y;
input = new Item[1][];
}
public abstract void function();
public abstract void draw(Graphics g);
public void addBothInput(int index, int fromIndex, Item Input)
{
Input.addInput(fromIndex, this);
this.addInput(index, Input);
}
private void addInput(int index, Item Input)
{
index = input.Length & index;
Item[] inp = input[index];
Item[] titem;
if (inp == null)
{
titem = new Item[1];
}
else
titem = new Item[inp.Length];
for (int i = 0; i < titem.Length - 1; i++)
{
titem[i] = inp[i];
}
titem[titem.Length - 1] = Input;
input[index] = titem;
}
public Strom combinedInput(int index)
{
Strom r = 0;
if (input[index] == null)
return 0;
else
{
for (int i = 0; i < input[index].Length; i++)
{
r += input[index][i].Output[j];
}
return r;
}
}
protected Brush surf = Brushes.LightGray;
protected Pen side = Pens.DarkGray;
protected Pen loff = Pens.Black;
protected Pen lon = Pens.Red;
}
class Null : Item
{
public override Strom Output
{
get
{
}
}
public override Point[] Snap
{
get
{
return new Point[0];
}
}
public Null(int X, int Y)
: base(X, Y)
{
}
public override void function()
{
throw new Exception("The method or operation is not implemented.");
}
public override void draw(Graphics g)
{
throw new Exception("The method or operation is not implemented.");
}
}
class Transistor : Item
{
protected float[] output;
public Null theNull = new Null(-50, -50);
public override Strom Output
{
get
{
Strom r;
if (strom.l - strom.r > 0)
{
r.l = strom.l;
r.r = strom.r;
}
else
{
r.l = strom.l;
r.r = strom.r;
}
}
}
public override Point[] Snap
{
get
{
return new Point[3] {
new Point(x - 16, y - 1),
new Point(x + 3, y - 16),
new Point(x + 3, y + 16)};
}
}
public Transistor(int X, int Y) : base(X, Y)
{
input = new Item[4][];
output = new float[1];
}
public override void function()
{
if (combinedInput(0) > 0)
output[0] = combinedInput(1);
else
output[0] = 0;
}
public override void draw(Graphics g)
{
IntPtr intp;
if (combinedInput(0) == 0)
if (combinedInput(1) == 0)
if (output[0] == 0)
intp = Properties.Resources.trans000.GetHbitmap();
else
intp = Properties.Resources.trans001.GetHbitmap();
else
if (output[0] == 0)
intp = Properties.Resources.trans010.GetHbitmap();
else
intp = Properties.Resources.trans011.GetHbitmap();
else
if (combinedInput(1) == 0)
if (output[0] == 0)
intp = Properties.Resources.trans100.GetHbitmap();
else
intp = Properties.Resources.trans101.GetHbitmap();
else
if (output[0] == 0)
intp = Properties.Resources.trans110.GetHbitmap();
else
intp = Properties.Resources.trans111.GetHbitmap();
g.DrawImage(Image.FromHbitmap(intp), x - Image.FromHbitmap(intp).Size.Width / 2, y - Image.FromHbitmap(intp).Size.Height / 2);
}
}
class Cord : Item
{
public int x2, y2;
public Null theNull = new Null(-50, -50);
public override Strom Output
{
get
{
Strom o,
l = combinedInput(0),
r = combinedInput(1);
}
}
public override Point[] Snap
{
get
{
return new Point[2] {
new Point(x, y),
new Point(x2, y2) };
}
}
public Cord(int X1, int Y1)
: base(X1, Y1)
{
input = new Item[2][];
}
public override void function()
{
}
public override void draw(Graphics g)
{
g.DrawLine(combinedInput(0) > 0 ? lon : loff,
x, y, x2, y2);
}
}
class Battery : Item
{
public Null theNull = new Null(-50, -50);
public override float[] Output
{
get
{
return new float[1] { 1 };
}
}
public override Point[] Snap
{
get
{
return new Point[2] {
new Point(x - 5, y),
new Point(x + 5, y) };
}
}
public Battery(int X, int Y)
: base(X, Y)
{
}
public override void function()
{
}
public override void draw(Graphics g)
{
g.DrawLine(lon, x - 2, y - 10, x - 2, y + 10);
g.DrawLine(lon, x + 2, y - 6, x + 2, y + 6);
g.DrawLine(lon, x - 2, y, x - 5, y);
g.DrawLine(lon, x + 2, y, x + 5, y);
}
}
}
form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace NiklasUlvinge.ChipsEater
{
public partial class Form1 : Form
{
Item[] items = new Item[0];
bool mouseIsDown = false;
Point startingPoint;
Cord newCord;
public Form1()
{
InitializeComponent();
}
private void PB_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.Clear(Color.White);
for (int i = 0; i < items.Length; i++)
{
items[i].draw(g);
}
}
private void addItem(Item item)
{
Item[] titem = new Item[items.Length + 1];
for (int i = 0; i < items.Length; i++)
{
titem[i] = items[i];
}
titem[items.Length] = item;
items = titem;
}
private void PB_MouseClick(object sender, MouseEventArgs e)
{
switch (treeItems.SelectedNode.Name)
{
case "NodeLst1":
addItem(new Transistor(e.X,e.Y));
break;
case "NodeLst2":
addItem(new Battery(e.X, e.Y));
break;
}
this.Refresh();
}
private void PB_MouseDown(object sender, MouseEventArgs e)
{
switch (treeItems.SelectedNode.Name)
{
case "NodeLst0":
startingPoint = new Point(-2,-2);
for (int i = 0; i < items.Length; i++)
{
Point[] pts = items[i].Snap;
for (int j = 0; j < pts.Length; j++)
{
if ((Math.Abs(pts[j].X - e.X) < 5) && (Math.Abs(pts[j].Y - e.Y) < 5))
{
startingPoint = new Point(pts[j].X, pts[j].Y);
newCord = new Cord(startingPoint.X, startingPoint.Y);
items[i].addBothInput(0,0,newCord);
}
}
}
if (startingPoint == new Point(-2, -2))
{
startingPoint = new Point(e.X, e.Y);
newCord = new Cord(startingPoint.X, startingPoint.Y);
}
mouseIsDown = true;
break;
}
}
private void PB_MouseUp(object sender, MouseEventArgs e)
{
switch (treeItems.SelectedNode.Name)
{
case "NodeLst0":
mouseIsDown = false;
int theX = e.X,
theY = e.Y;
for (int i = 0; i < items.Length; i++)
{
Point[] pts = items[i].Snap;
for (int j = 0; j < pts.Length; j++)
{
if ((Math.Abs(pts[j].X - e.X) < 5) && (Math.Abs(pts[j].Y - e.Y) < 5))
{
theX = pts[j].X;
theY = pts[j].Y;
items[i].addBothInput(j,0, newCord);
}
}
}
newCord.x2 = theX;
newCord.y2 = theY;
addItem(newCord);
newCord = null;
break;
}
this.Refresh();
}
private void PB_MouseMove(object sender, MouseEventArgs e)
{
if (mouseIsDown)
{
Graphics g = PB.CreateGraphics();
this.Refresh();
g.DrawLine(Pens.Black, startingPoint, new Point(e.X, e.Y));
}
}
}
}
Niklas Ulvinge aka IDK
|
|
|
|
|
I could not compile your code because type "Strom" is not defined. Can you also provide this as well?
|
|
|
|
|
Form1.Designer.cs:
namespace NiklasUlvinge.ChipsEater
{
partial class Form1
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Cord");
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Transistor");
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Battery");
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("lowest", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3});
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.treeItems = new System.Windows.Forms.TreeView();
this.PB = new System.Windows.Forms.PictureBox();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB)).BeginInit();
this.SuspendLayout();
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(608, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(608, 25);
this.toolStrip1.TabIndex = 1;
this.toolStrip1.Text = "toolStrip1";
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 49);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Panel1.Controls.Add(this.treeItems);
this.splitContainer1.Panel2.Controls.Add(this.PB);
this.splitContainer1.Size = new System.Drawing.Size(608, 376);
this.splitContainer1.SplitterDistance = 83;
this.splitContainer1.TabIndex = 3;
this.splitContainer1.Text = "splitContainer1";
this.treeItems.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeItems.Location = new System.Drawing.Point(0, 0);
this.treeItems.Name = "treeItems";
treeNode1.Name = "NodeLst0";
treeNode1.Text = "Cord";
treeNode1.ToolTipText = "A simple current wire";
treeNode2.Name = "NodeLst1";
treeNode2.Text = "Transistor";
treeNode2.ToolTipText = "A transistor";
treeNode3.Name = "NodeLst2";
treeNode3.Text = "Battery";
treeNode3.ToolTipText = "A simple battery";
treeNode4.Name = "NodeLst";
treeNode4.Text = "lowest";
treeNode4.ToolTipText = "The lowest things of circuts";
this.treeItems.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode4});
this.treeItems.ShowRootLines = false;
this.treeItems.Size = new System.Drawing.Size(83, 376);
this.treeItems.TabIndex = 0;
this.PB.Dock = System.Windows.Forms.DockStyle.Fill;
this.PB.Location = new System.Drawing.Point(0, 0);
this.PB.Name = "PB";
this.PB.Size = new System.Drawing.Size(521, 376);
this.PB.TabIndex = 1;
this.PB.TabStop = false;
this.PB.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PB_MouseMove);
this.PB.Paint += new System.Windows.Forms.PaintEventHandler(this.PB_Paint);
this.PB.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PB_MouseClick);
this.PB.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PB_MouseUp);
this.PB.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PB_MouseDown);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(608, 425);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Form1";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.PictureBox PB;
private System.Windows.Forms.TreeView treeItems;
}
}
Program.cs:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace NiklasUlvinge.ChipsEater
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
}
strom.cs
namespace NiklasUlvinge.ChipsEater
{
struct Strom
{
public float l, r;
public Strom(float left, float right)
{
l=left;
r = right;
}
public static Strom operator +(Strom a, Strom b)
{
return new Strom(a.l + b.l, a.r + b.r);
}
public static bool operator ==(Strom a, Strom b)
{
if (a.l == b.l && a.r == b.r)
return true;
else
return false;
}
public static bool operator !=(Strom a, Strom b)
{
return !(a == b);
}
}
}
the new item.cs file:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace NiklasUlvinge.ChipsEater
{
abstract class Item
{
public Item[][] input;
public int x;
public int y;
public abstract Strom LeftOutput
{
get;
}
public abstract Strom RightOutput
{
get;
}
public abstract Point[] Snap
{
get;
}
protected Item(int X, int Y)
{
x = X;
y = Y;
input = new Item[1][];
}
public abstract void function();
public abstract void draw(Graphics g);
public void addBothInput(int index, Item Input)
{
Input.addInput(1 - index, this);
this.addInput(index, Input);
}
private void addInput(int index, Item Input)
{
index = input.Length & index;
Item[] inp = input[index];
Item[] titem;
if (inp == null)
{
titem = new Item[1];
}
else
titem = new Item[inp.Length];
for (int i = 0; i < titem.Length - 1; i++)
{
titem[i] = inp[i];
}
titem[titem.Length - 1] = Input;
input[index] = titem;
}
public Strom combinedInput(int index)
{
Strom r = new Strom(0, 0);
if (input[index] == null)
return new Strom(0, 0);
else
{
for (int i = 0; i < input[index].Length; i++)
{
if (index == 0)
r += input[index][i].LeftOutput;
else
r += input[index][i].RightOutput;
}
return r;
}
}
protected Brush surf = Brushes.LightGray;
protected Pen side = Pens.DarkGray;
protected Pen loff = Pens.Black;
protected Pen lon = Pens.Red;
}
class Null : Item
{
public override Strom LeftOutput
{
get
{
return new Strom(0, 0);
}
}
public override Strom RightOutput
{
get
{
return new Strom(0, 0);
}
}
public override Point[] Snap
{
get
{
return new Point[0];
}
}
public Null(int X, int Y)
: base(X, Y)
{
}
public override void function()
{
throw new Exception("The method or operation is not implemented.");
}
public override void draw(Graphics g)
{
throw new Exception("The method or operation is not implemented.");
}
}
class Transistor : Item
{
protected float[] output;
public Null theNull = new Null(-50, -50);
public override Strom LeftOutput
{
get
{
return new Strom(0, 0);
}
}
public override Strom RightOutput
{
get
{
return new Strom(0, 0);
}
}
public override Point[] Snap
{
get
{
return new Point[3] {
new Point(x - 16, y - 1),
new Point(x + 3, y - 16),
new Point(x + 3, y + 16)};
}
}
public Transistor(int X, int Y) : base(X, Y)
{
input = new Item[4][];
output = new float[1];
}
public override void function()
{
}
public override void draw(Graphics g)
{
IntPtr intp;
if (combinedInput(0) == new Strom(0, 0))
if (combinedInput(1) == new Strom(0, 0))
if (output[0] == 0)
intp = Properties.Resources.trans000.GetHbitmap();
else
intp = Properties.Resources.trans001.GetHbitmap();
else
if (output[0] == 0)
intp = Properties.Resources.trans010.GetHbitmap();
else
intp = Properties.Resources.trans011.GetHbitmap();
else
if (combinedInput(1) == new Strom(0, 0))
if (output[0] == 0)
intp = Properties.Resources.trans100.GetHbitmap();
else
intp = Properties.Resources.trans101.GetHbitmap();
else
if (output[0] == 0)
intp = Properties.Resources.trans110.GetHbitmap();
else
intp = Properties.Resources.trans111.GetHbitmap();
g.DrawImage(Image.FromHbitmap(intp), x - Image.FromHbitmap(intp).Size.Width / 2, y - Image.FromHbitmap(intp).Size.Height / 2);
}
}
class Cord : Item
{
public int x2, y2;
public Null theNull = new Null(-50, -50);
public override Strom LeftOutput
{
get
{
return combinedInput(1);
}
}
public override Strom RightOutput
{
get
{
return combinedInput(0);
}
}
public override Point[] Snap
{
get
{
return new Point[2] {
new Point(x, y),
new Point(x2, y2) };
}
}
public Cord(int X1, int Y1)
: base(X1, Y1)
{
input = new Item[2][];
}
public override void function()
{
}
public override void draw(Graphics g)
{
g.DrawLine(combinedInput(0) == new Strom(0,0) ? loff : lon,
x, y, x2, y2);
}
public override string ToString()
{
return "L: l" + combinedInput(1).l + " r" + combinedInput(1).l + "R: l" + combinedInput(0).l + " r" + combinedInput(0).l;
}
}
class Battery : Item
{
public Null theNull = new Null(-50, -50);
public override Strom LeftOutput
{
get
{
return new Strom(100,-100);
}
}
public override Strom RightOutput
{
get
{
return new Strom(-100, 100);
}
}
public override Point[] Snap
{
get
{
return new Point[2] {
new Point(x - 5, y),
new Point(x + 5, y) };
}
}
public Battery(int X, int Y)
: base(X, Y)
{
input = new Item[2][];
}
public override void function()
{
}
public override void draw(Graphics g)
{
g.DrawLine(lon, x - 2, y - 10, x - 2, y + 10);
g.DrawLine(lon, x + 2, y - 6, x + 2, y + 6);
g.DrawLine(lon, x - 2, y, x - 5, y);
g.DrawLine(lon, x + 2, y, x + 5, y);
}
public override string ToString()
{
return "L: l" + combinedInput(1).l + " r" + combinedInput(1).l + "R: l" + combinedInput(0).l + " r" + combinedInput(0).l;
}
}
}
Niklas Ulvinge aka IDK
|
|
|
|
|
Hello again gurus,
Now I can concatenate two nibbles into a byte, how can I do the reverse operation??
That is extracting the high nibble and low nibble from a byte?
Thanks for the help
Best regards.
There is no spoon.
|
|
|
|
|
|
To get the high nibble, you shift the value four bits to the right.
To get the low nibble, you mask out the lower four bits.
hi = myByte >> 4;<br />
lo = myByte & 15;
---
b { font-weight: normal; }
|
|
|
|
|
Dear All,
How can I marshall the following attributes in the following structure;
typedef struct IplImage
{.
.
struct _IplROI * roi;
void * imageid;
}
where _IplROI is itself a structure?
Another question is that the function unmanaged prototype is ;
IplImage * cvvLoadImage(const char * filename);
do I have to marshall the return type after defining the IplImage or I just write "IplImage *" after marshalling the structure??
Please Help,
Thanks and Best Regards,
E.A.
|
|
|
|
|
can anyone kmow how to program my problem about looping and factorial in c programming? please....ill w8 for your reply...
|
|
|
|
|
What is the problem, then?
---
b { font-weight: normal; }
|
|
|
|
|
Non-recursive version (not tested):
-----------------------------------
<br />
int Calc(int i) {<br />
<br />
int fact = 1;<br />
for (int j = i; j > 1; j--)<br />
fact *= j;<br />
<br />
return fact;<br />
}<br />
Recursive version (from MSDN):
------------------------------
<br />
int Calc(int i) { <br />
return((i <= 1) ? 1 : (i * Calc(i-1))); <br />
}<br />
|
|
|
|
|
|
I’ve mad an application (or apart of an app) in C++ that I’d like to use in .NET C# Windows Application.
The thing I like to accomplish is to build some kind of component of my existing C++ app and expose some functions that I later can call from the C# app.
The application I like to encapsulate can be seen ass a window (MFC CWnd in my case).
My fist question is if this is possible? If, then my second Q is How..?
I’ve made som COM and ActiveX programming but I don't (if it's possible) want to solve my problem that way.
I’m not expecting a total solution of my problem but Ideas where to start would be great.
Articles about this would be great. (Have not found any of them myself…)
_____________________________
...and justice for all
APe
|
|
|
|
|
Hello gurus,
As the subject of this topic says, I wish to know how to concatenate 2 nibbles to give 1 byte in C#?
Thanks for the help.
Best regards.
There is no spoon.
|
|
|
|
|
Multiply the most significant nibble by 16 and add them together.
---
b { font-weight: normal; }
|
|
|
|
|
hi guffa,
a code snippet maybe? thanks
There is no spoon.
|
|
|
|
|
|
ah, just what I needed
Thanks
There is no spoon.
|
|
|
|
|
Use the following code :
byte nib1,nib2,finalByte;
finalByte = (nib1 << 4) | (nib2 & 0x0f);
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls
|
|
|
|
|
Thanks!
There is no spoon.
|
|
|
|
|
When I dispose Control calling Control.Dispose() method, deactivate window and then re-activate window, I get ObjectDisposedException .
Does anybody know how to avoid Windows.Forms creating handle of a disposed control?
|
|
|
|
|