|
Thanks, I know it. I mean if there is any way to get rid of all the assembly information, even the assembly name?
Thanks.
|
|
|
|
|
Well, you can always derive your own class from Formatter, I never did it, but it seems something quite easy. You can even use Reflector and decompile BinaryFormatter to get a similar one.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
I am attempting to create a RichtextBox that highlights/underlines a certain word if it is found within the string the box contains.
Having never worked with RTF formats before I assumed (DOH!!) that this would be relatively simple, but I have since discovered that RTF is a pandoras box.
Does anybody know of a simple way to get the effect I am after.
Forexample, as a user types into the box it fires a _TextChanged event, in this event the code checks for the presence of a specific word. If the word is present then it is highlighted/underlined. So if the user types the following sentence :
"The quick brown fox jumps of the lazy dogs"
And my chosen word is "brown" then that word is highlighted/underlined.
|
|
|
|
|
The method is to select some text (programmatically) ans set the SelectionColor property. Similar things can be done to the SelectionFont property, but be warned the RichTextBox is nOT suited for this, and performance will suffer (even with some tricks I have tried).
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
If RichTextBoxes arent suited to this what else can you suggest?
Basically I am producing a spell checker application, that spell checks as the user types (a la word style). Spell checking is working fine, but I need to method of visually identifying the first mis-spelled word.
As you already know I thought I could/should do this with rtb's but your post makes me think otherwise.
As an example, if the user types :
"The quik brown fox jumped over the lazy dogs"
"quik" would be highlighted/underlined/bolded etc
|
|
|
|
|
I think a rtb should be fine for that, but for code highliting its a bit silly. Or maybe I was just using silly parsing methods(?)
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
So here is my problem :
i have a structure used as parameter (struct * )in a dll (VC++ 6.00):
typedef struct {
CHAR chararray1[10];
DWORD Data1;
DWORD Data2;
CHAR chararray2[4];
CHAR chararray3[2];
BYTE Data3;
BYTE Data4;
BYTE Data5;
BYTE Data6;
BYTE Data7;
BYTE Data8;
} mystruct;
It should be converted like this - i think ) -
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi)]
unsafe public struct mystruct
{
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=10)]
public string chararray1;
public Int32 Data1;
public Int32 Data2;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=4)]
public string chararray2;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=2)]
public string chararray3;
public byte Data4;
public byte Data5; ...
}
Expected Value for string fields are "ABC : 0.00", "1234", "56"
When executing with size defined identically in both structures, i get this strange result "ABC .0","123", "5"
if i increase(+1) the size in C# structure , hoping to get my missing char, i get "ABC : 0.00", "1234", "6"
So am i doing a mistake somewhere ? or is it a bug ??????
Thanks by Advance
Gaetan
|
|
|
|
|
I have the same problem. I have one char[256] unmanaged parameter and I'm only getting the first character each time. What does your function prototype look like and how are you passing your struct?
Please post a solution if you find one and I will do the same.
Tym!
|
|
|
|
|
Fucntion declared in the dll like this
INT Function(DWORD param1, mystruct *psConfig);
import with c#
[DllImport(@"C:\DLL\MyDll.dll",EntryPoint="Function")]
unsafe public static extern int MyFunction(uint param1,ref mystruct psConfig);
Calling function :
private void button10_Click(object sender, System.EventArgs e)
{
mystruct sConfig = new mystruct();
int res;
unsafe
{
res = MyFunction(hCom,ref sConfig);
}
MessageBox.Show( res.ToString() );
}
|
|
|
|
|
So here is the method to get data correctly
[MarshalAs(UnmanagedType.ByValArray,SizeConst=10)]
public byte [] mystring1;
instead of
[MarshalAs(UnmanagedType.ByValStr,SizeConst=10)]
public string mystring1;
i guess this will be ok in your application
|
|
|
|
|
gmar wrote:
So am i doing a mistake somewhere ? or is it a bug ??????
The structs mapping is incorrect! Where's Data3?
You should alos set the imported functions CharSet, not the struct. Also all those unsafe sections are unnecessary. They are only need when using pointers, whicj you are obviously not.
Lastly a string should be null terminated, that could be causing printing problems...
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
hello, i already tried to set CharSet=CharSet.Ansi, but it didn't change anything.
Unsafe or not shouldn't be a problem, but i will remove it just to try.
and as you have seen i'm not talking about a problem on Data3, my problem is to get back the content of each char array coming from my dll.
so i will try to get it back as an array of byte , if it's possible.
So if you have a real idea about how to solve this problem, you are welcome.
|
|
|
|
|
Hi,
I want to write a centralised session server that runs as an SAO for remote access. This will essentially be a dictionary for session objects keyed by a unique identifier (based on the 'Virtual Singleton' pattern).
My problem is : what should I use as the unique identifier -- it must be unique to the program instance running on the network. I initailly thought of the remoting context as the key, but I'm not sure that is the best way (are context's unique accross the whole network, or only to each PC?).
Is there some combination of AppDomain property and thread property that is unique accross a network?
TIA
Dr Herbie.
Remember, half the people out there have below average IQs.
|
|
|
|
|
GUIDs are unique. Will they do?
Guid x = Guid.NewGuid();
From MSDN Library:
GUID represents a globally unique identifier.
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
|
|
|
|
|
Arjan Einbu wrote:
GUIDs are unique. Will they do?
My intent for this design is to remove any explicit token passing. I already have a session object which has to be passed accross to the remote object to identify the user. I wanted to avoid having to explicitly pass any extra variables, so I was hoping that the thread/context/appdomain might contain something I could use to uniquely identify the client.
E.g. Instead of:
public void SAO:PerformAction(token ClientIdentifier, int parameter)<br />
{<br />
CheckSecurity(ClientIdentifier);<br />
DoStuff(parameter);<br />
}
I could do:
public void SAO:PerformAction(int parameter)<br />
{<br />
CheckSecurity( GetUniqueTokenFromCallersContext() );<br />
DoStuff(parameter);<br />
}
I'm trying to make the remoting interfaces as seamless as possible and I personally hate having to have an identifier token passed to every SAO method.
Maybe I'm hoping for too much.
Dr Herbie.
Remember, half the people out there have below average IQs.
|
|
|
|
|
How can i tell what forms are currently open and how do i close a specific form?
My main form is an MDI parent with a toolbar. One button opens a form and when i click another button, i want to close the one that's open, but i'm having a hard time finding out what is open and how to close it.
Thanks for your help.
.gonad.
|
|
|
|
|
[ append from previous post ]
the only way i know how to do this is:
this.MDIChildren[0].Close();
this works for me since i only want one form open at a time, but i just want to know if there's another way to do this.
Thanks!
.gonad.
|
|
|
|
|
Form has a ActiveMDIChild property, this is the currently active child form.
You can use this property to close the topmost (active) child form.
Suhas
|
|
|
|
|
Hi,
I need to scroll on print preview control using key board ( the application does not have any mouse attached to it) but unfortunately there is no method avaialble to do that, worse the print preview control has a scroll bar which is not exposed in any manner.
Any help in this will be highly appreciated.
regards
|
|
|
|
|
Hi,
We have developed a POP3 client in C# . When we start this client on our local computer it is supposed to retrieve the email messages from a remote POP3 server automatically, and put these email messages(and any attachments) in the corresponding folders on our local machine. After retrieving the messages it deletes the downloaded messages from the remote server and then the POP3 client quits.
This POP3 client is (thread based) constantly running and attempts to reconnect to the server every 30 secs to automatically download the new emails that have arrived on the server. The problem is we are having is that the POP3 client is repeatedly having authentication problems. Somtimes it connects succesfully and sometimes it does not. Below is a log file that shows the log information generated by the POP3 client in 2 iterations. First it connects fine and retrieves an email successfully, and then it QUITS. After 30 secs it re-attempts to connect to check for more emails but as you can then see it then gives the error -ERR . We dont understand why this is happening since the same password was successful in the first attempt.
Thanks for any Help
================================FIRST ITERATION===================================
18 October 2003
Connecting to server...
Connected successfully...
Creating input / output streams
Stream created successfully..
+OK
Sending Command: USER enquiries@hotpop.com
Recieving Data...
Data Found: +OK
Sending Command: PASS abhcyshk
Recieving Data...
Data Found: +OK
Sending Command: STAT
Recieving Data...
Data Found: +OK 2 2119
Sending Command: RETR 1
Recieving Data...
Data Found: +OK 1065 octets
------------------------------To: enquiries@hotpop.com
------------------------------From: shooshoo@hotmail.com
------------------------------Subject: test 2 from cwazy
------------------------------ContentType: text/plain;charset=iso
Sending Command: DELE 1
Recieving Data...
Data Found: +OK
Sending Command: QUIT
==============================SECOND ITERATION =====================================
18 October 2003
Connecting to server...
Connected successfully...
Creating input / output streams
Stream created successfully..
+OK
Sending Command: USER enquiries@hotpop.com
Recieving Data...
Data Found: +OK
Sending Command: PASS abhcyshk
Recieving Data...
Data Found: -ERR
Sending Command: QUIT
Recieving Data...
Data Found:
================================================================================
hmmm?
|
|
|
|
|
Can you adjust stuff so that you get back the full text of the -ERR response?
I often see this kind of problem as a temporary issue at my ISP, and the error is normally not that my password is incorrect, but that they have a lock outstanding (receiving mail) or a temporary storage problem.
Steve S
|
|
|
|
|
have you tried longer pauses during two connections.
does the problem still occur when you set the wait-time to lets say two minutes ?
andi
|
|
|
|
|
I have been working on this for 3 hours straight. So far i've tried everything I could find on the net. This includes:
<br />
for(int i = 0; i < 40; ++i)<br />
{<br />
richTxt.AppendText("Some Text\r\n");<br />
}<br />
<br />
richTxt.SelectionStart = richTxt.TextLength;<br />
richTxt.Focus();<br />
richTxt.ScrollToCaret();<br />
And putting the above code (minus the loop) in an event handler for TextChanged. If someone could please help me with this I would be eternally greatful.
|
|
|
|
|
Hmmm.. I believe you have to set HideSelection to false. Then it should work fine.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Ah, apparently if I do this:
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
and then override OnPaint , it should look something like this:
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaintBackground(pe);
base.OnPaint(pe);
...
}
The base.OnPaintBackground(pe) being key to a derived class (say, from a Panel) having its background updated properly. I wasn't aware of this before, and it explains some past frustrations with the WinForms.
Any feedback and better suggestions welcome.
|
|
|
|