Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Sunday, September 30, 2007

Open a working folder

C++ code snippet:

ShellExecute(NULL, NULL, L"C:\\Windows", NULL, NULL, SW_SHOWNORMAL);

C++ code snippet:

System.Diagnostics.Process prc = new System.Diagnostics.Process();
prc.StartInfo.FileName = "explorer.exe";
prc.StartInfo.Arguments = "C:\\Windows";

prc.Start();

Saturday, July 28, 2007

Google Boring Blog Editor

Every time I create a new post in the blogger I get bored from the post editor

You may ask why???

As I make a series of switches between the html editor and the Rich Text editor

I can't use only one to post a message

For example:

If I want to add an embed object or a movie, I have to use the html editor so I have to format the text in the html editor,… I lose my eyesight inside the html tags.

If I want to add a code snippet I have to format it in the html editor

If switched to html editor and get back to the Rich Text sometimes I lose the format of text formatted before.

Some html tags are not working in the html editor so I can't use an html document generated by MS Word.

Add to this somethings that I forgot.

So I lose a lot of time editing my posts

May I say that I was too lazy, but now I'm not?

And it is the last time to lose time editing my posts

Now I write my post in MS Word and I made simple windows app that convert each text block into its corresponding html format that I need.

That all

This scren shot was edited by the image option


Download Demo - 5 KB
Download Source - 13 KB

Thursday, July 26, 2007

Type.GetProperty Method


public PropertyInfo GetProperty ( string name )

This function Searches for the public property with the specified name.

Example

using System;
using System.Reflection;

class MyClass
{
    private int myProperty;
    // Declare MyProperty.
    public int MyProperty
    {
        get
        {
            return myProperty;
        }
        set
        {
            myProperty=value;
        }
    }
}
public class MyTypeClass
{
    public static void Main(string[] args)
    {
        try
        {
            // Get the Type object corresponding to MyClass.
            Type myType=typeof(MyClass);    
            // Get the PropertyInfo object by passing the property name.
            PropertyInfo myPropInfo = myType.GetProperty("MyProperty");
            // Display the property name.
            Console.WriteLine("The {0} property exists in MyClass.", myPropInfo.Name);
        }
        catch(NullReferenceException e)
        {
            Console.WriteLine("The property does not exist in MyClass." + e.Message);
        }
    }
}