Hello, I just want to know if it's possible to do sintax highlighting with .net richtextbox without extending that class. I've seen that there're two examples on codeproject but they extend the dll, and I can't. Thanks you Bests, Paolo
Paolo Ponzano
Posts
-
RichTextBox and highlighting -
Exceptions Weightthank you, nut in that way can I also know the type of exception that has been thown? Thanks Paolo
-
Exceptions WeightHello people, I was speaking with a friend of mine about which are the most performance-decreasing exceptions that may occurr during the execution of a program. The application we were talking about is an enterprise one,(for which we're involved all day long in coding) and it has classical structure from PL to DO. We have taking the conclusion that the System.Xml.Schema.XmlSchemaException class and the Parse one are the ones that teorically can affict our application most. How can we check the entire production to trace the exception's count? What are the most common exception that you've found? Thanks a lot Paolo Ponzano -- modified at 3:44 Saturday 22nd October, 2005
-
Adding a field to a ListViewItemexcuse me, what u mean for base class? System.Windows.Forms??? thanks in advance Paolo
-
Adding a field to a ListViewItemHello, I'm getting stucked at this point : I've created a new class called ListViewItemEn that inherits from ListViewItem, I need to add a String into this new class called FullPath, since this point is all ok, my problem is that I'm not able to override the constructor
public ListViewItemEn(String[] text, String path) { }
I should add all the string of text into subitems, but it starts adding in the 2° column Here's my codepublic ListViewItemEn(String[] text, String percorso) { this.FullPath = percorso; for (int i=0; i< text.Length;i++) { this.SubItems.Add(text[i]); } }
How can I solve that? thanks in advance Paolo -
Listview and Event on Compact .net fwHello, I'm trying to develop a simple Explorer, just to kill time, I've got a problem for what concern context menu and listview's item. I try to explain at my best. I tryied to use
this.listView1.ItemActivate += new System.EventHandler(this.item_Selected);
to catch ItemActivate event and here's the function's codeprivate void item_Selected(object sender, System.EventArgs e) { try { ListViewItem currentItem = this.listView1.FocusedItem; ---> currentItem.ListView.ContextMenu = itemMenu; FileInfo f = new FileInfo(currentItem.Text); //FileInfo f = new FileInfo(currentItem.Text); if(f.Attributes == System.IO.FileAttributes.Directory)
how do I reset the context to default one when no item are selected? and why I've difficulties to unselect the line I checked?? is a problem of itemactivate event?? Thanks Paolo -
Problem Creating XML [SOLVED]Hello, I'm trying to save into a xml file some rows that my programs generates, the number of lines to insert into the file is about 2000 and when I generates it, stops into the middle of a line without generation an exception. Anyone knows of such a problem? all the lines have the same structure and they're printed ok on console. If u need I can paste the code, but I don't if it's too large the number of elements I try to insert. Thanks Paolo ok.....was my fault, with a little more of patients I found that I was missing
xtw.close();
and so the flush of object was not written into file, now that all is ok, I continue playing with my new toy!:-O -
How to detect Network Cable Unplug EventsHello, sometimes I got a network cable disconnect or network cable unplugged event, and I would like to develop a small app to check when it happens and to log it, what api should I use?? Thanks in advance Paolo
-
Defining excepionHello, I just want to override the System.Exception in order to log when an exception occurrs in an XML file, for doing that I tought I sould declare a class called exception and then to do
public class Exception : System.Exception { .... }
but I don't know to say to code that I want to use my exception when I docatch (Exception ex) { .... }
thanks Paolo -
An object reference is required for the nonstatic field, method, or property .... why??and excuse me how do I fix that?? Form1 calls password's form creating a new instance of the password object, how do I tell password's one to relay to form1 object?? thanks Paolo
-
Visual Studio .Net 2003 & IIS 6.0I try to access using localhost, my notebook has not a static ip, since I use dhcp. Have I to assign s static ip and use it?? thanks Best Paolo
-
Visual Studio .Net 2003 & IIS 6.0hello, I would like to develop web applications on my notebook with windows 2003 server but I noticed that if I unplug the network cable, I can't access to iis server, anyone knows how to fix that?? thanks Paolo
-
RegOpenKey and similar .... marshal/P-Invoke??thanks you opened my eyes =), I was just playing around with that class but a new problem came at my hands...... if I want to use a recorsive function to process keys how I do that?? In Win32 API, I've RegEnumerateKey/Values here the most similar thing is
String [] subkey = rk.GetSubKeyNames();
, so I doprivate void AddRegNode(TreeNode node, RegistryKey root) { RegistryKey rk = root; String [] subkey = rk.GetSubKeyNames(); if(subkey.Length==0) return; //if I've no subkeys so I've got only leap foreach (String s in subkey) { String livia = rk.Name + "\\" + s; RegistryKey temp = Registry.CurrentUser.CreateSubKey(livia); TreeNode newNode = new TreeNode(s); this.Tree.SelectedNode.Nodes.Add(newNode); AddRegNode(newNode, temp);
but doing so it doesn't work, first all the nodes are added to selected node, but I'l fix it, second it desn't go deeper ( HKEY_CURRENT_USER\AppEvents\EventLabels is max deep it reaches) thanks Paolo -
RegOpenKey and similar .... marshal/P-Invoke??hello, I just want to write my own Regedit in C#, just start developening it for windows xp and then move to Windows CE .NET, but remaining in the contest of the thread, I saw that Registry's API are not implemented as method, so I think I shall use P-invoke?? my question is : in C I've got
LONG RegOpenKey( HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult );
I can do:[DllImport("advapi32.dll")] public static extern int RegOpenKeyEx(System.UInt32 hKey, String lpSubKey, System.UInt32 ulOptions, System.UInt32 samDesired, System.UInt32 phkResult);
1) I'm not sure if I've setted types correctly 2) how I define in C# code variable for phkResult? If I define it as UInt32 I can't do as I do in C &phResult... Thanks in advance, Paolo -
Encryption/Decryption Routines AESHello to everybody, I tried to use the implementation of George Anescu[^] for encoding some text but I'm not sure I encrpyt correctly the data..... datas are taken from a buffer and are in plaintext, I allocate a buffer using
char *buffer_in=(char*)calloc(strlen(mainbuffer)+1,sizeof(char)); char *buffer_out=(char*)calloc(strlen(mainbuffer)+1,sizeof(char));
and the encrpyt it usingoRijndael.MakeKey(key, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",16,16); oRijndael.Encrypt(buffer_in, *buffer_out, lenght,2); //2 = CFB
where lenght is strlen(mainbuffer)+1; when I've executedoRijndael.Encrypt(....)
I've got into buffer_out the data encrypted, but using strlen I get a lenght < of buffer_in, should I use _msize? the problem is that usingoRijndael.Decrypt
I've a lenght that's not the one of buffer_in,so Decrypt fails... Hope someone has used this implementation of AES and can help me, thanks Paolo -
CreateFile for reading/writing fileI know, it's not possible to obtain an handle for both ? ReadFile and WriteFile?? I'll do a CloseHandle and reopen with read permission, seems the only way to me, thanks
-
CreateFile for reading/writing fileyes, you're right, here's my code
//those 2 handle are obtained into main program HANDLE source=CreateFile("header", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL); HANDLE destination=CreateFile(filename_save, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, NULL, NULL); bool AppendToBeginOfFile(HANDLE source, HANDLE destination) { DWORD source_size=0, destination_size=0, BRs=0, BRd=0, BW=0; char *tmp1=NULL, *tmp2=NULL; if((source == NULL) && (destination == NULL)) return false; source_size=GetFileSize(source, NULL); destination_size=GetFileSize(destination, NULL); tmp1=(char*)malloc(source_size*sizeof(char)); tmp2=(char*)malloc(destination_size*sizeof(char)); bool k=ReadFile(destination, tmp2, destination_size, &BRd, NULL); DWORD l=GetLastError(); k=ReadFile(source, tmp1, source_size, &BRs, NULL); l=GetLastError(); if((BRs < source_size) || (BRd < destination_size)) return false; SetFilePointer(destination, 0 , 0 ,FILE_BEGIN); WriteFile(destination, source, source_size, &BW, NULL); }
-
CreateFile for reading/writing filehello, I've the following problem: 1) two files one with data and another one with header about data's file 2) I need to insert the header into the data file at the beginning of file 3) I tried using Createfile in this form
tempfd=CreateFile(filename_save, GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, NULL, NULL);
but when I use the ReadFile, it returns error 183, that's defined in msdn ad183 Cannot create a file when that file already exists.
My idea was to copy the content of two files in memory, than paste the header into data file, than append the data file, but doesn't seems to work, any suggestion?? Thanks in advance Paolo -
Random number generation on 4byteshello, I just want to know how to generate a random number on 4 bytes, I saw that rand returns an int but it's too short for my purposal, any suggestion? In my project I DON'T use MFC, I searched on codeproject but all I found was MFC sample, thanks Paolo
-
A tricky problem of converting to stringTCHAR is defined as
typedef wchar_t TCHAR;
so you can use the function below includinglong _wtol( const wchar_t *string );
don't understand what you doo below, hope I helped you