Advertisement
Guest User

Help

a guest
Jun 5th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <fstream>
  4. using namespace std;
  5. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  6. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  7. LPSTR lpCmdLine, int nCmdShow)
  8.  
  9.  
  10.  
  11. {
  12. MSG msg;
  13. WNDCLASS wc = { 0 };
  14. wc.lpszClassName = TEXT("Buttons");
  15. wc.hInstance = hInstance;
  16. wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  17. wc.lpfnWndProc = WndProc;
  18. wc.hCursor = LoadCursor(0, IDC_ARROW);
  19.  
  20.  
  21. RegisterClass(&wc);
  22. CreateWindow(wc.lpszClassName, TEXT("AutoBuddyBuildMaker GUI by n0thing17"),
  23. WS_OVERLAPPEDWINDOW | WS_VISIBLE,
  24. 0, 0, 1920, 1080, 0, 0, hInstance, 0);
  25.  
  26. while (GetMessage(&msg, NULL, 0, 0)) {
  27. TranslateMessage(&msg);
  28. DispatchMessage(&msg);
  29. }
  30. return (int)msg.wParam;
  31. }
  32.  
  33. LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  34. {
  35. ofstream myfile;
  36. myfile.open("ChampionName-SummonersRift.txt", fstream::app);
  37.  
  38. switch (msg)
  39. {
  40. case WM_CREATE:
  41. {
  42. CreateWindow(TEXT("button"), TEXT("Abyssal Scepter"),
  43. WS_VISIBLE | WS_CHILD,
  44. 10, 50*0+5, 175, 50,
  45. hwnd, (HMENU)1, NULL, NULL);
  46.  
  47. CreateWindow(TEXT("button"), TEXT("Aegis of the Legion"),
  48. WS_VISIBLE | WS_CHILD,
  49. 175*1+15*1+10, 50*0+5, 175, 50,
  50. hwnd, (HMENU)2, NULL, NULL);
  51.  
  52. CreateWindow(TEXT("button"), TEXT("AutoBuddyBuildMakerGui made by n0thing17"),
  53. WS_VISIBLE | WS_CHILD,
  54. 175*6+15*6+10, 50*17+90, 525, 50,
  55. hwnd, (HMENU)3, NULL, NULL);
  56.  
  57. CreateWindow(TEXT("button"), TEXT("QUIT"),
  58. WS_VISIBLE | WS_CHILD,
  59. 175*9+15*9+10, 50*17+90, 175, 50,
  60. hwnd, (HMENU)4, NULL, NULL);
  61. break;
  62. }
  63.  
  64. case WM_COMMAND:
  65. {
  66. if (LOWORD(wParam) == 1) {
  67. myfile << "3001:Buy,";
  68. }
  69.  
  70. if (LOWORD(wParam) == 2) {
  71. myfile << "3105:Buy,";
  72. }
  73.  
  74. if (LOWORD(wParam) == 3) {
  75. MessageBox(hwnd, " This program is made by n0thing17. A simple \"Multumesc\"(Thank you) will make him happy", " Once Exiled, Forever Exiled", MB_OK | MB_ICONINFORMATION);
  76. }
  77.  
  78. if (LOWORD(wParam) == 4) {
  79. ifstream fileIn( "ChampionName-SummonersRift.txt");
  80. string contents;
  81. fileIn >> contents;
  82. fileIn.close();
  83. contents.pop_back();
  84. ofstream fileOut( "ChampionName-SummonersRift.txt", ios::trunc );
  85. fileOut << contents;
  86. fileOut.close();
  87. PostQuitMessage(0);
  88. break;
  89. }
  90.  
  91. break;
  92. }
  93. case WM_DESTROY:
  94. {
  95. ifstream fileIn( "ChampionName-SummonersRift.txt");
  96. string contents;
  97. fileIn >> contents;
  98. fileIn.close();
  99. contents.pop_back();
  100. ofstream fileOut( "ChampionName-SummonersRift.txt", ios::trunc );
  101. fileOut << contents;
  102. fileOut.close();
  103. PostQuitMessage(0);
  104. break;
  105. }
  106. }
  107. return DefWindowProc(hwnd, msg, wParam, lParam);
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement