user32.dll message box

Description :


Normally we are using message boxes in windows.
The following code an example of message box
It is created from user32.dll

Namespace part

using System;
using System.Runtime.InteropServices;



This is the Main class for showing the message box

public class MyWinClass {
public static void Main() {
string MsgCaption = "My Message Title";
string MsgText = "This message is conformation of your database updation";
WINAPI.ShowMessage(0, MsgText, MsgCaption, 0);
}
}


Windows API for get the message box

public class WINAPI {
[DllImport("user32.dll", EntryPoint = "MessageBox")]
public static extern int ShowMessage(int hWnd,
string text, string caption, uint type);
}



Code Explanation

1. Create the WINAPI class
2. Get the message box
3. Show the WINAPI message box

The above output is very simple, But the main concept is get the message box from user32.dll

By
Nathan


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: