def __init__(self, icon_path, msg_q): """Initialize.""" self.visible = 0 self.log = [] self._thread = None self.msg_q = msg_q self.message_box = Mbox() message_map = { WM_DESTROY: self.onDestroy, WM_USER + 20: self.onTaskbarNotify, } wc = WNDCLASS() hinst = wc.hInstance = GetModuleHandle(None) icon_flags = LR_LOADFROMFILE | LR_DEFAULTSIZE try: self.hicon = LoadImage(hinst, os.path.realpath(icon_path), IMAGE_ICON, 0, 0, icon_flags) except Exception as e: print(str(e)) self.hicon = LoadIcon(0, IDI_APPLICATION) wc.lpszClassName = str("Trustbase_notification") #lol wc.style = CS_VREDRAW | CS_HREDRAW #wc.hCursor = win32gui.LoadCursor( 0, win32con.IDC_ARROW ) wc.hbrBackground = COLOR_WINDOW wc.lpfnWndProc = message_map # could also specify a wndproc. classAtom = RegisterClass(wc) # Create the Window. style = WS_OVERLAPPED | WS_SYSMENU self.hwnd = CreateWindow( classAtom, "MITM_alert", style, \ 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, \ 0, 0, hinst, None) UpdateWindow(self.hwnd) self.notification_id = 1 self.show()