Skip to content

Instantly share code, notes, and snippets.

@gekka
gekka / pch.h
Created April 16, 2024 18:30
Unicodeを書記素で切り出せるCStringを試す
// pch.h: プリコンパイル済みヘッダー ファイルです。
// 次のファイルは、その後のビルドのビルド パフォーマンスを向上させるため 1 回だけコンパイルされます。
// コード補完や多くのコード参照機能などの IntelliSense パフォーマンスにも影響します。
// ただし、ここに一覧表示されているファイルは、ビルド間でいずれかが更新されると、すべてが再コンパイルされます。
// 頻繁に更新するファイルをここに追加しないでください。追加すると、パフォーマンス上の利点がなくなります。
#ifndef PCH_H
#define PCH_H
#define CString CStringDef
@gekka
gekka / CStringExtension.cpp
Last active April 16, 2024 09:47
ユニコードを異字体セレクタとかを考慮した1文字ごとに分割
#include "test.h"
#include <afxwin.h>
#include <icu.h>
#pragma comment(lib, "icu.lib")
typedef struct GraphemeLeft_ {
uint32_t value;
GraphemeLeft_(int i) : value(i) { };

Wouldn't the behavior you want be achieved by setting the Owner property instead of setting the Topmost property for sub-window?

public partial class MainWindow : Window
{
    public MainWindow()
    {
        //InitializeComponent();
        this.Title = "MainWindow";
<Canvas x:Name="myCanvas" Cursor="">
<Canvas.Resources>
<ControlTemplate TargetType="Thumb" x:Key="markerTemplate">
<Rectangle x:Name="rect"
Stroke="{TemplateBinding Background}"
Fill="Transparent"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</ControlTemplate>
Public Sub ExportTest()
Dim ads As Excel.AddIns
Set ads = Application.AddIns
Dim iAd As Integer
Dim iPrj As Integer
For iAd = 1 To ads.Count
Dim ad As Excel.AddIn
@gekka
gekka / ContentDialogSample.cs
Created April 11, 2023 10:40
UWPのContentDialogのサンプル
//https://social.msdn.microsoft.com/Forums/ja-JP/8a58899a-a324-48db-80c0-e0befddfee52/
public async static Task<string> MessageQuestion(string title, string text, params string[] answers)
{
StackPanel panel = new StackPanel();
foreach (var ans in answers)
{
RadioButton r = new RadioButton() { Content = ans };
panel.Children.Add(r);
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="200" Width="300">
<Window.Resources>
#include "pch.h"
#include "test.h"
#include <objbase.h>
#include <initguid.h>
#include <mmsystem.h>
#include <dsound.h>
#pragma comment(lib, "dsound.lib")
static BOOL ReadWav(void** ppmem, DWORD* psize, WAVEFORMATEX* pformat);
@gekka
gekka / sample.vb
Created September 2, 2022 11:42
VB.NetでOutlookのメールをmsgファイルに書き出し
'https://social.msdn.microsoft.com/Forums/ja-JP/04531896-4b17-4b7f-851b-4b43dad05438
Imports Microsoft.Office.Interop 'OutlookのCOM参照を追加
Module Module1
Sub Main()
'出力先のフォルダ
Dim output As String = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "output_msg")
namespace ConsoleApp1
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
class Program