Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. #include<iostream>
  2. #include<Windows.h>
  3. #include"stdafx.h"
  4. #include<ctime>
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. int main() {
  14.  
  15. void *backgroundChosen = NULL;
  16. srand((unsigned int)time(0));
  17. int randomNum = 1 + (rand() % 21);
  18.  
  19. switch (randomNum)
  20. {
  21. case 1:
  22. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\1.jpg";
  23. break;
  24. case 2:
  25. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\2.jpg";
  26. break;
  27. case 3:
  28. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\3.jpg";
  29. break;
  30. case 4:
  31. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\4.jpg";
  32. break;
  33. case 5:
  34. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\5.jpg";
  35. break;
  36. case 6:
  37. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\6.jpg";
  38. break;
  39. case 7:
  40. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\7.jpg";
  41. break;
  42. case 8:
  43. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\8.jpg";
  44. break;
  45. case 9:
  46. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\9.jpg";
  47. break;
  48. case 10:
  49. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\10.jpg";
  50. break;
  51. case 11:
  52. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\11.jpg";
  53. break;
  54. case 12:
  55. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\12.jpg";
  56. break;
  57. case 13:
  58. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\13.jpg";
  59. break;
  60. case 14:
  61. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\14.jpg";
  62. break;
  63. case 15:
  64. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\15.jpg";
  65. break;
  66. case 16:
  67. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\16.jpg";
  68. break;
  69. case 17:
  70. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\17.jpg";
  71. break;
  72. case 18:
  73. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\18.jpg";
  74. break;
  75. case 19:
  76. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\19.jpg";
  77. break;
  78. case 20:
  79. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\20.jpg";
  80. break;
  81. case 21:
  82. backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\21.jpg";
  83. break;
  84. }
  85.  
  86. // Change Desktop Background
  87. int return_value = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, backgroundChosen, SPIF_UPDATEINIFILE);
  88. }
  89.  
  90.  
  91.  
  92. void backgroundGen()
  93. {
  94. int y;
  95. int x;
  96. cout << "Enter the number you want the to Start Generating At: ";
  97. cin >> x;
  98. cout << "Enter the number you want the Generator to stop Generating At: ";
  99. cin >> y;
  100. for (int x; x <= y; x++)
  101. {
  102. cout << "case " << x << ":" << endl << "backgroundChosen = \"C:\\Users\\Matthew\\Desktop\\Backgrounds\\\"" << x << ".jpg" << endl << "break;" << endl << endl;
  103. }
  104. cin.get();
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement