win32 api 함수중 messagebox를 호출하는 예제 입니다.

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.Diagnostics;

using System.IO; // 파일 스트림 처리
using Microsoft.Win32; // 레스트리 콘트롤

using System.Runtime.InteropServices; // DllImport 어트리뷰트가 정의됨

namespace OpenFile
{
    public partial class Form1 : Form
    {
       
        [DllImport("User32.dll")] // 윈도우 시스템 파일 User32.dll 참조
        public static extern int MessageBox(int hwnd, string lpText, string lpCaption, int uType);

        public Form1()
        {
            InitializeComponent();
        }
       
        private void Form1_Load(object sender, EventArgs e)
        {
            MessageBox(0, "Win32 MessageBox 호출", "DllImport 사용하기", 3);

        }

    }
}

'객체지향언어 > C#' 카테고리의 다른 글

델리게이트 - 참조  (0) 2009.08.10
델리게이트 - 익명메소드 예제.  (0) 2009.08.10
배틀넷 아뒤와 방제를 가지고 온다.  (0) 2009.08.09
FileWatcher 예제  (0) 2009.08.09
GetFiles 예제  (0) 2009.08.09

+ Recent posts