Source code of the entire window application and source code of the entire window Application

Source: Internet
Author: User

Source code of the entire window application and source code of the entire window Application

For ease of viewing, all source code is put together as follows:

# Windows application from ctypes import * from ctypes. wintypes import * WNDPROCTYPE = WINFUNCTYPE (c_int, HWND, c_uint, WPARAM, LPARAM) WS_EX_APPWINDOW = ceiling = 0xcf1_ws_caption = ceiling = 1SW_SHOW = ceiling = 1CW_USEDEFAULT = ceiling = 2WHITE_BRUSH = 0 # Name of the window class wclassName = u'shenzhencai 'wname = u 'Hello world '# define the window class Structure class WNDCLASSEX (Structure ): _ Fields _ = [("cbSize", c_uint), ("style", c_uint), ("lpfnWndProc", WNDPROCTYPE), ("cbClsExtra", c_int ), ("cbWndExtra", c_int), ("hInstance", HANDLE), ("hIcon", HANDLE), ("hCursor", HANDLE), ("hBrush", HANDLE ), ("lpszMenuName", LPCWSTR), ("lpszClassName", LPCWSTR), ("hIconSm", HANDLE)] # window message processing callback function def PyWndProc (hWnd, Msg, wParam, lParam): if Msg = WM_DESTROY: windll. user32.PostQuitMessage (0) els E: return windll. user32.DefWindowProcW (hWnd, Msg, wParam, lParam) return 0 # initialize the main window def initwinclass (hInst, WndProc): wndClass = WNDCLASSEX () wndClass. cbSize = sizeof (WNDCLASSEX) wndClass. style = CS_HREDRAW | CS_VREDRAW wndClass. lpfnWndProc = WndProc wndClass. cbClsExtra = 0 wndClass. cbWndExtra = 0 wndClass. hInstance = hInst wndClass. hIcon = 0 wndClass. hCursor = 0 wndClass. hBrush = windll. gdi32.GetS TockObject (WHITE_BRUSH) wndClass. lpszMenuName = 0 wndClass. lpszClassName = wclassName wndClass. hIconSm = 0 return windll. user32.RegisterClassExW (byref (wndClass) # main Function entry def main (): hInst = windll. kernel32.GetModuleHandleW (None) WndProc = WNDPROCTYPE (PyWndProc) if initwinclass (hInst, WndProc) <= 0: return False hWnd = windll. user32.createappswexw (0, wclassName, wname, WS_OVERLAPPEDWINDOW | WS_CAP TION, CW_USEDEFAULT, CW_USEDEFAULT, 800,600, 0, 0, hInst, 0) if not hWnd: print ('failed' to create window') exit (0) windll. user32.ShowWindow (hWnd, SW_SHOW) windll. user32.UpdateWindow (hWnd) msg = MSG () lpmsg = pointer (msg) print ('entering message loop ') while windll. user32.GetMessageW (lpmsg, 0, 0, 0 )! = 0: windll. user32.TranslateMessage (lpmsg) windll. user32.DispatchMessageW (lpmsg) print ('done. ') if _ name _ = "_ main _": print ("Win32 Application in python") main ()



The webpage clearly shows a user login window. Why didn't I see the code in the whole source code?

Check whether the webpage contains other webpages (such as code include and iframe), or search for "username" or "password retrieval" text in the code of the entire website.

I am using eclipse now. How can I display the console information in the window? Display the running result of the entire code in the window.

You can use JOptionPane. showInputDialog and showMessageDialog
The swing you are using is not used to do this.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.