Advertisement
Guest User

Untitled

a guest
Jun 9th, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 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.  
  72. CreateWindow(TEXT("button"), TEXT("Bami's Cinder"),
  73. WS_VISIBLE | WS_CHILD,
  74. 175*9+1, 40*0+5, 175, 40,
  75. hwnd, (HMENU)10, NULL, NULL);
  76. break;
  77. }
  78.  
  79. case WM_COMMAND:
  80. {
  81. if (LOWORD(wParam) == 1) {
  82. myfile << "3001:Buy,";
  83. }
  84.  
  85. if (LOWORD(wParam) == 2) {
  86. myfile << "3105:Buy,";
  87. }
  88. if (LOWORD(wParam) == 177) {
  89. 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);
  90. }
  91.  
  92. if (LOWORD(wParam) == 178) {
  93. ifstream fileIn( "ChampionName-SummonersRift.txt");
  94. string contents;
  95. fileIn >> contents;
  96. fileIn.close();
  97. contents.pop_back();
  98. ofstream fileOut( "ChampionName-SummonersRift.txt", ios::trunc );
  99. fileOut << contents;
  100. fileOut.close();
  101. PostQuitMessage(0);
  102. break;
  103. }
  104.  
  105. if (LOWORD(wParam) == 183) {
  106. Beep(432, 500);
  107. }
  108.  
  109. if (LOWORD(wParam) == 184) {
  110. string getcontent;
  111. const char * c = getcontent.c_str();
  112. ifstream openfile ("ChampionName-SummonersRift.txt");
  113. if(openfile.is_open())
  114. {
  115. while(! openfile.eof())
  116. {
  117. openfile >> getcontent;
  118.  
  119. MessageBox(hwnd, getcontent.c_str(), "NONE", MB_OK | MB_ICONINFORMATION);
  120. }
  121. }
  122. }
  123.  
  124. break;
  125. }
  126. case WM_DESTROY:
  127. {
  128. ifstream fileIn( "ChampionName-SummonersRift.txt");
  129. string contents;
  130. fileIn >> contents;
  131. fileIn.close();
  132. contents.pop_back();
  133. ofstream fileOut( "ChampionName-SummonersRift.txt", ios::trunc );
  134. fileOut << contents;
  135. fileOut.close();
  136. PostQuitMessage(0);
  137. break;
  138. }
  139. }
  140. return DefWindowProc(hwnd, msg, wParam, lParam);
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement