Advertisement
Guest User

Untitled

a guest
Jun 6th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 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_SYSMENU | WS_VISIBLE | WS_MINIMIZEBOX,
  24. 0, 0, 1766, 780, 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, 40*0+5, 175, 40,
  45. hwnd, (HMENU)1, NULL, NULL);
  46.  
  47. CreateWindow(TEXT("button"), TEXT("Aegis of the Legion"),
  48. WS_VISIBLE | WS_CHILD,
  49. 175*1+9, 40*0+5, 175, 40,
  50. hwnd, (HMENU)2, NULL, NULL);
  51.  
  52. CreateWindow(TEXT("button"), TEXT("AutoBuddyBuildMakerGui made by n0thing17"),
  53. WS_VISIBLE | WS_CHILD,
  54. 175*6+4, 40*17-12, 523, 79,
  55. hwnd, (HMENU)177, NULL, NULL);
  56.  
  57. CreateWindow(TEXT("button"), TEXT("QUIT"),
  58. WS_VISIBLE | WS_CHILD,
  59. 175*9+1, 40*17-12, 175, 79,
  60. hwnd, (HMENU)178, NULL, NULL);
  61.  
  62. CreateWindow(TEXT("button"), TEXT("Beep"),
  63. WS_VISIBLE | WS_CHILD,
  64. 175*4+6, 40*18-13, 175, 40,
  65. hwnd, (HMENU)183, NULL, NULL);
  66.  
  67. CreateWindow(TEXT("button"), TEXT("Show File Content"),
  68. WS_VISIBLE | WS_CHILD,
  69. 175*5+5, 40*18-13, 174, 40,
  70. hwnd, (HMENU)184, NULL, NULL);
  71. break;
  72. }
  73.  
  74. case WM_COMMAND:
  75. {
  76. if (LOWORD(wParam) == 1) {
  77. myfile << "3001:Buy,";
  78. }
  79.  
  80. if (LOWORD(wParam) == 2) {
  81. myfile << "3105:Buy,";
  82. }
  83. if (LOWORD(wParam) == 177) {
  84. 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);
  85. }
  86.  
  87. if (LOWORD(wParam) == 178) {
  88. ifstream fileIn( "ChampionName-SummonersRift.txt");
  89. string contents;
  90. fileIn >> contents;
  91. fileIn.close();
  92. contents.pop_back();
  93. ofstream fileOut( "ChampionName-SummonersRift.txt", ios::trunc );
  94. fileOut << contents;
  95. fileOut.close();
  96. PostQuitMessage(0);
  97. break;
  98. }
  99.  
  100. if (LOWORD(wParam) == 183) {
  101. Beep(432, 500);
  102. }
  103.  
  104. if (LOWORD(wParam) == 184) {
  105. string getcontent;
  106. const char * c = getcontent.c_str();
  107. ifstream openfile ("ChampionName-SummonersRift.txt");
  108. if(openfile.is_open())
  109. {
  110. while(! openfile.eof())
  111. {
  112. openfile >> getcontent;
  113.  
  114. MessageBox(hwnd, getcontent.c_str(), "NONE", MB_OK | MB_ICONINFORMATION);
  115. }
  116. }
  117. }
  118.  
  119. break;
  120. }
  121. case WM_DESTROY:
  122. {
  123. ifstream fileIn( "ChampionName-SummonersRift.txt");
  124. string contents;
  125. fileIn >> contents;
  126. fileIn.close();
  127. contents.pop_back();
  128. ofstream fileOut( "ChampionName-SummonersRift.txt", ios::trunc );
  129. fileOut << contents;
  130. fileOut.close();
  131. PostQuitMessage(0);
  132. break;
  133. }
  134. }
  135. return DefWindowProc(hwnd, msg, wParam, lParam);
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement