Windows API 逐个逐个学(0)---- MessageBox

  从《精通 Windows API 函数、接口、编程实例》里摘取下来的实例.分别用VC++与VB6练习.

#include <windows.h>
//连接时使用User32.lib
#pragma comment (lib, "User32.lib")

/* ************************************
* WinMain
* 功能  Windows应用程序示例
**************************************/
int WinMain(
            HINSTANCE hInstance,
            HINSTANCE hPrevInstance,
            LPSTR lpCmdLine,
            int nCmdShow
            )
{
    // 调用API函数 MessageBox
    MessageBox(NULL,
        TEXT("开始学习Windows编程"),
        TEXT("消息对话框"),
        MB_OK);
    return 0;
}

 VB6 Code:

Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA"_
               
(ByVal hwnd As Long, _
                ByVal lpText As String, _
ByVal lpCaption As String, _
                ByVal wType As Long) As Long Private Sub Command1_Click() MessageBox 0, "在窗体一之中调用 MessageBox", "Form1", vbInformation End Sub

 

posted @ 2013-01-23 22:14  秋官  阅读(371)  评论(2编辑  收藏  举报