|
How can I obtain and identify a login session token for a user running on Terminal Services?
|
|
|
|
|
Hello.
Thank you very much for series of articles
Image Processing for Dummies with C# and GDI+ .
I have a question that I couldn't find in these articles.
How I can save a high color (16 bit )image as 256 color or fewer.
I want to write this program with C# .net such as previous
articles not with MFC.
I guess the PixelFormat class can be useful. But I don't know how I can use it.
Please tell me how I can write this Program.
Thank you very much.
|
|
|
|
|
I am new to C# and I am developing a small app to read in the contents of the global address list from Microsoft Exchange and then be able to send emails to people off of this list. I am not sure where to begin and dont really know much about C # so I really need a point in the right direction. Thanks!!!!
|
|
|
|
|
Get Microsoft Exchange SDK. CDO and ExchangeOLEDB
Free your mind...
|
|
|
|
|
I'm trying to link a couple of panels that each display a set of fields that extend beyond the visible area, giving rise, of course, to vertical scroll bars. My goal is to arrange it so that moving one panel's scroll bar causes a corresponding action in the other panel. To do so, I need to be able to get a "live" reading on the scroll bar's position. The closest thing I've found is the information in "AutoScrollPosition" which does accurately show a relationship between the current position and the "not moved" position. The problem is, there is no event or other mechanism for getting this information from contact with the scroll bar itself. I can use a click event or mouse-up event to cause the information to be passed to the other control as needed, but it's always disconnected from the actual movement of the scroll bar.
Is there a solution out there that I've just missed? If I have to build a new wrapper control to handle this, I still don't know how to capture the position in real time.
Any ideas, anyone?
Thanks,
David Groves
|
|
|
|
|
Welcome to the Wonderful World of .NET AutoScroll. You will need to subclass the panel so that you can catch WM_HSCROLL, WM_VSCROLL, and WM_MOUSEWHEEL messages. And I actually find it easier to just roll my own scrolling panel, and do the scrolling part myself, rather than basing it on an AutoScroll panel.
"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
|
|
|
|
|
how to serialize/deserialize derived class between two application? here is the situation:
class container
{
BaseClass bc;
}
class BaseClass
{..}
class DerivedClass1:BaseClass
{...}
class DerivedClass2:BaseClass
{...}
------------------------------------------
the "bc" in the container can be assigned to be DerivedClass1 or DerivedClass2. Those classes and serialize/deserialize functions will be use between two applications (App1, App2). App1 serialize "container", App2 try to deserialize "container".
I tried following ways:
1. Binaryformatter/Soapformatter: During the serialization, App1's name will also be serialized. When App2 try to deserialize, it can not find App1 and generate exceptions.
2. XmlSerializer: it can not serialize when "bc" is assgined to a class other than BaseClass
Any guru have any good method to handle this situation?
Thanks,
Leo
|
|
|
|
|
how to serialize/deserialize derived class between two application? here is the situation:
class container
{
BaseClass bc;
}
class BaseClass
{..}
class DerivedClass1
{...}
class DerivedClass2
{...}
------------------------------------------
the "bc" in the container can be assigned to be DerivedClass1 or DerivedClass2. Those classes and serialize/deserialize functions will be use between two applications (App1, App2). App1 serialize "container", App2 try to deserialize "container".
I tried following ways:
1. Binaryformatter/Soapformatter: During the serialization, App1's name will also be serialized. When App2 try to deserialize, it can not find App1 and generate exceptions.
2. XmlSerializer: it can not serialize when "bc" is assgined to a class other than BaseClass
Any guru have any good method to handle this situation?
Thanks,
Leo
|
|
|
|
|
Stick your BaseClass and DerivedClass's into their own assembly (in VS.NET choose a Class Library project). Have App1 and App2 reference this new assembly (commonly called a shared-assembly).
Now App1 and App2 can read and write those objects.
In all you wind up with three projects: App1, App2, and Common (which contains BaseClass and the two DerivedClasses).
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
|
|
|
|
|
Thanks, I thought about this way before, but my code (the BaseClass) have some fields defined in App1..... I know it is not a good design, but it is a special case for my situation. Is there any way to get rid of the assembly information when using BinaryFormatter?
Thanks
|
|
|
|
|
Change the AssemblyFormat property to FormatterAssemblyStyle.Simple.
Depending on the application, it can be a good practice doing it, because it doesn't prevent future assembly versions from loading old data.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
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.
|
|
|
|