|
Your problem is caused because the ASCII enconding uses only 1 byte per char.
I don't know what SNMP uses, wheter Unicode, UTF-8, UTF-16, etc, check your docs. If using, e.g., Unicode, try this:
char[] cha = Encoding.Unicode.GetChars(byte_array);
The Encoding class has also a getEncoding method which supports lots of different encodings.
Help me dominate the world - click this link and my army will grow
|
|
|
|
|
I have been pulling my hair out trying to get AxBrowser and mshtml components to work properly, if anyone can help me out, it would be much appreciated...
First of all, what I am trying to achieve is basically to get AxBrowser to print properly using:
AxWebBrowser.ExecWB( SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER, ref obj, ref obj );
where obj = null.
I have two AxBrowsers running at the same time, one that is hidden from the user's view (but not set to Visible=false since this causes an exception to be thrown everytime you try to print). I dynamically generate html which is then saved to file via the use of the StreamWriter class, then I call AxBrowser.Navigate(...) [for the AxBrowser that the user can actually see] to the new file.
If they want to print it out, they can (without problems using the above mentioned line of code). However, these things that I am generating for the user to see are created from an XML document that is run through XSL. Long story short, the XML file contains different items that get transformed in html, and the user is allowed to print ALL the items that are available on the XML document. Now, to do this, I generate all documents in the background and display it on the other AxBrowser (the one which the user cannot see so that the AxBrowser that they CAN see doesnt flicker and change documents in front of them), then tell it to print.
The problem is, after I save the html to file, tell the browser to navigate to it, then call the ExecWB print command, it seems to print out it's HTMLDocument's previous html content.
For example, the "hidden" AxBrowser is first initialized and navigated to "about:blank". The user clicks on Print All, so my code generates the html, saves it, tells the "hidden" AxBrowser to navigate there, then calls the ExecWB print command. Instead, what it DOES print out is a blank page! Then if the user tries to Print All again (but selecting a different display format), AxBrowser prints out the PREviously generated document.
Is there any explanation for this behaviour??
Also, there is the issue with AxBrowser always printing out the default headers and footers. There doesn't seem to be an easy way of setting the header/footer text WITHout modifying the registry. Microsoft has an article on how to do it via the ExecWB command, however it is in C++ at:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q267/2/40.ASP&NoWebContent=1[^]
I am very unfamiliar with C++ and just need a way to do what that code suggests, but in C#. Does someone have another way of doing this? I know that you can prompt the user to edit the page settings, but thats not what I want to do. The only prompting I want done is for the user to select the printer that they wish to print to.
Thanks for any help!
- mephist
|
|
|
|
|
Hi all
I have a speciffic task of which i do not know how to start on.
The task is to create a virtual drive (like a ram drive og deamon tools). Through this drive files are to be saved and loaded like a normal drive, but the "files" are created runtime by my program. The idea is that the program accessing the drive can not tell the diffrence.
Here is what i need:
- How to register the drive with windows.
- How to create a connection between the drive and my program.
- Which drive operations to implement in my program.
Thats all
Thanks
Jens
|
|
|
|
|
This is device driver material and you are asking it in a C# forum. You can't get there from here in languages at this level of abstraction. Sorry.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
if you dont want to create a drive you could create a shell extension.
I think theres is an article on here with regards to that.
Try having a look at
Shell extension framework[^
James Simpson
Web Developer
imebgo@hotmail.com
|
|
|
|
|
Sounds interesting, i'll look further into that, thanks!!!
Jens
|
|
|
|
|
Sounds interesting, i'll look further into that, thanks!!!
Jens
|
|
|
|
|
What is the technical difference between defining a string this way:
<br />
string s = "this is my string";<br />
and this way?
<br />
string s = @"this is my string";<br />
|
|
|
|
|
using the @ means you don't have to escape the \ character eg.
string s = "\\\\Server\\folder";
it the same as
string s = @"\\Server\folder";
Grant @ Loki
|
|
|
|
|
sheesh, you beat my by two minutes.... hehe... that's what I get for reading down the page first
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Mike Ellison wrote:
What is the technical difference between defining a string this way:
string s = "this is my string";
and this way?
string s = @"this is my string";
Well the first would try to escape certain characters followed by a slash
string s = "this is a line \n with a newline embedded";
string s = @"this is a line \n with a slash n embedded";
The @ sign tells the compiler "this is a literal string, don't escape the characters after the slash".
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
|
|
Mike,
It looks like everyone has answered you question here. I just wanted to add that strings that are defined with the "@" sign are called verbatim strings.
-Nick Parker
|
|
|
|
|
Thanks, Nick. Every bit of useful information helps!
|
|
|
|
|
What is the difference between different types of report in crystal report like crosstab, sub report etc as when i have developed i these report i cannot tell by watching them that this is sub report or this is crosstab or this is drill down. My question is actually that what makes these reports different from one another or what is the basic property that will be in one report so that we can say that this is standard, this is crosstab etc. please answer it thoroughly. thanks
Inam
|
|
|
|
|
|
The difference between readonly and const is _not_ just that readonly can be initialized in the constructor. Readonly variables are still variables, i.e. they are a location in memory that contains a value. Const's are just values known at the compile time and they are burned into whatever code references them at compile time, not looked up at execution time like readonly's.
The compiler needs to know the values in the switch statement to generate the code optimally.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
|
I use readonly regurlarly for ArrayLists and Hashtables
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
readonly are very good for default parameter values, because they don't introduce versioning problems. With const, the value can be splattered all over several DLLs, and if you need to change a constant value, you'll need a full recompile (sometimes impractical, specially if you are writing a framework). With readonly, you have full control of the value of a constant.
Help me dominate the world - click this link and my army will grow
|
|
|
|
|
Building on what leppie and Daniel have said:
You cannot use const in conjunction with your own data types* because they need to be complete at compile time. You can however use readonly with your own data types.
Another scenario is instances where something should be treated as a constant but can't because the constant can change depending on certain behavior. For instance, a class which will perform currency conversion; depending on the two currencies being converted the factor will differ. You can of course expose this factor as a read-only property, but there is nothing to stop your code from changing that value once an instance has been created. If you make the factor readonly though the compiler will ensure you don't change the factor after creating an instance of the class.
Bad example, I know, but just one possibility
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
I am having problems creating large Bitmap object. I am using the Bitmap class in C# and my application requires the creation of a large (greater than 46340 x 46340) image. During execution of:
Bitmap bmp = new Bitmap(width, height);
I get the System.ArgumentException when the width value is set to 46341 and the height value is set to 46341. I dont get this error if the imagesize is 46340x46340. I understand that I am crossing the limit of a signed 32bit integer with the value of 46341x46341. Is this a limiting factor? How do I get around this problem.
I would appreciate any help.
Thank you.
-SpinD
|
|
|
|
|
If this is not a monochrome bitmap, i.e. 1 bit per pixel, then give up now. You only have 2GB of address space to work with using the current CLR on Win32. Even an 8bit palette image of that size would no longer fit in memory.
If you really need to work with images that size obviously you aren't displaying them on the screen, so don't try to load them all into memory. Don't use Bitmap; treat them as data on the disk.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Hi
How can i access COM Ports in C#
raheela
|
|
|
|