MCPcopy Create free account
hub / github.com/WheretIB/nullc / InitInstance

Function InitInstance

SuperCalc.cpp:681–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679}
680
681bool InitInstance(HINSTANCE hInstance, int nCmdShow)
682{
683 hInst = hInstance; // Store instance handle in our global variable
684
685 hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, 100, 100, 900, 450, NULL, NULL, hInstance, NULL);
686 if(!hWnd)
687 return 0;
688 ShowWindow(hWnd, nCmdShow);
689 UpdateWindow(hWnd);
690
691 PAINTSTRUCT ps;
692 HDC hdc = BeginPaint(hWnd, &ps);
693 fontMonospace = CreateFont(-9 * GetDeviceCaps(hdc, LOGPIXELSY) / 72, 0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Courier New");
694 fontDefault = CreateFont(-10 * GetDeviceCaps(hdc, LOGPIXELSY) / 72, 0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Arial");
695 EndPaint(hWnd, &ps);
696
697 hButtonCalc = CreateWindow("BUTTON", "Run", WS_VISIBLE | WS_CHILD, 5, 185, 100, 30, hWnd, NULL, hInstance, NULL);
698 if(!hButtonCalc)
699 return 0;
700 SendMessage(hButtonCalc, WM_SETFONT, (WPARAM)fontDefault, 0);
701
702 hContinue = CreateWindow("BUTTON", "Continue", WS_CHILD, 110, 185, 100, 30, hWnd, NULL, hInstance, NULL);
703 if(!hContinue)
704 return 0;
705 SendMessage(hContinue, WM_SETFONT, (WPARAM)fontDefault, 0);
706
707 hJITEnabled = CreateWindow("BUTTON", "X86 JIT", WS_VISIBLE | BS_AUTOCHECKBOX | WS_CHILD, 800-140, 185, 130, 30, hWnd, NULL, hInstance, NULL);
708 if(!hJITEnabled)
709 return 0;
710 SendMessage(hJITEnabled, WM_SETFONT, (WPARAM)fontDefault, 0);
711
712 INITCOMMONCONTROLSEX commControlTypes;
713 commControlTypes.dwSize = sizeof(INITCOMMONCONTROLSEX);
714 commControlTypes.dwICC = ICC_TREEVIEW_CLASSES | ICC_LISTVIEW_CLASSES;
715 int commControlsAvailable = InitCommonControlsEx(&commControlTypes);
716 if(!commControlsAvailable)
717 return 0;
718
719 hStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "Ready", hWnd, 0);
720
721 TabbedFiles::RegisterTabbedFiles("NULLCTABS", hInstance);
722 RichTextarea::RegisterTextarea("NULLCTEXT", hInstance);
723
724 colorer = new Colorer();
725
726 hTabs = CreateWindow("NULLCTABS", "tabs", WS_VISIBLE | WS_CHILD, 5, 4, 800, 20, hWnd, 0, hInstance, 0);
727 if(!hTabs)
728 return 0;
729
730 hAttachTabs = CreateWindow("NULLCTABS", "tabs", WS_CHILD, 5, 4, 800, 20, hWnd, 0, hInstance, 0);
731 if(!hAttachTabs)
732 return 0;
733
734 hDebugTabs = CreateWindow("NULLCTABS", "tabs", WS_VISIBLE | WS_CHILD, 5, 225, 800, 20, hWnd, 0, hInstance, 0);
735 if(!hDebugTabs)
736 return 0;
737
738 // Load tab information

Callers 1

WinMainFunction · 0.85

Calls 7

AddTabWithFileFunction · 0.85
strchrFunction · 0.85
assertFunction · 0.85
strcmpFunction · 0.85
emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected