Public 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
Option Explicit 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 LongPrivate Sub Command1_Click() MessageBox Me.hwnd, "just a test string", "aaa", 0 End Sub
HRESULT MessageBox( LPCWSTR lpszText, // pointer to the text to be displayed LPCWSTR lpszTitle, // pointer to the title of the box UINT fuStyle, // style of the message box int * piRetval // pointer to the return value );
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 LongPrivate Sub Command1_Click()
MessageBox Me.hwnd, "just a test string", "aaa", 0
End Sub
LPCWSTR lpszText, // pointer to the text to be displayed
LPCWSTR lpszTitle, // pointer to the title of the box
UINT fuStyle, // style of the message box
int * piRetval // pointer to the return value
);
你的效果是弹出一个窗体吗!你可以用SendMessage给那个窗体发个消息,让其弹出!
{
WNDCLASS wc;
HWND hWnd;
wc.style = 0;
wc.lpfnWndProc = WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( hInstance, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "dxHello"; RegisterClass(&wc); hWnd=CreateWindowEx(
0,
"dxHello",
"",
WS_POPUP,
0,
0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
hInstance,
NULL);
if ( !hWnd ) return FALSE;
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
createwindowex函数可以生成一个popup窗体。
把他转成相应的vb代码