LoginSignup
37
37

More than 5 years have passed since last update.

C++/CLI: Visual Studio 2013 で Windows フォームアプリケーションを作る

Last updated at Posted at 2014-04-11

1. ソリューションに「空のプロジェクト」を起こす

ソリューションのコンテキスト・メニュー: 追加/新しいプロジェクト から
Visual C++/CLR/空のCLRプロジェクト を選択する。
fig01.png

2. Main-Form を追加する

生成されたプロジェクトのコンテキスト・メニュー: 追加/新しい項目 から
UI/Windows フォーム を選択する。
fig02.png

3. main() を追加する

生成されたプロジェクトのコンテキスト・メニュー: 追加/新しい項目 から
コード/C++ファイル(.cpp) を選択し、以下のコードを書く。
fig03.png

#include "MyForm.h" // [2]で付けたForm名.h

using namespace System;
using namespace System::Windows::Forms;

[STAThreadAttribute]
int main(array<String^>^ args) {
  Application::EnableVisualStyles();
  Application::SetCompatibleTextRenderingDefault(false); 
  // gcnew [1]で付けたプロジェクト名::[2]で付けたForm名()
  Application::Run(gcnew MyApp::MyForm()); 
  return 0;
}

4. プロジェクト・プロパティを変更する

プロジェクト・プロパティ: 構成プロパティ/リンカー/システム/サブシステム
を Windows (/SUBSYSTEM:WINDOWS) にする。
fig04.png

プロジェクト・プロパティ: 構成プロパティ/リンカー/詳細設定/エントリポイント
を main にする。
fig05.png

37
37
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
37
37