トルネード

毛利のメモ書き

C++

MySQL 8.3.0インストール Visual C++ 再頒布可能パッケージ

Windows用の MySQL Community Server 8.3.0 をインストールしようと思い MSI(mysql-8.3.0-winx64.msi)をダウンロードした msi を 実行すると 下のようなメッセージが出た This application requires Visual Studio 2019 ×64 Redistributable. Please install…

Amazon Linux 2 Clang 7.0.1 Install

Amazon Linux 2 は、 Amazon Linux の次世代バージョンです。 Amazon Linux 2にClang 7.0.1をインストール方法です。 まず、cmake 3.16.0をインストールします。 wget https://cmake.org/files/v3.16/cmake-3.16.0.tar.gz tar -xvzf cmake-3.16.0.tar.gz cd …

std::shared_mutex, std::shared_timed_mutexを理解する

C++17では、std::shared_mutexが追加されています。 std::mutexとは違いstd::shared_lockが使えます。 std::shared_mutexは、std::mutexと同じようにstd:: lock_guardも使えます。 std::shared_mutex m1; std::lock_guard<std::shared_mutex> lock(m1); 下記は、std:: lock_guar</std::shared_mutex>…

std::optional

std::optionalはstd::optional<int>と指定するとnulloptを代入できるので、0以外のnulloptが利用できる。 std::optional<int> i1 = std::nullopt; if(i1){ std::cout << i1.value() << std::endl; } std::optional<std::string>でも同じくnulloptが使えます。 std::optional<std::string> text1 =</std::string></std::string></int></int>…

XAML UI Debugging Toolsを非表示にする

XAML Debugging Tools デバッグ実行時にアプリ画面上に表示されているツールバー 非表示に設定できます。 Menu[Tools|Options...]Optionsダイアログが表示されます。 [Debugging|General]内の「Enable UI Debugging Tools for XAML」のチェックを外す…

Ubuntu 18.04.1 desktop にclangをインストール

Ubuntu 18.04にclang 6.0をインストールする sudo apt update sudo apt install clang clang --versionで確認すると clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

UWP VC++ 画面遷移 Navigate

Visual Studio VC++ 2017のUWPでの画面遷移 以前C#での方法でも書いたが、Navigateを使う。 VC++でのNavigate 画面にボタンを配置し、クリックイベントを作る。 あらかじめ作っておいた「空白のページ」の名前はpage2 作成されたイベントメソッド内に下記を…

UWP VC++ UTF-8から Platform::String変換

Visual Studio 2017 UWP C++でUTF-8のデータからPlatform::String変換する。 UTF-8の文字列データはstd::stringに収納できるので、一旦stringに入れておく。 std::function<Platform::String ^ (std::string)> Utf8ToPlatformString{ [](std::string stin) { std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;</std::codecvt_utf8_utf16<wchar_t></platform::string>…

UWP VC++ HttpClientオブジェクトを使ったREST問合せ

Visual Studio 2017 UWP C++で、HttpClientオブジェクトを使ったREST問合せ方法 xaml側でButtonとTextBox・ProgressRingを配置します。ButtonクリックイベントでREST問合せし結果をTextBoxに表示します。 問合せ中はProgressRingを動かすようにします。

UWP VC++ JSON文字列データ解析方法

Visual Studio 2017 UWP VC++ の JsonObjectを使ってJSON文字列解析 void cpp_uwp::json_test::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { using namespace Windows::Data::Json; std::function<void(JsonObject^)> hhge{ [this](JsonOb</void(jsonobject^)>…

UWP VC++ JsonObjectでJSONデータ作成

Windows::Data::Json::JsonObject Visual Studio 2017 のUWP VC++ でJSONデータの生成方法です。 JsonObjectは、JSONデータの生成ができます。 xaml側でJSON生成するボタンと出来上がったJSONを表示するためのTextBoxを用意します。

UWP VC++ Dispatcher->RunAsync()

C++

Visual Studio 2017 UWP VC++でDispatcher->RunAsync Dispatcher.RunAsyncはワーカースレッドから提供されたUIスレッドのコールバックをスケジュールし、結果を非同期的に返します。 もっといい方法あるのかと思うんですが、結局【標準のThread】をつかって…

UWP VC++ タイトルバー透過

「C#でタイトルバー透過」と同じように VC++でもApplicationViewTitleBarを操作します。 //App.xaml.cpp using namespace Windows::UI::ViewManagement; void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) { auto …

UWP VC++ TreeView

Visual Studio 2017 VC++ UWPでのTreeView xaml <Grid> <TreeView Name="TreeView1" Loaded="TreeView1_Loaded" ItemInvoked="TreeView1_ItemInvoked"/> </Grid> VC++コード void test::TreeView1_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { #define IntToStr( ii ) static_cast

UWP 入門 - VC++ std::wstring to Platform::String

Visual Studio 2017 UWP std::wstring からPlatform::String へ std::wstring s1 = L"文字列"; //Platform::String ^s2; Platform::String ^s3 = ref new Platform::String(s1.c_str() ); Platform::String ^s4{ ref new Platform::String(s1.c_str()) }; Pl…

UWP 入門 - VC++ ウィンドウ半透明

Visual Studio 2017 UWP ウィンドウ半透明表示 C++版 Rectangleを半透明にしてウィンドウ壁紙を半透明表示させます。 <Rectangle Fill="Transparent" Name="Rectangle1" Loaded="Rectangle1_Loaded"></Rectangle> using namespace Windows::UI::Composition; public ref class MainPage sealed { Compositor^ _Compositor; SpriteVisual^ _SpriteVisua…