|
leppie wrote:
it has a native runtime implementation
Probably Im misunderstanding you but I think thats not correct. Ive used Reflector and the HashTable implementation seems to be completely managed.
|
|
|
|
|
I need someone to point me into a direction.
I need to be able to accomplish the following ( request/response ):
1) send an xml document to an ip address and a specific port
2) listen for the response document also an XML document.
Upon recieving the request document the connection is broken imediately.
After the XML server is ready to return the reply document, a new connection is
established using an address supplied with the orginal request.
BTW I am new to sockets so please be patient with me.
Things I need to do?
1) open socket to server and steam the xml request doc to the server.
2) Listen and capture the response document and write it to disk.
|
|
|
|
|
Take a look at the MSDN docs for the Socket[^] class and its members. They provide many code examples which should give you a starting point.
www.troschuetz.de
|
|
|
|
|
Hi there!
I am trying to save different .swf files on my local machine.
Actually this is already working with the below code.
Unfortunately (how I already figured while writing the code) The file is saved, but somehow corrupted.
Is there maybe a way more simple way to get the Response of an URI into a string (or, let's say a buffer) and save it on my disk?
Below is the code I came up with (within a C# web application):
// init
bool debug = false;
// this is where I get my test-swf, you can have a look at it at:
// http://www.styte.com/3.swf
// it may look strange, what I am trying to do is to read some php-created
// swf's into my .net application....
string url = "http://www.styte.com/trans.php?&bild=3.swf";
// work
Uri fileUrl = new Uri(url);
// Create 'FileWebrequest' object with specified Uri.
WebRequest myFileWebRequest = (WebRequest)WebRequest.Create(fileUrl);
// Send 'FileWebRequest' object & wait for response.
WebResponse myFileWebResponse = (WebResponse)myFileWebRequest.GetResponse();
// Get stream object associated with response object.
Stream receiveStream = myFileWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("windows-1252"); //("utf-8");
// Pipe stream to higher level stream reader with req. encoding format.
StreamReader readStream = new StreamReader (receiveStream, encode);
if (debug==true) Response.Write("\r\nResponse stream received ");
int numChars = 1;
Char[] read = new Char[numChars];
// Read "numChars" characters at a time.
int count = readStream.Read ( read, 0, numChars );
if (debug==true) Response.Write("(count): "+count.ToString()+" File Data...\r\n");
//Response.ContentType = "application/x-shockwave-flash";
//Response.AddHeader("Content-Type", "application/x-shockwave-flash");
FileStream fs = File.Create(@"C:\Inetpub\wwwroot\leilac\uploads\test.swf");
BinaryWriter bw = new BinaryWriter(fs);
while (count > 0) {
String str = new String(read, 0, count);
bw.Write(str);
Response.Write(str);
count = readStream.Read(read, 0, numChars);
}
bw.Close(); fs.Close();
if (debug==true) Response.Write(" ");
// Release resources of stream & response object.
readStream.Close();
myFileWebResponse.Close();
Response.End();
Appreciate any comments/help.
Sasch, styte, http://www.styte.com/
|
|
|
|
|
I believe that you should skip the encoding.
---
b { font-weight: normal; }
|
|
|
|
|
Hey Guffa!
Hmmm, I was thinking about that from the beginning, but how to do so?
S.
|
|
|
|
|
sascho wrote:
Encoding encode = System.Text.Encoding.GetEncoding("windows-1252"); //("utf-8");
// Pipe stream to higher level stream reader with req. encoding format.
StreamReader readStream = new StreamReader (receiveStream, encode);
if (debug==true) Response.Write("\r\nResponse stream received
");
Instead of using a StreamReader, have you tried using a BinaryReader[^]? You don't have to specify an Encoding with it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You could also try the following (very simple) code:
System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile(URIString,FileNameString);
maybe this is not that complicated for such a trivial task.
best regards
jkersch
|
|
|
|
|
Is it possibe to create a transparent avalon application? And would alpha-blending, blur and other effect's work normally? It's hard to believe that this could be done in XP because programs aren't textures unlike in Vista. But on the other hand, didn't they make those cool blur effects in Vista's IE7 with avalon? (and as you all know, WinFX is also available for XP) If not, then how?
|
|
|
|
|
You should try VG.net[^], their newest version can show graphics in an alpha-blended window!
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Not only that, but it's incredibly easy.
For a really basic translucent form, just create a Picture in the designer (instead of the default Form in the application), and then put this code in your picture class:
[STAThread]
static void Main()
{
TranslucentForm form = new MainPicture().DisplayInTranslucentForm();
form.Text = "VG.net Calculator";
Application.Run(form);
}
...and set the picture as the startup class. Your picture will then display on its own with true transparency and translucent (alpha-blended) effects. VG.net also has some new additions to make it extremely simple to allow custom window moving, resizing, minimizing, closing, etc for your translucent UI, with no custom code needed. You can see more here[^].
|
|
|
|
|
|
Marc, that is C# 2.0. And no, there isn't a better way.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
|
Meh. I don't think that it's a good idea for them to support unions in C#. Here's one guy's take on it from Mono: http://lists.ximian.com/pipermail/mono-devel-list/2005-April/011577.html. If you really need a union, you should probably just wrap a C++/CLI union with some managed code.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
The MouseMove event doesn't fire if the mouse is over a control contained by a form. Is there anyway other than calling MouseMove for every one of my controls to track the current mouse position anywhere on a form?
|
|
|
|
|
Looking farther, since groupboxes don't have the MouseMove event, even if I called my handler from subcontrols I'd still have gaps in my coverage. Any solultion?
|
|
|
|
|
If you want to know where it is, you can use Cursor.Position . It is in screen coordinates though, so have to substract the location of the form from it.
If you want to be notified of every move of the mouse on your form, you can implement <a href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsimessagefilterclasstopic.asp" rel="nofollow">IMessageFilter</a>[<a href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsimessagefilterclasstopic.asp" target = "_blank" rel="nofollow">^</a>] . Then, in PreFilterMessage you can handle the <a href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputmessages/wm_mousemove.asp" rel="nofollow">WM_MOUSEMOVE</a>[<a href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputmessages/wm_mousemove.asp" target = "_blank" rel="nofollow">^</a>] (= 512) message.
Hope this helps!
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
I have an MdiParent form. This form has an MdiChild form. On MdiChild I have a button that opens another New form. But this form opens outside the MdiParent. How do I make the New form an MdiChild.
Please Help
|
|
|
|
|
The same way you made your Child form a child. Create the form object, set it's MdiParent property to the same parent that this child is using, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yo, thanks man, i tried fiddling with it and it worked.
Enjoy.
|
|
|
|
|
there is no events called, nothing.
I know there are qiute a few work arounds, like
calling api or not showing controlbox at all.
what I would like to know is why after closing form from
controlbox X, call to MyForm.Show does not do anything,
not even error.
and also is there a way to trap that click on controlbox
but stay within managed code.
TIA
|
|
|
|
|
Are you refering to the X in the upper right of the titlebar? If so the Closing and Closed events do fire on either side of the forms death. Using Closing you can abort the process by e.Cancel to true.
|
|
|
|
|
Hi,
I should like to write trace lines (using Trace.WriteLine or even Console.WriteLine) to a console window, but this time from a Class module.
The class module does not create a Console (aka command line)window, so Console.WriteLine does not work. Neither could I find an example of specifying a (or creating a) console window for this kind of output.
Anybody Any Idea how to do this?
Tx Aad
Aad Slingerland
Zevenaar
The Netherlands
|
|
|
|
|
Applications for either the console or windows subsystem won't display output for Trace.WriteLine unless you add the following lines of code before calling your first Trace.WriteLine (or Debug.WriteLine ):
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); To display a console window for a Windows Forms applcation compiled for the window subsystem (because a Windows Forms application can be compiled for the console subsystem and work, plus write console data; ildasm.exe is compiled this way) you'd have to P/Invoke CreateConsoleScreenBuffer and write a TextWriter around that for use with the TextWriterTraceListener , or just write your own TraceListener derivative to do that.
The easiest is just compile your Windows Forms application using /t:exe instead of /t:winexe so that you already have a console attached to the process.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|