|
You can actually manipulate pointers in C#, in an unsafe block.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
I very happy to see your reply. Thanks a lot Christian.
Could you please give me some sample code so that i can understand better.
Thank You
Viji
VIJI
|
|
|
|
|
i need to make update for my program from the internet?
i make folder and add it to iis as virual directory
then i write into my program
string _Path = "HTTP://19.19.19.1/Updateprogram";
file.copy("HTTP://19.19.19.1/Updateprogram/sa.exe","C:\dsds.exe");
but make error : not support this format
what i can solve my probelm
123
|
|
|
|
|
Pretty simple to do, but you need to use HttpWebRequest for this.
HttpWebRequest request = HttpWebRequest.Create("http://19.19.19.1/UpdateProgram/sa.exe");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
StreamWriter writer = new StreamWriter("C:\\Temp\\sa.exe");
while (!reader.EndOfStream)
{
writer.Write(reader.Read());
}
reader.Close();
writer.Close();
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
Hi Everyone..
I am developing one windows application..I am designing one user control in which I have dataGridview..In gridview I need coloumns of types combobox,textbox..well rest of the things are fine but I that textbox is requrd to be bind dynamically from data base and must have scrollable(multiline) property..can anyone plz tell me how to make it multiline..bcoz in property box i didnt found any such property..
Regards,
Rahul
|
|
|
|
|
Hello,
Rahul83 wrote: in property box i didnt found any such property..
I really can't believe that!
YourTextBox.Multiline = true;
YourTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
All the best,
Martin
|
|
|
|
|
You must look at the properties again
bcz there is a property for multiline
|
|
|
|
|
Hi,
Iam currently converting a exsisting VB6 application to C#. I want include CHM help file in it. How to achieve it in C#. Are there any native methods available in C#. Plz help me out.
|
|
|
|
|
You can use the "System.Windows.Forms.Help" Class.
This class Encapsulates the HTML Help 1.0 engine.
and use this function to open ur chm file :-
Help.ShowHelp(YourParentForm , YourchmHelpFilePath , HelpNavigator)
All the Best
The CodeRider
|
|
|
|
|
Hello!
I have a project in C# ASP.NET. It is some kind of web-office for our clients. I need to forbid caching of all information and put in cache all images in order to save time and money of our clients.
Thank you.
|
|
|
|
|
I am trying to decompress a file. To do this, with my current code which you can see below, I am reading the entire file into a byte[]. But if my file is big, I believe bigger then 64 KB, then I can't declare a byte[] big enough to hold the file. How do I fix this, work around this?
---------Code---------
public void GZipDeCompressStream(Stream InStream, Stream OutStream)
{
//Decompresser
GZipStream gzDecompressed = new GZipStream(InStream, CompressionMode.Decompress, true);
//Retrieve the size of the decompressed file from the compressed footer
byte[] bufferWrite = new byte[4];
InStream.Position = (int)InStream.Length - 4;
InStream.Read(bufferWrite, 0, 4);
InStream.Position = 0;
//Convert to int for using in declaring our Byte[] size
int bufferLength = BitConverter.ToInt32(bufferWrite, 0);
//Create our Buffer: size + 100
------------//This is where my issue is. Buffer Lenght is WAY bigger then the 64 KB limit.
byte[] buffer = new byte[bufferLength + 100];
int readOffset = 0;
int totalBytes = 0;
// Loop through the compressed stream and put it into the buffer
while (true)
{
int bytesRead = gzDecompressed.Read(buffer, readOffset, 100);
// If we reached the end of the data
if (bytesRead == 0)
break;
readOffset += bytesRead;
totalBytes += bytesRead;
}
// Write the content of the buffer to the destination stream
OutStream.Write(buffer, 0, totalBytes);
// Close the streams
InStream.Close();
gzDecompressed.Close();
OutStream.Close();
}
|
|
|
|
|
is long bigger than int in C# ? I thought it was.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
This post does not make sense in the context of my question, or you didn't explain yourself well enough.
|
|
|
|
|
You're storing the size in an int. A long is bigger.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Ahh. The problem wasn't int being big enough. The problem was making a byte[] that was big enough. My byte[]'s total size in memory was greater then 64kb. The other post though should solve my issues.
|
|
|
|
|
Yeah, long is System.Int64, and int is System.Int32;
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
There is no 64KB limit on arrays. If you get close to 2GB you might have problems on 32 bit systems.
But anyway, the solution to your problem is quite simple - no need to keep all the data in memory, just save it as you go:
byte[] buffer = new byte[1024*1024]; // 1MB buffer
while (true)
{
int bytesRead = gzDecompressed.Read(buffer, 0, buffer.Length);
// If we reached the end of the data
if (bytesRead == 0) break;
outStream.Write(buffer, 0, bytesRead)
}
|
|
|
|
|
You are awesome. That totally solved my problem and she works great now.
Thanks a Million.
--Peter
|
|
|
|
|
Hi,
1. How can you resize a picture stored in a Bitmap object.
2. Why is it not a real icon when you save it as ImageFormat.Icon
Thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
1 - You can create a new bitmap of the right size, and copy it through a graphics object. You can also just display it at a different size, if that's all you need.
2 - I have no idea, what makes it not real ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Thank you Christian, regarding (2), simply when you save it as an icon that way, it's not displayed along with the other icons as "an icon", you dont see the icon!! you just see the file as if it's a corrupted file and the only way to view it is to set the container folder view as "thumbnail", simply it still acts like a picture file with a missing icon!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: How can you resize a picture stored in a Bitmap object.
Create a new Bitmap object with the size you want, create a Graphics object for it, and draw the original image on it scaled to the size.
Muammar© wrote: Why is it not a real icon when you save it as ImageFormat.Icon
In what way is it not a "real" icon?
Have you included any mask in the image? I don't know how to do this exactly, but I suppose that you would add it as another frame to the image.
---
single minded; short sighted; long gone;
|
|
|
|
|
mask.. frame.. Even more puzzled!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Icons use a specific color as a transparency mask.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
bm.MakeTransparent(colorDialog1.Color); still not working.. Please christian, help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|