C# Console Program Won't Execute from Command Prompt

I have made a very simple program in C#. When I double click the compiled exe, it executes and works. When I run the exe from the command prompt, it does absolutely nothing. I have tried executing it from an Administrator command prompt also. I am on Windows 7. This is very frustrating.

The only command the program executes when ran is

SendMessageW(Process.GetCurrentProcess().MainWindowHandle, WM_APPCOMMAND, Process.GetCurrentProcess().MainWindowHandle, (IntPtr)APPCOMMAND_VOLUME_MUTE);

Answers


Not sure what you are trying to accomplish, but this little program

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(Process.GetCurrentProcess().MainWindowHandle);
        Console.ReadKey();
    }
}

may help you troubleshoot your problem.


A console program may have no message loop or main window. So SendMessageW() does not work.


Need Your Help

Batch renaming files in unix and rollback

linux unix shell rename

I rename few files (1234.xml, 9876.xml, 2345.xml etc) with .xml extension with the following code :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.