- Copy file
C:\Windows\System32\UIAutomationCore.dll
file to users Documents i.eC:\Users\admin\Documents
then add referenceUIAutomationClient
to your macro file. - Paste below code in your module:
Option Explicit Dim ie As InternetExplorer Dim h As LongPtr Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr Sub Download() Dim o As IUIAutomation Dim e As IUIAutomationElement Set o = New CUIAutomation h = ie.Hwnd h = FindWindowEx(h, 0, "Frame Notification Bar", vbNullString) If h = 0 Then Exit Sub Set e = o.ElementFromHandle(ByVal h) Dim iCnd As IUIAutomationCondition Set iCnd = o.CreatePropertyCondition(UIA_NamePropertyId, "Save") Dim Button As IUIAutomationElement Set Button = e.FindFirst(TreeScope_Subtree, iCnd) Dim InvokePattern As IUIAutomationInvokePattern Set InvokePattern = Button.GetCurrentPattern(UIA_InvokePatternId) InvokePattern.Invoke End Sub
import sys from PyQt5.QtCore import QSize from PyQt5.QtGui import QImage, QPalette, QBrush from PyQt5.QtWidgets import * class MainWindow ( QWidget ): def __init__ ( self ): QWidget. __init__ ( self ) self .setGeometry( 100 , 100 , 300 , 200 ) oImage = QImage( "test.jpg" ) sImage = oImage.scaled(QSize( 300 , 200 )) # resize Image to widgets size palette = QPalette() palette.setBrush( 10 , QBrush(sImage)) # 10 = Windowrole self .setPalette(palette) self .show() if __name__ == "__main__" : app = QApplication(sys.argv) oMainwindow = MainWindow() sys.exit(app.exec_())
Comments
Post a Comment