All Projects → kirurobo → UniWinApiAsset

kirurobo / UniWinApiAsset

Licence: other
A window controller for Unity using Windows API

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to UniWinApiAsset

Pywinauto
Windows GUI Automation with Python (based on text properties)
Stars: ✭ 3,175 (+5374.14%)
Mutual labels:  windows-api, win32api
SharpUnhooker
C# Based Universal API Unhooker
Stars: ✭ 255 (+339.66%)
Mutual labels:  windows-api
learning-malware-analysis
This repository contains sample programs that mimick behavior found in real-world malware. The goal is to provide source code that can be compiled and used for learning purposes, without having to worry about handling live malware.
Stars: ✭ 124 (+113.79%)
Mutual labels:  windows-api
Ayase
🥥 Control everything by keyboard. Built for hackers and the blind.
Stars: ✭ 53 (-8.62%)
Mutual labels:  win32api
metrica-plugin-unity
Unity plugin for Yandex AppMetrica SDK
Stars: ✭ 24 (-58.62%)
Mutual labels:  unity-asset
JsonFormatter
Easy, Fast and Lightweight Json Formatter. (Serializer and Deserializer)
Stars: ✭ 26 (-55.17%)
Mutual labels:  unity-asset
Unity-FPS-Counter
#NVJOB FPS Counter and Graph. Free Unity Asset.
Stars: ✭ 44 (-24.14%)
Mutual labels:  unity-asset
unity-json-editor
A JSON Editor in the inspector. Preview and more information in README🙂
Stars: ✭ 64 (+10.34%)
Mutual labels:  unity-asset
wsudo
Proof of concept sudo for Windows
Stars: ✭ 71 (+22.41%)
Mutual labels:  windows-api
TsukiSuite
A toolsuite created to make Unity development easier
Stars: ✭ 23 (-60.34%)
Mutual labels:  unity-asset
creating-controls-in-assembler
Gitbook: https://mrfearless.gitbooks.io/creating-controls-in-assembler
Stars: ✭ 20 (-65.52%)
Mutual labels:  win32api
UnityGlobalTextSystem
Allow the user to 'change' the default font in Unity from "Arial" to a font of their liking.
Stars: ✭ 21 (-63.79%)
Mutual labels:  unity-asset
ThreadBoat
Program Uses Thread Execution Hijacking To Inject Native Shell-code Into a Standard Win32 Application
Stars: ✭ 162 (+179.31%)
Mutual labels:  win32api
xLogger
Simple windows API logger
Stars: ✭ 62 (+6.9%)
Mutual labels:  windows-api
Api-Break-for-x64dbg
x64dbg plugin to set breakpoints automatically to Win32/64 APIs
Stars: ✭ 136 (+134.48%)
Mutual labels:  win32api
ring3-kit
Hides Process From Task Manager Using NT API Hooking (NtQuerySystemInformation)
Stars: ✭ 60 (+3.45%)
Mutual labels:  win32api
Save-System-for-Unity
Save System for Unity with AOT (IL2CPP) and assets references support.
Stars: ✭ 116 (+100%)
Mutual labels:  unity-asset
t4-templates-unity3d
T4 Text Template Processor for Unity3D
Stars: ✭ 75 (+29.31%)
Mutual labels:  unity-asset
nvjob-boids
#NVJOB Simple Boids (Flocks of Birds, Fish and Insects). Flocking Simulation. Free Unity Asset.
Stars: ✭ 55 (-5.17%)
Mutual labels:  unity-asset
DokoDemoPainter
DokoDemoPainter is a fast and easy texture painting solution for Unity and can paint on both regular and skinned meshes
Stars: ✭ 43 (-25.86%)
Mutual labels:  unity-asset

UniWinApi

See also my new repository UniWindowController. It works on both Mac and Windows.


UniWinApi is a Windows API utility with a window controller class for Unity. This allows several window controls that Unity originally does not provide as followings.

  • Move window
  • Resize window
  • Maximize and Minimize
  • Transparent window (the window hasn't any borders, so it looks non-rectangular)
  • Accept file dropping
  • Open File open dialog (Experimental - file only now)
  • Move mouse pointer
  • Send mouse button operation (up / down)

This asset is designed to provide functions which enable your Unity application to be some kind of Desktop Mascot.

UniWinApi VRM viewer

Confirmed environment

  • Unity 2018.4.20f1, Unity 2019.2.18f
  • Windows 10 Pro x64
  • GeForce GTX980, GeForce GTX 1070
Scripting backend x86_64 x86
Mono x x
IL2CPP x

Usage

  1. Download .unitypackage file from the Releases page.
  2. Import the package to your project.
  3. Attach "WindowController.cs" to the object which you want to add the functions.
    • Recommended: Create an empty object named "WindowController".
  4. Build the project as "PC Standalone" for "Platform"

License

CC0

UniWinApi.cs is main. In addition, WindowsController.cs is provided which enables controls of self window.

You can change the state of the window. To enable that, change following values in Inspector View or write script which sets these values.

  • IsTransparent - Let borders of the window transparent
  • IsTopmost - Fixed to the front
  • IsMaximized - Maximize the window
  • IsMinimized - Minimize the window
  • EnableFileDrop - Enable file dropping
  • EnableDragMove - Enable window dragging with mouse left button

image

If you use file dropping, there is the event named `OnFilesDropped(string[] files). Thus, add some procedures to this.

I'm sorry that the document hasn't prepared. Please read the sample project (^-^;

Attention

  • Since I haven't known how to get window handle certainly, rarely you might operate with another window.
    • (On the other hand, you can designate and operate other windows)
  • You might be forced to down the application if the window lost the "Close" button or if you cannot see the window since the window goes to somewhere.

About transparent types

  • Alpha
    • Alpha channel is enabled.
    • If you use touch instead of a mouse, hit testing may cause discomfort.
    • Internally, this library uses DWM (Desktop Window Manager) APIs.
  • ColorKey
    • Only one color you specify will be transparent.
    • Hit testing is natural for touch.
    • The key color can be specified in WindowController.keyColor.
      • The default color is 0x010001.
    • Internally, this library uses the layered window.

FAQ

  • The transparent application looks false on Editor
    • This is because of the specification. You have to build to confirm the transparent appearance.
    • You cannot let the Game window transparent. I suppose it's because something paints the background.
    • Normally the operation object is Game View. If the view is docked with other views, the object is the whole window.

License

CC0

UniWinApi is CC0 public domain. You can modify, duplicate or redistribute without copyright notice. However, there is no operation guarantee.

*I recognize this should be able to be CC0 in the scope of copyright protection, though I have used other information such as blogs as references. Because when I finish implementation of whole function set, the deliverable must be similar.

Contact & Source

Change log

  • 2021/09/27 Added a setting to accept file drop even when running as administrator
  • 2020/08/09 Fix DwmApi. Rename transparent type enum
  • 2020/06/07 Support Unity 2019. Add layered winodow method
  • 2019/01/23 Add file open dialog. Return the way to acquire self window to be active window standard
  • 2018/12/28 Add namespace, Modify the way to acquire self window to be PID standard
  • 2018/12/07 Separate the asset part of UniWinApi
  • 2018/09/09 Publish package since this looks to work mostly as expected
  • 2018/08/24 Arrange again as UniWinApi
  • 2015/03/03 Set keep the status just before when the window is maximized or minimized
  • 2014/04/26 First publish

UniWinApi (日本語説明)

新リポジトリ UniWindowController もご覧ください。 こちらは Mac でも Windows でも動作します。


UniWinApi は Unityでは本来行えない操作を Windows API 経由で行うものです。
自ウィンドウに対しての処理を行うためのコントローラーが付属します。
以下のようなことができます。

  • ウィンドウの移動
  • ウィンドウサイズ変更
  • ウィンドウの最大化、最小化
  • ウィンドウの透過 (枠なしで、四角形でないウィンドウにします)
  • ファイルのドロップを受け付ける
  • Windowsのダイアログでファイルを開く(試験実装で単一ファイルのみ)
  • マウスポインタを移動させる
  • マウスのボタン操作を送出する

主にデスクトップマスコット的な用途で利用しそうな機能を取り込んでいます。 UniWinApi VRM viewer

確認済み動作環境

  • Unity 2018.4.20f1, Unity 2019.2.18f
  • Windows 10 Pro x64
  • GeForce GTX980, GeForce GTX 1070
Scripting backend x86_64 x86
Mono
IL2CPP

利用方法

  1. Releases ページから .unitypackage ファイルをダウンロードします。
  2. それをプロジェクトにインポートします。
  3. "WindowController.cs" スクリプトを適当なオブジェクトにアタッチしてください。
    • "WindowController" といった名前の空オブジェクト作成をお勧めします。
  4. Platform として PC Standalone を選び、ビルドしてください。

UniWinApi が本体ですが、自ウィンドウを操作するものとして WindowController を用意しています。

インスペクタで下記を変更するか、スクリプトから変更するとウィンドウの状態を変えられます。

  • IsTransparent … ウィンドウ枠を透明化
  • IsTopmost … 常に最前面
  • IsMaximized … ウィンドウ最大化
  • IsMinimized … ウィンドウ最小化
  • EnableFileDrop … ファイルドロップを受け付ける
  • EnableDragMove … マウス左ボタンでウィンドウを移動できる

image

ファイルドロップを利用する場合、OnFilesDropped(string[] files) というイベントがありますので、そちらに処理を追加してください。 files にはドロップされたファイルのパスが入ります。

ドキュメントは整えられていないため、利用例はサンプルをご覧ください (^-^;

注意点

  • ウィンドウハンドルを確実に取る方法が分ってないので、別のウィンドウが操作対象になったりするかも知れません。
    • (むしろ別のウィンドウもタイトルやクラス名で指定して操作できます。)
  • 閉じるボタンがなくなったり、ウィンドウを見失った場合、タスクマネージャから終了する必要が出るかも知れません。

透明化方式について

  • Alpha
    • 半透明が有効です。
    • マウスでなく、タッチで操作するとアクティブかどうかの判別が難しく、不自然に感じる場合があります。
    • 内部的には DWM (Desktop Window Manager) APIを使用します。
  • ColorKey
    • 指定した一色のみが透明として扱います。
    • タッチでも自然な操作となります。
    • WindowController.keyColor で色を指定できます。
      • デフォルトは 0x010001 です。
    • 内部的には Layered Window を使用します。

FAQ

  • エディタ上で透明にすると表示がおかしいのですが。
    • すみません。仕様です。透明化はビルドしたものでご確認ください。
    • Game ウィンドウはどうも背景が塗りつぶされてしまっているようで、透明化されません。
    • ゲームビューが操作対象となりますが、他のビューとドッキングしていた場合はそのウィンドウごと対象となります。

ライセンス

CC0

UniWinApi は、CC0(パブリックドメイン)としています。
著作権表示なしで修正、複製、再配布も可能です。好きに使っていただけますが無保証です。

※他の方のブログなど参考にしている部分が大いにありますが、一通り作成した結果、同様の機能を実装した場合は似た内容になるとして、著作権で保護される範囲においては基本的に独自のものとしてCC0にできると判断しています。

連絡先・配布元

更新履歴

  • 2021/09/27 管理者として実行時にもドロップを受け付ける設定を追加
  • 2020/08/09 DwmApiの不具合を修正。透過モードの名前変更。
  • 2020/06/07 Unity 2019 対応。Layered Window による透過モードを追加。
  • 2019/01/23 ファイルオープンダイアログ追加。自ウィンドウ取得方法をアクティブウィンドウ基準に戻した。
  • 2018/12/28 namespaceを設定、自ウィンドウ取得をPIDを基準とする方法に修正
  • 2018/12/07 UniWinApiのアセット部分を分離
  • 2018/09/09 おおよそ想定通りに動作しそうなため、パッケージを公開
  • 2018/08/24 UniWinApiとして整理し直した
  • 2015/03/03 最小化、最大化時はその直前の状態を保存するようにした
  • 2014/04/26 公開用初版
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].