|
I want to learn about sockets and how to write a client/server application for sending .zip files of family photos to my sister who has moved away for a year. It will basically be a file transfer between 2 IP addresses. I can vaguely remember writing a sockets-based app in Java at university a few years ago but sadly my knowledge has left me since then
I want to use C# for this application to get some experience of the new language. Can anyone point me in the direction of any useful tutorials so I can get started on my program?
Thanks
|
|
|
|
|
Sounds like this is something you want to learn for yourself so I wont get into the technicalities etc but I suggest that you look into C# Remoting.
There are quite a few examples here on CP
|
|
|
|
|
Hi ,
Is there a way to make a c# toolbar dockable with a gripper ?
Thanks
|
|
|
|
|
|
Hello,
I'm trying to use URLDownloadToFile and a have a strange behaviour (and WebClient doesn't fit my needs):
URLDownloadToFile(IntPtr.Zero,"http://www.kimo.com.tw",@"c:\test1.htm",0,IntPtr.Zero);
<-- create the file
URLDownloadToFile(IntPtr.Zero,"http://www.yahoo.com",@"c:\test2.htm",0,IntPtr.Zero);
<-- create the file
URLDownloadToFile(IntPtr.Zero,"http://www.boursorama.com",@"c:\test3.htm",0,IntPtr.Zero); <-- doesn't create the file (but no apparent failure returned from the function)
Any idea ? Try by yourself.
R. LOPES
Just programmer.
|
|
|
|
|
Hi I'm realativly new to the programming. Well I've taken it oppon my self to write this program.
Here's the background info. Let's say for example... The process "notepad.exe" keeps getting shutdown, for reasons that are irrelivant.
How can I make an application that will watch the process "notepad.exe" and see if it's running or not... and if it is not running immediately start it up?
I've tried my self... but I'm having mucho troubles...
/\ |_ E X E GG
|
|
|
|
|
Are you starting "notepad.exe"? If you are, you can monitor the ProcessExit (or something like it) event in the Process or ProcessStartInfo class. You can tell that I know very little about this.
If you are not starting the process, you have two options.
1) Make a device driver to monitor process creation and destuction. I have absolutely no idea how to do this, but I know it can be done.
2) Poll for process info using toolhelp or similar. This would involve P/Invoke and I am not sure I know how. .NET might also have a built-in process enumeration class, so check around with the Process class.
I hope I have helped
Mike_V
|
|
|
|
|
Uh, that dosn't really get me anywhere... but thanks for the effort....
/\ |_ E X E GG
|
|
|
|
|
You can "spawn" the process in debug mode and keep tracking debug events related to process exiting. Check these funcions in the MSDN:
CreateProcess
WaitForDebugEvent
ContinueDebugEvent
Function prototypes and structures are a bit complex, but that´s the only safe way to do that.
"When I look into your eyes, there´s nothing there to see, nothing but my own mistakes staring back at me"
|
|
|
|
|
I have a web form and would like to cause a button to be clicked under a certain condition. How do I (what's the syntax) programmatically cause a button click so that the user doesn't have to do it?
Thanks all, in advance, for your reply!
|
|
|
|
|
You should be able to call PerformClick on the button object.
|
|
|
|
|
|
I am working on a user control and I need to call uxtheme.dll if it is available. If I do the [DllImport("uxtheme.dll")] thing, my app will not load on anything but XP. So...
I must resort to GetProcAddress which returns a function pointer. How do I get that to a Delegate? Should I make special delegates, like OpenThemeDataDelegate or just cast them all to Delegate ?
Any suggestions?
Mike_V
|
|
|
|
|
Mike_V wrote:
I must resort to GetProcAddress which returns a function pointer.
Why? You dont need GetProcAddress for DllImport.
How do I get that to a Delegate? Should I make special delegates, like OpenThemeDataDelegate or just cast them all to Delegate?
Again, why?
[dllimport...]
static extern IntPtr OpenThemeData(IntPtr hWnd, string classlist);
You need IntPtr here, you are working with HANDLES, not CALLBACKS.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Okay. Now that I'm awake, maybe I can write better
What I want to do is call functions in uxtheme.dll. Since the DLL is only present on XP, I cannot use the [DllImport] attribute, because then my program will not load on Win9X/2000. So first I need to check if the DLL is present, and if it is, then call GetProcAddress to load in the proper function pointers.
My question is, how do I use P/Invoke to do this? I know that I would need a Delegate to call the function, but how would I create a delegate from an unmanaged function pointer?
|
|
|
|
|
Mike_V wrote:
I cannot use the [DllImport] attribute, because then my program will not load on Win9X/2000. So first I need to check if the DLL is present, and if it is, then call GetProcAddress to load in the proper function pointers.
Why wont it load? It wont work if you use those functions, but you are gonna check anyways... I dont see the point of using GetProcAddress here. Perhaps you dont realize DllImport does not link the dll, it searches for it only when you invoke the function (or maybe a class that exposes it, but then dont instantiate that).
<a TITLE="See my user info" href=http:
|
|
|
|
|
leppie wrote:
Perhaps you dont realize DllImport does not link the dll, it searches for it only when you invoke the function
Umm.. Actually it does. Create a sample program that imports GetLastError. Invoke ILDASM on this class and look at the MANIFEST (top node in ildasm). At the very top, it has .module extern kernel32.dll . Fusion, or whatever loads the module, will see that directive and will not load the module if the dll is missing. I have tried not using GetProcAddress and it did not work on Win2K.
|
|
|
|
|
Ok then, my mistake. I suggest you wrap the Uxtheme dll in a seprate assembly and only call it if necesary
<a TITLE="See my user info" href=http:
|
|
|
|
|
What is the matter with Environment.OSVersion.Platform. Create properties
that does this for you and then call them to figure out what the os is.
<br />
public static bool IsThemeOS<br />
{<br />
if ( Environment.OSVersion.Platform == Platform.Win32NT&&Environment.OSVersion.Version.Major >= 5<br />
if ( Environment.OSVersion.Version.Minor >= 1 )<br />
{<br />
return true;<br />
}<br />
}<br />
<br />
Bo Hunter
|
|
|
|
|
Read one of my earlier messages. This will not work because .NET will link your module to the dll. Since uxtheme.dll is only on winxp, the module will fail to load on any other OS.
This would be easy to do in Managed C++, but I have an existing, extensive utility library in C#.
Mike_V
Tech Support: "Do you have any windows open right now?" Customer: "Are you crazy woman, it's twenty below outside..."
|
|
|
|
|
it like a calling function ???
i feel confused ,please help me
please particular description
thanks
|
|
|
|
|
A delegate is a pointer to a function.
An event is a special multicast delegate. Other than that, they are exactly the same (bar a few access methods, event is more restrictive).
EG (this probably wont work as you need to define the structure):
void MyMethod(string str)
{
}
Delegate a = new Delegate(MyMethod);
a.Invoke(this, new object[]{str});
Once you get the hang of them they become very handy and easy to understand.
<a TITLE="See my user info" href=http:
|
|
|
|
|
i need to get a DataRow[] from MyDataRow.GetChildRows(MyRelation) in a specified order.
right now it simply returns the DataRow[] where the rows are in the same order as in the parenting DataTable.
so is it possible to do this somehow?
(i dont think i can use dataviews or such in this case , since i only have access to a DataRow , and i guess i cant create a DataView from that )
i want the rows to be sorted the way its specified in MyRow.Table.DefaultView.Sort
//Roger
|
|
|
|
|
Please help i need to know how to do this. I can do it in VB.NET but how do i do it in C#?
VB.NET
<br />
Dim i() As Integer<br />
ReDim i(5)<br />
ReDim i(20) <br />
Please help with c#
|
|
|
|
|
static Array Resize(Array src, int newsize)
{
Array dest = Array.CreateInstance(src.GetValue(0).GetType(), newsize);
Array.Copy(src, dest, (src.Length < newsize ? src.Length : newsize));
return dest;
}
<a TITLE="See my user info" href=http:
|
|
|
|