If you're using a manifest file to make Visual Studio .NET display the XP visual styles, you'll need to create a manifest file for your application too. I got this non-sense error message some days ago, and learned that if you use a manifest file in VS.NET, then build a project, you'll need a manifest file to run the application... :omg: Hope it helps. John
John Mautari
Posts
-
Runtime Error in Treeview Imagelist -
WebResponse/WebRequest problemIt seems that you're getting an unicode encoded page from the web server. Did you tried Encoding.Convert?
using System.Text; ... string pagetext = Encoding.Default.GetString(Encoding.Convert(Encoding.Unicode, Encoding.ASCII, request.DownloadData(Page))); ...
What language is your web page/web server? You may try to change Encoding.Unicode to other encoding like UTF8, and Encoding.ASCII to UTF8 if you're still getting wrong results. I'm using the default encoding to read web pages in english/portuguese, and the results are ok for me. Cheers, John -
WebResponse/WebRequest problemWhat happens if you use:
... string pagetext = Encoding.ASCII.GetString(request.DownloadData(Page)); ...
Sorry if you already have tried it... :rolleyes: -
Curious about C# and desktop appsjpwkeeper wrote: I am developing a desktop app using .NET, and it is wonderful. Yes, you need the .NET runtime, but you can include it on your installation CD if you have one. Indeed. .NET is wonderful. jpwkeeper wrote: The great thing about .NET is how easy and seamless it has made developing components and user controls. It's now a true peice of cake, basically it is COM the way it was always meant to be (even Don Box thinks so according to an associate of mine who knows him). Here where I work, the goal is all new development in .NET. And we don't take those decisions lightly. I have used .NET for building my last 2 projects, an accounting system with lots of XML handling, and the live chat system, with sockets handling, XML, multi-threading, and other stuff that can be a bit harder to develop/debug when using C++/MFC and those crypt COM interfaces... I think .NET is a great framework for building any kind of application. We can still use C++ for some work that needs very high performance. Sadly, I have heard about people and some companies that don't want .NET installed on their computers...:(( I just don't know why... Cheers, John
-
Sending Mail in C#You may use this class and add the following code to authenticate, just after sending the HELO command:
//introduce ourselves buf.Append("HELO "); buf.Append(host); con.SendCommand(buf.ToString()); con.GetReply(out response, out code); buf.Length = 0; if(!AuthLoginPlain(con, user, password)) { // Failed con.Close(); throw .... // throw an error } ... private bool AuthLoginPlain(SmtpConnection con, string user, string pass) { //Envia o comand AUTH LOGIN StringBuilder buf = new StringBuilder(); byte [] b_user = System.Text.Encoding.ASCII.GetBytes(user); byte [] b_pass = System.Text.Encoding.ASCII.GetBytes(pass); string response; string res; string data; int code; buf.Append("AUTH LOGIN"); con.SendCommand(buf.ToString()); con.GetReply(out response, out code); buf.Length = 0; if(code == 334) { //pega ultima resposta menos o codigo de resposta response = response.Substring(4); res = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(response)); if(res == "Username:") { //envia o nome de data = Convert.ToBase64String(b_user); buf.Append(data); con.SendCommand(buf.ToString()); con.GetReply(out response, out code); buf.Length = 0; } if(code != 334) { return false; } response = response.Substring(4); res = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(response)); if(res == "Password:") { // manda senha em plain data = Convert.ToBase64String(b_pass); buf.Append(data); con.SendCommand(buf.ToString()); con.GetReply(out response, out code); if(code != 235) { // falhou! return false; } // se chegou até aqui, ok! return true; } } return false; }
Cheers, John -
How can you detect if User IS ONLINE?using System.Runtime.InteropServices; ... public class InternetConnection { [DllImport("wininet.dll")] public static extern bool InternetGetConnectedStateEx(out int lpdwFlags, byte[] szConn, int iConnSize, int dwReserved); /// /// Status da conexão /// public enum Status: int { /// /// Local system uses a modem to connect to the Internet. /// INTERNET_CONNECTION_MODEM = 1, /// /// Local system uses a local area network to connect to the Internet. /// INTERNET_CONNECTION_LAN = 2, /// /// Local system uses a proxy server to connect to the Internet. /// INTERNET_CONNECTION_PROXY = 4, /// /// Local system has RAS installed. /// INTERNET_RAS_INSTALLED = 16, /// /// Local system is in offline mode. /// INTERNET_CONNECTION_OFFLINE = 32, /// /// Local system has a valid connection to the Internet, but it might or might not be currently connected. /// INTERNET_CONNECTION_CONFIGURED = 64 } /// /// Returns true if connected /// public static bool Connected { get { bool bConn = false; int flags = 0; byte [] cName = new byte[512]; if(InternetGetConnectedStateEx(out flags, cName, 512, 0)) { bConn = true; } return bConn; } } public InternetConnection() { } } ... InternetConnection inet = new InternetConnection(); if(inet.Connected) { ... } else { // not connected }
Cheers, John -
Selecting a directory name -
Curious about C# and desktop appsHi! I'm curious about if anybody is using .NET in desktop application development. I've just finished a live chat front-end using Windows Forms in C#, similar to Humanclick. Did not used any code obfuscator, mainly because the front-end itself don't have utility without the server's components (the windows service it uses and the aspx pages used in administration), so having people disassembling it is not a big issue. I'll distribute the front-end to my customers along with .NET framework runtime and other stuff on CD-ROM, but will let customers to download it from web too. Now comes the big question: The .NET framework runtime is about 20Mb. Does somebody developed an application which requires the user to download the runtime? Will them install it? Or .NET is being used only for server side application development? Thanks, John
-
WebResponse/WebRequest problemDid you tried System.Net.WebClient?
using System.Text; using System.Net; ... WebClient request = new WebClient(); string PageText = Encoding.Default.GetString(request.DownloadData(Page)); // You can change Encoding.Default to Encoding.UTF8 if needed
Cheers, John -
C# and the Microsoft Web Browser ControlJonny Newman wrote: After reading several articles i've managed to get a web control in my windows forms app. The problem is that it still has the default Internet Explorer right-click menu. Implement IDocHostUIHandler interface: http://www.codeproject.com/csharp/advhost.asp [^] Using the ShowContextMenu method you can show your custom context menu, or leave it clean to get ride of IE's default context menu. Jonny Newman wrote: How do I disable it?? My plans for world domination depend on this! Now you can disable it... and dominate the world ;P Cya
-
I'm a DadCongratulations Dad and Mom!
-
Center text in a RichTextBox:(( Ooops, SelectionAlignment is not a method, but a property, so you need to use... richTextBox1.SelectionAlignment = HorizontalAlignment.Center; Better I go sleep now... :~
-
Center text in a RichTextBoxUse the SelectionAlignment method of RichTextBox class. richTextBox1.SelectionAlignment(HorizontalAlignment.Center);
-
Instance Handle for Bitmap.FromResourceTake a look here. Hope it helps. John
-
I just bought EA F1 2002 and...... realized that it's impossible to play it using a gamepad X| The Microsoft sidewinder force feedback steering wheel seems to be great, but how does it feel with ea f1 2002 (or GP3)? Is it worth the price?
-
C# Windows Forms program freezes on form unloadHi, I'm having trouble with C# and windows forms. When I finish the form (using the windows' close button or the form close button), sometimes the program's window get closed but the program never stops (the program executable is still visible in the task list). Did I missing something?