#include <iostream>
#include <windows.h>
void foo();
#pragma managed
#pragma comment(lib, "user32.lib")
using namespace System;
int main(array<System::String ^> ^args)
{
// Call Managed Code
Console::WriteLine(L"Managed Code");
// Call Windows API Code
::MessageBox(NULL, _T("Win32 API in Managed Area"), _T("Hello"), MB_OK);
// Call Unmanaged Code
foo();
return EXIT_SUCCESS;
}
#pragma unmanaged
using namespace std;
void foo()
{
cout << "Unmanaged Code" << endl;
MessageBox(NULL, _T("Win32 API in Unmanaged Area"), _T("Hello"), MB_OK);
}
#include <windows.h>
void foo();
#pragma managed
#pragma comment(lib, "user32.lib")
using namespace System;
int main(array<System::String ^> ^args)
{
// Call Managed Code
Console::WriteLine(L"Managed Code");
// Call Windows API Code
::MessageBox(NULL, _T("Win32 API in Managed Area"), _T("Hello"), MB_OK);
// Call Unmanaged Code
foo();
return EXIT_SUCCESS;
}
#pragma unmanaged
using namespace std;
void foo()
{
cout << "Unmanaged Code" << endl;
MessageBox(NULL, _T("Win32 API in Unmanaged Area"), _T("Hello"), MB_OK);
}
'Code > C C++' 카테고리의 다른 글
| [C++] Regular Expressions Class: regex (0) | 2010.04.18 |
|---|---|
| [C++/CLI] #pragma managed, #pragma unmanaged (0) | 2009.05.09 |
| [C++] 16진수 문자열을 2진수 문자열로 변환 (0) | 2009.04.19 |
| [MFC] CString Sample (0) | 2009.03.17 |
| [C/C++] Dialog Test Sample Project (0) | 2008.11.11 |
SampleCLR.zip