|
thepersonof wrote: char[] chars = new char[iRx + 1];
System.Text.Decoder d = System.Text.Encoding.ASCII.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
string szData = new System.String(chars);
Thats is becos you are appending a \0! And buffer probably already contains a terminating \0.
|
|
|
|
|
You can't display the character \0, there is no character glyph for that character code in any fonts. It's used as an end marker for zero terminated strings. Strings in .NET don't use a terminator character, so you can just trim that character away.
If you want to show that there is a \0 character, you have to replace it with characters that are possible to display, for an example:
MessageBox.Show("buffer:"+b+" sz:"+szData.Replace("\x00", "[0]"));
---
b { font-weight: normal; }
|
|
|
|
|
Thanks.
I have another slight problem. When I try to recieve data a second time nothing is recieved. The OnDataREcieved callback runs repetedly with no data. do I need to do something to clear the socket befoer recieving more data.
Cheers
|
|
|
|
|
|
Hi
I have the following error:
Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.List<u2.friend>' is less accessible than field 'u2.Prog.friends' C:\Documents and Settings\Ben\My Documents\Visual Studio 2005\Projects\u2\u2\Prog.cs 21 29 u2
The Glob class is internal and the Prog class is public.
This is the code that causes the error:
if (Glob.Prog.friends.Count == 0)
cheers
|
|
|
|
|
hi all i want to creat a tool that provides search and find to the text in the document also i want to know how to make my text editor writes the documents in pages rather than textbox
thank u all
abdelhameed81
|
|
|
|
|
hi
i want to use flash movie in my app how to do that ?
please give me an component or dll that i use it ..
thanks
|
|
|
|
|
http://www.codeproject.com/csharp/flashexternalapi.asp[^]
.............................
There's nothing like the sound of incoming rifle and mortar rounds to cure the blues. No matter how down you are, you take an active and immediate interest in life.
Fiat justitia, et ruat cælum
|
|
|
|
|
I have a print preview dialog that allways previsualates what is due to be printed. The previsualization work's fine, but the printing fails.
I think that this may occur because at the printing algortihm the document.Print(); is called again.
Is there any posibility to print directly the data previsualizated (into the control) without beeing necesary to recalculate (generate) it (through the document ?
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Not in an easy way me thinks
Ed
|
|
|
|
|
Hi
You can do this by deriving a class from PrintController .
When the dialog "prints" to generate the preview, save the metafiles produced. Then when the dialog "prints" to the printer, just return the saved images.
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
Can you supply me with a pice of code pls ...
Currently I have no ideea how to achive that ...
BTW, thank you for your answer
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Nicholas wrote an article on how to get the meta files of the preview and store them as images. You can find it here[^]. You will have to redirect the meta files into a new print job.
Note that you nevertheless need another PrintDocument.Print cycle but you won't have to regenerate the output.
|
|
|
|
|
Thanks, exactly what I had to read before implementing an dirty method for obtaining the PageInfo from the preview control (reflection way). Didn't see the GetPreviewPageInfo() procedure.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
If this is the case, (print preview is fine, print is not) then chances are you have some variables not reset somewhere, or set to the wrong value. I would suggest trying to figure out exactly what the problem is before "masking" the problem with another solution.
Aaron
|
|
|
|
|
The problem was simple, I was doing a heavy print job, each page lasted for 1 sec to generate and there wore at least 10 pages. The request from the client was to be able to preview what is due to be printed. The solution I approched was this : into the print document I did a lot of heavy work ( the preview looked ok ) and in an inharited printPreviewDialog, on a print request, using reflection, I printed what was in the cache of the dialog (with out calling the document.Print() method again.
I think that the dialog I designed can be usefull, so I intend to create an article based on it, but not now, currently I am time pressed.
PS: thank you for your answer.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Hi all,
I would like to get a list of Windows Desktop Shortcut's so I can build a list (with associated icons). How can I do this and display the icon and trigger the app when the link is selected?
Thanks in advance.
Stephen
|
|
|
|
|
Probably you should get list of *.lnk files in desktop directory:
DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
FileInfo[] fi = di.GetFiles("*.lnk");
Keep in mind, that system links (My computer, My Documents) has no lnk file.
Then, for each lnk file you should call shell function CreateShortcut:
IWshRuntimeLibrary.WshShellClass ws = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut sc;
for (int i = 0; i < fi.Length; i++) {
sc = (IWshRuntimeLibrary.IWshShortcut)ws.CreateShortcut(fi[i].FullName);
}
Don't forget to add reference to %system32%\wshom.ocx.
sc object will hold all information about link:
sc.TargetPath - link target
sc.Arguments - launch arguments
sc.IconLocation - string, that could be used to get icon.
These two articles could be helpful for icon extraction:
Win32
.NET
Hope it helps.
____________________________________________
Robin Panther http://www.robinland.com
|
|
|
|
|
Hi
How can I add a child to a node which I know the index of? the only examples I can find are using the "selectednode" property.
cheers
|
|
|
|
|
try treeView.Nodes[index]
Ed
|
|
|
|
|
Thanks. Now that I've selected the node how will i be able to add a child?
cheers
-- modified at 4:10 Saturday 1st April, 2006
|
|
|
|
|
1) You don't need to select it to add nodes
2) treeView.Nodes[index].Nodes.Add(new TreeViewNode)
Ed
|
|
|
|
|
|
Hey
Basically I have a project with several forms which each need to access teh same instance of the Prog class. Where should I define this instance to make it visible to all forms?
Cheers
|
|
|
|
|
Hi
I create a Glob class ( Global is a keyword ), then create public static properties for global variables.
internal class Glob
{
private Glob() { }
private static Prog _Prog = null;
public static Prog Prog { get { return _Prog; } set { _Prog = value; } }
}
Some people say that global variables are a bad thing, but like any construct, they are sometimes useful
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|