|
I created a class in Visual C++.NET 2005
and I tried to use it in C#.NET 2005
I have a function in the class that has a parameter of char * and in C# it is seen as sbyte *
I was wondering what's the difference ?
And how can I make C# see the char * variable as char * so that it can be used as a string.
If it isn't possible, please suggest alternatives.
Thanks,
Clint
|
|
|
|
|
C++ classes are not compatible with C#. However, you can call a specific function using P/Invoke. Just search for it.
Alex Korchemniy
|
|
|
|
|
In C++ the char datatype is a signed byte. In C# the char datatype is a Unicode character, e.g. a 16 bit data type.
You have to decode the C++ string from whatever encoding it uses. Look in the System.Runtime.InteropServices namespace if there is something built-in that does this.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hello !
I was wondering whether it is possible through data source or someother way make the data grid to load only the information which is visible so that loading time of the form won't be long and also the data would be shown ?
thanks,
Clint
|
|
|
|
|
No the DataGrid is plain too dumb for this. Either try out the DataGridView (coming with .Net 2.0) in VirtualMode, split the data yourself and let the user page the data or use this grid[^] which can also be virtual and allows about any size to be displayed (I tried it with 100 columns and 100 mio rows and beside some selection problems it worked really good).
|
|
|
|
|
|
|
Can anyone tell me how to ping another pc.Actually i am working on a grid project using alchemi architecture in which i have to see whether the executors are working or not so that the threads can be distributed among them.
-- modified at 19:40 Monday 15th May, 2006
|
|
|
|
|
|
I want to hide the processes in the task manager using C#.Let me tell you it's only for the learning purpose it doesn't mean that i want to make a key logger.
I would appreciate if someone helps me
Fahad Ali
|
|
|
|
|
I'll tell you how to do it on 98
On 2k / XP it's not going to happen with C#, sorry.
Alex Korchemniy
|
|
|
|
|
I could use some advice on how to automate the following .aspx upload snippet to where there would be no user interaction required and all form field values would be passed instead of keyed in. A C# class to do this work would be ideal. I know that I would need to use a HttpWebRequest method, but I am unsure how to do this use using just a C# class.
The .aspx form code below is what I am trying to automate. Thanks.
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="https://somesite.com/someuploadpage.aspx" ID="Form7">
<input type="text" name="FOLDER"> FOLDER<br>
<input type="text" name="PORT_ID"> Port Id
<input type="text" name="Id" ID="Text1"> Id
<input type="PASSWORD" name="PASSWORD"> Pwd
<INPUT TYPE="FILE" SIZE="40" NAME="FILE1" ID="File1"><BR>
<input type="text" name="Type1"> Type
<input type="text" name="INVOICE_NUM" ID="INVOICE_NUM"> INVOICE_NUM
<input type="text" name="TOTAL_FEE" ID="TOTAL_FEE"> TOTAL_FEE
<INPUT TYPE="SUBMIT" VALUE="Upload!" ID="Submit6" NAME="Submit6">
</FORM>
GG
|
|
|
|
|
Look at the System.Net.WebRequest documentation. It shows much of what you need.
Then you need to learn how to put the request data together for posting form variables. They are basically an amperstand (&) delimited collection of name=value pairs of strings where the values are URL Encoded.
So an un-encoded string containing form variables named (this,date,theother) would look like:
this=that&date=5/15/2006&theother=whatever you need
The value portions would need to be urlencoded. See System.Web.HttpUtility.UrlEncode.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Thanks for advice. I will look in the documentation provided for the System.Net.WebRequest.
GG
|
|
|
|
|
How can i generate random Int64 with c#
|
|
|
|
|
System.Random.NextBytes()[^]
Here's another way:
System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider ();<br />
Byte[] bytes8 = new Byte[8];<br />
rng.GetBytes (bytes8);<br />
Int64 rand = BitConverter.ToInt64 (bytes8, 0);
Jon Sagara
When I grow up, I'm changing my name to Joe Kickass!
My Site | My Blog | My Articles
|
|
|
|
|
|
Judah Himango wrote: long rand64 = rand.Next() + rand.Next()
I hope that was a joke
|
|
|
|
|
It wasn't, what can I say, for some reason I was thinking that would work but of course it won't. +
I guess a better idea would be to use the Random.NextBytes, then generate a long from those bytes. Something like
Random rand = new Random();
byte[] longBytes = new byte[8];
rand.NextBytes(longBytes);
long random64 = BitConverter.ToInt64(longBytes, 0);
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Islamic Domination: Coming to a Jewish state near you!
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I was thinking more along the lines of:
long r64 = (long)r.Next() << 32 + r.Next();
|
|
|
|
|
|
Random r = new Random();
Int64 i = (Int64)r.Next() + ((Int64)r.Next() << 32);
|
|
|
|
|
Hi
How do I read one line at a time from a text file?
I use the .ReadLine, now when i click my ReadFromFile button it reads the first line prints it to txtBox, which is fine but now when i click ReadFromFile again it must go to the next string in my textfile and write that line to my textBox. So everytime i click Next it must show me the next line from the txtFile.
I know its easy stuff, but im a beginner.
Please help
|
|
|
|
|
You need to contain the object you are using to read the file (MyObject.ReadLine) in the proper scope. If you are starting out in software development there are fundamental constructs (like scope) that you must understand or you will quickly be lost in a pile of spaghetti code.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|