Beispiel #1
0
 def _fn2handle(self,fn):
     if self.kind=='bitmap':
         try:
             self._handle = user32.LoadImage(0,windll.cstring(fn),
                 IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE)
         except:
             logTraceback(None)
             from manygui.backends.dwgui import _lastErrorMessage 
             log(_lastErrorMessage())
Beispiel #2
0
 def _register_class(self):
     if _verbose: log('Application._register_class:start',str(self))
     class WNDCLASS(structob.struct_object):
         oracle = structob.Oracle (
             'window class information',
             'Nllllllllll',
             ('style',
              'lpfnWndProc',
              'cls_extra',
              'wnd_extra',
              'hInst',
              'hIcon',
              'hCursor',
              'hbrBackground',
              'menu_name',
              'lpzClassName',
              )
             )
     self._class_name = windll.cstring("dw.manygui.PythonWindow")
     self.__wndproc = gencb.generated_callback('llll',self._wndproc)
     # register a window class for our windows.
     wc = WNDCLASS()
     wc.hbrBackground = COLOR_BTNFACE + 1
     wc.hCursor = user32.LoadCursor(0, IDC_ARROW)
     wc.hIcon = user32.LoadIcon(0, IDI_APPLICATION)
     wc.lpzClassName = self._class_name.address()
     wc.lpfnWndProc = self.__wndproc.address
     wc.hInst = kernel32.GetModuleHandle(0)
     self._wc = wc
     user32.UnregisterClass(wc.lpzClassName,0)
     self.__class__._wndclass = user32.RegisterClass(wc)
     assert self.__class__._wndclass, "RegisterClass --> %d=%s ie\n%s" % (GetLastError(), hex(GetLastError()), _lastErrorMessage())
     if _verbose: log('Application._register_class:end',str(self))