Advertisement
Guest User

WindowedKodp

a guest
Jun 19th, 2014
629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. import os
  2. import sys
  3. import time
  4. import win32gui
  5. from win32con import *
  6.  
  7. # Adjust this path for your installation
  8. kodppath = r"S:\Program Files\King of Dragon Pass\Launch King of Dragon Pass.lnk"
  9.  
  10. def ecwCallback(hwnd, extra):
  11.     if win32gui.GetClassName(hwnd) == "AfxFrameOrView40s":
  12.         win32gui.MoveWindow(hwnd, 0, 0, 640, 480, 1)
  13.     return 1
  14.  
  15. def toWindow(hwnd):
  16.     # Fix Window Title
  17.     win32gui.SetWindowText(hwnd, r"King of Dragon Pass")
  18.     # Remove pointless menu
  19.     win32gui.SetMenu(hwnd, None)
  20.     # Add window decoration
  21.     style = win32gui.GetWindowLong(hwnd, GWL_STYLE)
  22.     win32gui.SetWindowLong(hwnd, GWL_STYLE, style | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
  23.     win32gui.SetWindowPos(hwnd, HWND_TOP,
  24.            16, 12, 652, 514,
  25.                    SWP_NOOWNERZORDER | SWP_FRAMECHANGED)
  26.     # Find the innermost window which actually draws the game
  27.     win32gui.EnumChildWindows(hwnd, ecwCallback, 0)
  28.  
  29. os.startfile(kodppath)
  30. for dummy in range(30):
  31.   hwnd = win32gui.FindWindow(None, r"mTropolis Windows Player - mPlayer")
  32.   if hwnd !=0:
  33.     toWindow(hwnd)
  34.     break
  35.   time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement