Win32-Operating System
CSName,Caption,Windows directory,serialno,registered user,no of processes
Win32-Bios
Version,name,manufacturer,serialnumber,release date,current language,primary bios,status
Win32-ComputerSystem
Manufacturer,username,totalphysicalmemory,system type,model
Win32-Processor
Caption,Current Clock Speed
Win32-TimeZone
Caption
Win32-CDROMDrive
Caption,mediatype,drive,manufacturer,description
Win32-Account
Name,description,domain,sid
Win32-DiskDrive
Caption,deviceid,index,partitions
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;
namespace WindowsFormsApplication1
{
public partial class WMI : Form
{
public WMI()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SelectQuery query = new SelectQuery("Win32OperatingSystem");
ManagementObjectSearcher search = new ManagementObjectSearcher(query);
foreach (ManagementObject mobj in search.Get())
{
MessageBox.Show(mobj["CSname"].ToString());
}
}
private void WMI_Load(object sender, EventArgs e)
{
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsFormsApplication1
{
public partial class graphics : Form
{
public graphics()
{
InitializeComponent();
}
private void graphics_Load(object sender, EventArgs e)
{
}
private void graphics_Paint(object sender, PaintEventArgs e)
{
Graphics g;
g = this.CreateGraphics();
Pen p = new Pen(Brushes.Purple, 3);
g.DrawEllipse(p, 100, 100, 100, 100);
g.FillEllipse(Brushes.Plum, 200, 100, 100, 200);
g.DrawLine(p, new Point(100, 200), new Point(200, 100));
Point[] p1 = new Point[5];
p1[0] = new Point(100, 50);
p1[1] = new Point(200, 100);
p1[2] = new Point(250, 100);
p1[3] = new Point(200, 50);
p1[4] = new Point(100, 250);
g.DrawPolygon(p, p1);
System.Drawing.Font f = new Font("Times New Roman", 15, FontStyle.Bold);
StringFormat f1 = new StringFormat(StringFormatFlags.NoClip);
StringFormat f2 = new StringFormat(f1);
f1.LineAlignment = StringAlignment.Center;
f2.FormatFlags = StringFormatFlags.DirectionVertical;
f2.Alignment = StringAlignment.Far;
Rectangle r=new Rectangle(100,100,100,100);
g.DrawRectangle(Pens.Brown, r);
g.DrawString("Hello world", f, Brushes.Red, r.X, r.Y, f1);
g.DrawString("Hai", f, Brushes.SlateBlue, r.Left, r.Top, f2);
}
}}
Try
' Dim b As SolidBrush = New SolidBrush(dgvSubscriptions.RowHeadersDefaultCellStyle.ForeColor)
'e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 10, e.RowBounds.Location.Y + 4)
Dim dg As DataGridView = DirectCast(sender, DataGridView)
' Current row record
Dim rowNumber As String = String.Empty
rowNumber = (e.RowIndex + 1).ToString()
' Format row based on number of records displayed by using leading zeros
While rowNumber.Length < dg.RowCount.ToString().Length
rowNumber = "0" & rowNumber
End While
' Position text
Dim size As SizeF = e.Graphics.MeasureString(rowNumber, Me.Font)
If dg.RowHeadersWidth < CInt(size.Width + 20) Then
dg.RowHeadersWidth = CInt(size.Width + 20)
End If
' Use default system text brush
Dim b As Brush = SystemBrushes.ControlText
' Draw row number
e.Graphics.DrawString(rowNumber, dg.Font, b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2))
Catch ex As Exception
Utils.LogHandler.HandleError(ex)
End Try
End Sub
Form2.StartPosition = FormStartPosition.CenterParent;
this.Hide();
Form2.ShowDialog();
this.Close();
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;using System.Text;
using System.Security.Cryptography;
using System.IO;using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string str= Encrypt("Silpa");
SqlConnection con = new SqlConnection("Data Source=INFO-9;Initial Catalog=test;Integrated Security=True");
SqlCommand cmd=new SqlCommand("insert into pwdd values('"+str+"')",con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string str1 = Decrypt("88tlfz/eGbtHNKDnXU6gQw==");
}
public static string Decrypt(string TextToBeDecrypted)
{
RijndaelManaged RijndaelCipher = new RijndaelManaged();
string Password = "CSC";
string DecryptedData;
try {
byte[] EncryptedData = Convert.FromBase64String(TextToBeDecrypted);
byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());
//Making of the key for decryption
PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);
//Creates a symmetric Rijndael decryptor object.
ICryptoTransform Decryptor = RijndaelCipher.CreateDecryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
MemoryStream memoryStream = new MemoryStream(EncryptedData);
//Defines the cryptographics stream for decryption.THe stream contains decrpted data
CryptoStream cryptoStream = new CryptoStream(memoryStream, Decryptor, CryptoStreamMode.Read);
byte[] PlainText = new byte[EncryptedData.Length];
int DecryptedCount = cryptoStream.Read(PlainText, 0, PlainText.Length); memoryStream.Close();
cryptoStream.Close();
//Converting to string
DecryptedData = Encoding.Unicode.GetString(PlainText, 0, DecryptedCount);
}
catch
{
DecryptedData = TextToBeDecrypted;
}
return DecryptedData;
}
public static string Encrypt(string TextToBeEncrypted)
{
RijndaelManaged RijndaelCipher = new RijndaelManaged();
string Password = "CSC";
byte[] PlainText = System.Text.Encoding.Unicode.GetBytes(TextToBeEncrypted);
byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString()); PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);
//Creates a symmetric encryptor object.
ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
MemoryStream memoryStream = new MemoryStream();
//Defines a stream that links data streams to cryptographic transformations CryptoStream cryptoStream = new CryptoStream(memoryStream, Encryptor, CryptoStreamMode.Write);
cryptoStream.Write(PlainText, 0, PlainText.Length);
//Writes the final state and clears the buffer
cryptoStream.FlushFinalBlock();
byte[] CipherBytes = memoryStream.ToArray();
memoryStream.Close();
cryptoStream.Close();
string EncryptedData = Convert.ToBase64String(CipherBytes);
return EncryptedData;
}
}
Firstly Install ansmptp.exe :
Source Code:
using AOSMTPLib;
AOSMTPLib.MailClass oSmtp = new AOSMTPLib.MailClass();
oSmtp.FromAddr = "chinnamallempati9@gmail.com";
oSmtp.AddRecipient("Support Team", "anveshmallempati9@gmail.com", 0);
oSmtp.Subject = "Test";
oSmtp.BodyText = "Hello, this is a test....";
if (oSmtp.SendMail() == 0)
{
Response.Write("Message delivered!");
}
else
{
Response.Write(oSmtp.GetLastErrDescription());
}
String militaryTimeFormat = "HH:mm";
String input = DateTime.Now.ToString(militaryTimeFormat);
DateTime time = DateTime.ParseExact(input, militaryTimeFormat, null);
string militaryTime = "06/07/2013 20:30";
IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true);
DateTime militaryDate =DateTime.Parse(militaryTime, culture, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
string g=DateTime.Now.ToString("dd/MM/yyyy HH:mm");
string h = DateTime.Now.ToString("HH:mm");


