2022年6月27日月曜日

this.handleを追加

 次のVersionでGUIのメインフォームのハンドルthis.handle(HWND=xx)を追加します。

なので、EnumWindowsでハンドル探しをする必要がなく、次のようにダイレクトに記述できます。(HWNDは、EnumWindowsや、SPY++したハンドルとは異なりますが、問題なく動くようです。)




import win32clipboard
import win32gui
import ctypes

#---------------------------
xlHairline = 1
xlThin     = 2
xlThick    = 4
xlMedium   = -4138

    # ------------------------------------------------------------------
    # Excel Enum XlFileFormat
    # ------------------------------------------------------------------
xlCSV                         =  6
xlHtml                        = 44
xlWorkbookDefault             = 51
xlOpenXMLWorkbook             = 51
xlOpenXMLWorkbookMacroEnabled = 52
xlWorkbookNormal              = -4143
xlCurrentPlatformText         = -4158

    # ------------------------------------------------------------------
    # Excel Enum XlLineStyle
    # ------------------------------------------------------------------
xlContinuous    =  1
xlDashDot       =  4
xlDashDotDot    =  5
xlSlantDashDot  = 13
xlDash          = -4115
xldot           = -4118
xlDouble        = -4119
xlLineStyleNone = -4142
    # ------------------------------------------------------------------
    # Excel Enum XlOrientation
    # ------------------------------------------------------------------
xlHorizontal = -4128
xlVertical   = -4166
xlDownward   = -4170
xlUpward     = -4171
 
# ------------------------------------------------------------------
#https://docs.microsoft.com/en-us/office/vba/api/excel.xlformatconditionoperator
xlCellValue=1
xlExpression=2
xlBetween=1#	Between. Can be used only if two formulas are provided.
xlEqual=3#	Equal.
xlGreater=5#	Greater than.
xlGreaterEqual=7#	Greater than or equal to.
xlLess=6#	Less than.
xlLessEqual=8#	Less than or equal to.
xlNotBetween=2#	Not between. Can be used only if two formulas are provided.
xlNotEqual=4#	Not equal.
xlUnderlineStyleSingle           = 2 
xlCenter      = -4108

MB_OK=0x00000000#The message box contains one push button: OK. This is the default.
MB_OKCANCEL=0x00000001#The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL=0x00000005#The message box contains two push buttons: Retry and Cancel.
MB_YESNO=0x00000004#The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL=0x00000003#The message box contains three push buttons: Yes, No, and 

MB_TOPMOST=0x00040000#The message box is created with the WS_EX_TOPMOST window style.
IDABORT=3#The Abort button was selected.
IDCANCEL=2#The Cancel button was selected.
IDCONTINUE=11#The Continue button was selected.
IDIGNORE=5#The Ignore button was selected.
IDNO=7#The No button was selected.
IDOK=1#The OK button was selected.
IDRETRY=4#The Retry button was selected.
IDTRYAGAIN=10#The Try Again button was selected.
IDYES=6#The Yes button was selected.


MessageBox = ctypes.windll.user32.MessageBoxW
res=MessageBox(HWND, '本当に色付き出力にしますか?色付きにするとすごく時間がかかります。', '色付き出力選択', MB_TOPMOST|MB_YESNOCANCEL)

0 件のコメント:

コメントを投稿