Last active
April 12, 2019 01:32
-
-
Save cress-cc/92896bab9f119377aba2f3c6e7bc0722 to your computer and use it in GitHub Desktop.
VBAでメモ帳起動して貼り付けるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ | |
(ByVal lpClassName As String, _ | |
ByVal lpWindowName As String) As Long | |
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _ | |
(ByVal hwndParent As Long, _ | |
ByVal hwndChildAfter As Long, _ | |
ByVal lpClassName As String, _ | |
ByVal lpWindowName As String) As Long | |
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ | |
(ByVal hwnd As Long, _ | |
ByVal msg As Long, _ | |
ByVal wParam As Long, _ | |
ByVal lParam As String) As Long | |
Private Const WM_SETTEXT = &HC | |
Public Sub Main() | |
Dim hApp As Long | |
Dim hEdit As Long | |
Call Shell("notepad", vbNormalFocus) | |
hApp = FindWindow("NotePad", vbNullString) | |
hEdit = FindWindowEx(hApp, 0, "Edit", vbNullString) | |
Call SendMessage(hEdit, WM_SETTEXT, 0, "じゅげむじゅげむごこうのすりきれ") | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment