Message.cpp
上传用户:sz0451
上传日期:2022-07-29
资源大小:256k
文件大小:1k
- // This is the main project file for VC++ application project
- // generated using an Application Wizard.
- #include "stdafx.h"
- #using <mscorlib.dll>
- using namespace System;
- using namespace System::Runtime::InteropServices;
- // Declare the HWND typedef
- typedef void* HWND;
- // Set up the import
- [DllImportAttribute("User32.dll", CharSet=CharSet::Auto)]
- extern "C" int MessageBox(HWND hw, String* text,
- String* caption, unsigned int type);
- // This is the entry point for this application
- #ifdef _UNICODE
- int wmain(void)
- #else
- int main(void)
- #endif
- {
- Console::WriteLine(S"P/Invoke Example");
-
- String* theText = S"Hello World!";
- String* theCaption = S"A Message Box...";
- MessageBox(0, theText, theCaption, 0);
- return 0;
- }