|
Hi,
1. I configured the Outlook to work with Windows Live Hotmail(my hotmail account)
2. Now i want to read all the inbox from my hotmail account using C#.
3. The outlook create for hotmail a file with .ost extension(not with .pst)
4. My procedure is like this:
TextWriter tw = new StreamWriter(@"C:\pstfile_html.txt");
// Create the Outlook application.
// in-line initialization
Outlook.Application oApp = new Outlook.Application();
// Get the MAPI namespace.
Outlook.NameSpace oNS = oApp.GetNamespace("MAPI");
// Log on by using the default profile or existing session (no dialog box).
oNS.Logon(Missing.Value,Missing.Value,false,true);
//Get the Inbox folder.
Outlook.MAPIFolder oInbox = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
//Get the Items collection in the Inbox folder.
Outlook.Items oItems = oInbox.Items;
Outlook.MailItem oMsg = (Outlook.MailItem)oItems.GetFirst();
for (int i = 0; i < oItems.Count; i++)
{
//Output some common properties.
tw.WriteLine(oMsg.Subject);
tw.WriteLine(oMsg.SenderName);
tw.WriteLine(oMsg.ReceivedTime);
tw.WriteLine(oMsg.Body);
tw.WriteLine(oMsg.HTMLBody);
tw.WriteLine("Next Message-----------------------");
oMsg = (Outlook.MailItem)oItems.GetNext();
//System.Diagnostics.Debug.WriteLine(objMail.Body.ToString());
}
//Log off.
oNS.Logoff();
//Explicitly release objects.
oMsg = null;
oItems = null;
oInbox = null;
oNS = null;
oApp = null;
tw.Close();
}
//Error handler.
catch (Exception e)
{
Console.WriteLine("{0} Exception caught: ", e);
}
// Return value.
return 0;
}
6. I don't know how to take hotmail folder.
Thanks,
Anca
|
|
|
|
|
Hello,
I can't get the challenge and player respond working, it currently responds no player time, score only name, But the names are to little strange.
public string Challenge(string servIP, int servPORT)
{
byte[] buffer = new byte[100 * 1024];
byte[] PlayerQuery = { 0xff, 0xff, 0xff, 0xff, 0x55, 0x65 };
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipEP = new IPEndPoint(IPAddress.Parse(servIP), servPORT);
EndPoint EP = (EndPoint)ipEP;
socket.ReceiveTimeout = 1000;
socket.SendTo(PlayerQuery, PlayerQuery.Length, SocketFlags.None, EP);
int recvBytes = socket.ReceiveFrom(buffer, ref EP);
return ParseChallenge(buffer);
}
private string ParseChallenge(byte[] resp)
{
_CHALLANGE = System.Text.Encoding.ASCII.GetString(resp, 5, 4);
return _CHALLANGE;
}
private SourceQuery ParsePlayers(byte[] resp)
{
SourceQuery ret = new SourceQuery();
int i = 0;
ret.PPlayers = Encoding.ASCII.GetString(resp);
return ret;
}
public SourceQuery Players(string servIP, int servPORT)
{
byte[] buffer = new byte[4096];
string challenge = Challenge(servIP, servPORT);
byte[] PlayerQuery = { 0xff, 0xff, 0xff, 0xff, 0x55 };
string pQuery = Encoding.ASCII.GetString(PlayerQuery);
byte[] Query = Encoding.ASCII.GetBytes(pQuery + challenge);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipEP = new IPEndPoint(IPAddress.Parse(servIP), servPORT);
EndPoint EP = (EndPoint)ipEP;
socket.ReceiveTimeout = 1500;
socket.SendTo(PlayerQuery, PlayerQuery.Length, SocketFlags.None, EP);
int recvBytes = socket.ReceiveFrom(buffer, ref EP);
return ParsePlayers(buffer);
}
|
|
|
|
|
Hi,
i've got a Graphics Object and have drawn a rectangle (graphics.DrawRectangle) on it. Now I want to rotate it using the mouse. and the rotation matrix. But I don't see the rotation while moving the mouse, I just see it after realeasing the button...
Can anybody help me?
|
|
|
|
|
Without seeing any code it is difficult to tell you much - but are you calling Invalidate in the MouseMove Event? You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
It would be quite difficult to tell without seeing your code.
Still, are you changing the coordinates in the correct MouseMove event?
|
|
|
|
|
As you haven't shown any code, all I can do is say the principles are explained everywhere, including here[^].
|
|
|
|
|
I'm tryin to make a modified microprocessor programming language compiler in .NET but in my code generator part I face one big problem. It's the fact that microsoft intermediate language only supports stack based execuition which will indeed make me to think for other way. I want register based execuition since i'm planning for 8086 architecture. can anybody help me figure out how to handle this problem.
|
|
|
|
|
|
Whatever application you develop in C#, .NET using an intermediate language (IL), and IL being stack oriented, is irrelevant. A compiler written in C# isn't any different from a compiler in any other language (unless you want to compile some language to IL of course).
|
|
|
|
|
thanks!
as you can see in the code MSIL has opcode which are execuited by other functions which are not shown here. after these opcodes are execuited they are retured by the 4th line of the code and after that the code will create an assembly based on the compiler result for the code written by the user.this assembly is then saved and finally run so that the user can see his code runing.
now what i want to ask is that this MSIL execuite its codes on stack based approach. but my interest is to create a compiler for 8086 microprocessor architecture which in my opinion needs register based execuition so that I can access the individual register values.
public CodeGene(AST.Stmt stmt, string moduleName)
{
this.il = methb.GetILGenerator();
this.symbolTable = new Collections.Dictionary<string, Emit.LocalBuilder>();
this.GenStmt(stmt);
il.Emit(Emit.OpCodes.Ret);
typeBuilder.CreateType();
modb.CreateGlobalFunctions();
asmb.SetEntryPoint(methb);
asmb.Save(moduleName);
System.AppDomain.CurrentDomain.ExecuteAssembly(moduleName);
this.symbolTable = null;
this.il = null;
}
so please help me to figure out conceptually how i can get register based execuition of MSIL. or is there any other way of achieving register based compilation in C#?
thank you in advance!
|
|
|
|
|
Djtech01 wrote: in my code generator part I face one big problem. It's the fact that microsoft intermediate language only supports stack based execuition
Wait a minute. Your statement makes no sense at all. The .NET execution model has nothing to do with your compiler since it's your compiler code that's writing the resulting target for execution. Are you saying that you're using one of the .NET compilers to compile your code?
|
|
|
|
|
hello sir/madam,
I want to convert my foxpro application to c#/ms sql2005 server application.
It is a student management system.
If u have any tool or any simple method to convert it please email me.
My email id- bharat_v_patil@yahoo.com
Thanks in advance,
-bharat patil
|
|
|
|
|
There is no tool. You have to rewrite the code from scratch.
|
|
|
|
|
They are quite different. You would really not do a line to line conversion. Hence no tool would help. You will need to spend time and do it yourself.
|
|
|
|
|
Hi,
How can I get the 'pointer' of the stream writer the webbrowser control uses to navigate to websites?
Thanks in advance!
|
|
|
|
|
I *think* the DocumentStream[^] property is what you're looking for. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
I thought that's the one i needed too. But where would i put the url to navigate to another url with it?
|
|
|
|
|
Yustme wrote: But where would i put the url to navigate to another url with it?
I'm not sure if I understand this, but to navigate to another URL, you call the Navigate method of the webbrowser control, passing in the URL to navigate to, like so:
webBrowser1.Navigate("http://codeproject.com"); Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Ideally would be using the response class. Its much faster. But i can't log in on a website with it.
I got a multithreaded application. When entering the event: WebBrowserDocumentCompletedEventArgs , another thread already navigated to another page. So i'll lose the last page where the webcontrol navigated to.
Making the threads sleep a few seconds, doesn't help either. All i'm trying to get is the page content in html format.
|
|
|
|
|
Yustme wrote: All i'm trying to get is the page content in html format.
By that, do you mean getting the HTML behind the page?
If so, the DocumentText[^] property is what you need. It also allows you to modify the HTML contents, but I'm not sure if it's gonna work with what you're trying to accomplish:
Yustme wrote: But i can't log in on a website with it.
You may wanna have a look at the HtmlDocument[^] class. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Yes i can get the html code from the page. But i need to navigate to it first.
And there are a lot of pages to walk through.
|
|
|
|
|
What exactly are you trying to create? Perhaps the WebBrowser control isn't the ideal solution for this, but that depends on what you're trying to do. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Getting html code of a topic in a vbulletin forum.
If you're not logged in, you're not allowed to view the topic.
I can't log in with the response class.
This was my try:
private string login(string url, string username, string password)
{
string values = "vb_login_username={0}&vb_login_password={1}";
values += "&securitytoken=guest&cookieuser=checked&do=login";
values = string.Format(values, username, password);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = values.Length;
req.Timeout = 10000;
CookieContainer a = new CookieContainer();
req.CookieContainer = a;
System.Net.ServicePointManager.Expect100Continue = false;
using (StreamWriter writer = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
{ writer.Write(values, 0, values.Length); }
this.response = (HttpWebResponse)req.GetResponse();
StringBuilder output = new StringBuilder();
foreach (var cookie in response.Cookies)
{
output.Append(cookie.ToString());
output.Append(";");
}
return output.ToString();
}
</pre>
|
|
|
|
|
I don't know why your login request doesn't work, but another approach to the problem could be:
1. Navigate to the URL using the WebBrowser control.
2. If a login form is displayed, use HtmlDocument to fill in the values (username + password) and "click" the Login button. Depending on how the site is coded, the browser should automatically navigate to the requested forum topic.
3. Grab the HTML by using the DocumentStream property.
Although this definitely isn't the most ideal solution if you have to "visit" several sites. WebRequest is probably the way to go if that's the case.
Have you got any idea as to why your login request fails? Does the site display an error message? Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Im already filling the form's manually in the webbrowser control.
My idea why the login fails is because of the 'salt' it adds after the password.
And it gets the salt from the DB.
If i could fill in the forms programmatically with webresponse and request, would be great.
This way, i dont have to load anything, which takes a lot of time.
|
|
|
|