Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. #include "form.h"
  2. #include <iostream>
  3. #include <vector>
  4. #include <iterator>
  5. #include <string>
  6. #include <sstream>
  7. #include <fstream>
  8. #include <stdlib.h>
  9. #include <tchar.h>
  10. #include <algorithm>
  11. #include <Commctrl.h>
  12. #pragma comment(lib, "Comctl32.lib")
  13. using namespace std;
  14. HWND ParentWindow = NULL;
  15. HWND MainWindow = NULL;
  16. WNDCLASSEX nClass;
  17. HMENU WindowMenu = NULL;
  18. HMODULE HInstance = NULL;
  19. HWND InputField = NULL;
  20. HWND ConsoleField = NULL;
  21. HWND hWndComboBox;
  22. HWND SecondWindow = NULL;
  23. HWND ConsoleField2;
  24. BOOL Ressetteminal();
  25. LRESULT CALLBACK DLLWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  26. {
  27. switch (message)
  28. {
  29. case WM_COMMAND:
  30. switch (LOWORD(wParam))
  31. {
  32. case CREDITS:
  33. MessageBox(hwnd, "Credits goes to YOU and https://www.youtube.com/channel/UCduLFy4X1gDj_n1R4VxXkaA", "Credits", MB_OKCANCEL);
  34. break;
  35. case COMMANDS:
  36. HandleCommand("cmds");
  37. break;
  38. case ABOUT:
  39. MessageBox(hwnd, "This is an exploit called Layout Source!", "About", MB_OKCANCEL);
  40. break;
  41. case INPUT_FIELD:
  42. if (HIWORD(wParam) == EN_MAXTEXT) {
  43. char cText[INPUT_CHAR_LIMIT];
  44. SendMessage((HWND)lParam, WM_GETTEXT, INPUT_CHAR_LIMIT, (LPARAM)cText);
  45.  
  46. if (strcmp(cText, "") == 0)
  47. break;
  48.  
  49. SendMessage((HWND)lParam, WM_SETTEXT, NULL, (LPARAM)"");
  50.  
  51. //std::string command = cText;
  52. HandleCommand(cText);
  53. }
  54.  
  55. break;
  56. }
  57. break;
  58. case WM_DESTROY:
  59. ExitThread(0);
  60. break;
  61.  
  62. case WM_QUIT:
  63. ExitThread(0);
  64. break;
  65. default:
  66. return DefWindowProc(hwnd, message, wParam, lParam);
  67. }
  68. return 0;
  69. }
  70.  
  71. BOOL RegisterWindowClass(const char* wClassName) {
  72.  
  73. nClass.cbSize = sizeof(WNDCLASSEX);
  74. nClass.style = CS_DBLCLKS;
  75. nClass.lpfnWndProc = DLLWindowProc;
  76. nClass.cbClsExtra = 0;
  77. nClass.cbWndExtra = 0;
  78. nClass.hInstance = GetModuleHandle(NULL);
  79. nClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  80. nClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  81. nClass.hCursor = LoadCursor(NULL, IDC_ARROW);
  82. nClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
  83. nClass.lpszMenuName = "what";
  84. nClass.lpszClassName = wClassName;
  85.  
  86. if (!RegisterClassEx(&nClass))
  87. return 0;
  88.  
  89. return 1;
  90. }
  91.  
  92. BOOL Ressetteminal() {
  93. //HINSTANCE hInstance = GetModuleHandle(NULL);
  94. DestroyWindow(ConsoleField2);
  95. ConsoleField2 = CreateWindowEx(NULL, "EDIT", "", WS_CHILD | WS_BORDER | WS_VSCROLL | ES_MULTILINE | WS_VISIBLE | ES_READONLY | ES_AUTOVSCROLL, 10, 20, 520, 375, SecondWindow, (HMENU)CONSOLE_WINDOW, HInstance, 0);
  96. UpdateWindow(MainWindow);
  97.  
  98. return 1;
  99. }
  100.  
  101. BOOL CreateSubwindows() {
  102. //HINSTANCE hInstance = GetModuleHandle(NULL);
  103. ConsoleField = CreateWindowEx(NULL, "EDIT", "", WS_CHILD | WS_BORDER | WS_VSCROLL | ES_MULTILINE | WS_VISIBLE | ES_READONLY | ES_AUTOVSCROLL, 10, 20, 520, 375, MainWindow, (HMENU)CONSOLE_WINDOW, HInstance, 0);
  104. HWND consoleFieldLabel = CreateWindowEx(NULL, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 0, 100, 20, MainWindow, NULL, HInstance, NULL);
  105. InputField = CreateWindowEx(NULL, "EDIT", "", WS_CHILD | WS_BORDER | ES_MULTILINE | WS_VISIBLE, 10, 425, 500, 20, MainWindow, (HMENU)INPUT_FIELD, HInstance, 0);
  106. HWND inputFieldLabel = CreateWindowEx(NULL, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 400, 60, 20, MainWindow, NULL, HInstance, NULL);
  107. SendMessage(inputFieldLabel, WM_SETTEXT, NULL, (LPARAM)"Input");
  108. SendMessage(consoleFieldLabel, WM_SETTEXT, NULL, (LPARAM)"Console");
  109. SendMessage(InputField, EM_SETLIMITTEXT, INPUT_CHAR_LIMIT, NULL);
  110.  
  111. //WaypointBox = CreateWindowEx(NULL, "LISTBOX", "", WS_CHILD | WS_BORDER | WS_VSCROLL | WS_VISIBLE, 10, 280, 520, 100, MainWindow, (HMENU)ALX_WAYPOINT_BOX, HInstance, 0);
  112. //SendMessage(WaypointBox, LVM_SETITEMTEXT, )
  113.  
  114. HFONT textFont = CreateFont(18, 0, 0, 0, FW_LIGHT, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH, TEXT("Segoe UI"));
  115.  
  116. SendMessage(inputFieldLabel, WM_SETFONT, (WPARAM)textFont, MAKELPARAM(TRUE, 0));
  117. SendMessage(consoleFieldLabel, WM_SETFONT, (WPARAM)textFont, MAKELPARAM(TRUE, 0));
  118. SendMessage(ConsoleField, WM_SETFONT, (WPARAM)textFont, MAKELPARAM(TRUE, 0));
  119. SendMessage(InputField, WM_SETFONT, (WPARAM)textFont, MAKELPARAM(TRUE, 0));
  120.  
  121. UpdateWindow(MainWindow);
  122.  
  123. return 1;
  124. }
  125. BOOL CreateWindowMenu() {
  126. WindowMenu = CreateMenu();
  127. if (!WindowMenu)
  128. return 0;
  129.  
  130. HMENU mainDropdown = CreatePopupMenu();
  131. AppendMenu(mainDropdown, MF_STRING, CREDITS, "Credits");
  132. AppendMenu(mainDropdown, MF_STRING, ABOUT, "About");
  133. AppendMenu(mainDropdown, MF_STRING, COMMANDS, "Commands");
  134.  
  135. AppendMenu(WindowMenu, MF_POPUP, (UINT_PTR)mainDropdown, "Layout Source");
  136.  
  137. return 1;
  138. }
  139. BOOL StartMessageLoop() {
  140. MSG msg;
  141. BOOL bRet;
  142.  
  143. while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
  144. {
  145. if (bRet == 0) {
  146. return 0;
  147. }
  148. else if (bRet == -1)
  149. {
  150. // handle the error and possibly exit
  151. //return msg.wParam;
  152. return 0;
  153. }
  154. else
  155. {
  156. TranslateMessage(&msg);
  157. DispatchMessage(&msg);
  158. }
  159. }
  160. }
  161.  
  162. BOOL InitiateWindow() {
  163. HInstance = GetModuleHandle(NULL);
  164.  
  165. UnregisterClass("WINDOW", HInstance);
  166. RegisterWindowClass("WINDOW");
  167.  
  168. char Name[50];
  169.  
  170. _snprintf_s(Name, 50, "Layout Source");
  171.  
  172. if (!CreateWindowMenu())
  173. return 0;
  174. if (!(MainWindow = CreateWindowEx(NULL, "WINDOW", Name, WS_SYSMENU | WS_MINIMIZEBOX, 100, 100, 560, 500, NULL, WindowMenu, HInstance, NULL))) return 0;
  175. CreateSubwindows();
  176. ::SetWindowPos(MainWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE);
  177. ShowWindow(MainWindow, SW_SHOWNORMAL);
  178. UpdateWindow(MainWindow);
  179. main();
  180. return StartMessageLoop();
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement