(className string, wndProcPtr uintptr, style uint32)
| 476 | } |
| 477 | |
| 478 | func MustRegisterWindowClassWithWndProcPtrAndStyle(className string, wndProcPtr uintptr, style uint32) { |
| 479 | if registeredWindowClasses[className] { |
| 480 | panic("window class already registered") |
| 481 | } |
| 482 | |
| 483 | hInst := win.GetModuleHandle(nil) |
| 484 | if hInst == 0 { |
| 485 | panic("GetModuleHandle") |
| 486 | } |
| 487 | |
| 488 | hIcon := win.LoadIcon(hInst, win.MAKEINTRESOURCE(7)) // rsrc uses 7 for app icon |
| 489 | if hIcon == 0 { |
| 490 | hIcon = win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_APPLICATION)) |
| 491 | } |
| 492 | if hIcon == 0 { |
| 493 | panic("LoadIcon") |
| 494 | } |
| 495 | |
| 496 | hCursor := win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_ARROW)) |
| 497 | if hCursor == 0 { |
| 498 | panic("LoadCursor") |
| 499 | } |
| 500 | |
| 501 | var wc win.WNDCLASSEX |
| 502 | wc.CbSize = uint32(unsafe.Sizeof(wc)) |
| 503 | wc.LpfnWndProc = wndProcPtr |
| 504 | wc.HInstance = hInst |
| 505 | wc.HIcon = hIcon |
| 506 | wc.HCursor = hCursor |
| 507 | wc.HbrBackground = win.COLOR_BTNFACE + 1 |
| 508 | wc.LpszClassName = syscall.StringToUTF16Ptr(className) |
| 509 | wc.Style = style |
| 510 | |
| 511 | if atom := win.RegisterClassEx(&wc); atom == 0 { |
| 512 | panic("RegisterClassEx") |
| 513 | } |
| 514 | |
| 515 | registeredWindowClasses[className] = true |
| 516 | } |
| 517 | |
| 518 | var initedWalk uint32 |
| 519 | var walkInit []func() |
no outgoing calls
no test coverage detected
searching dependent graphs…