CodeCrafterCpp
Erfahrenes Mitglied
Ja ich versteh aber nicht wo ich es einbauen soll bzw. was genau bzw. ungefähr passiert.....
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
#include <windows.h>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
using namespace std;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASS wc;
const char szAppName[] = "Windows Buttons";
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = szAppName;
wc.lpszMenuName = NULL;
wc.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wc);
hWnd = CreateWindow( szAppName,
szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
350,
200,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HWND ExitButton;
static HWND Button1;
static HWND Button2;
static HWND Button3;
static HWND Button4;
int result;
switch (message)
{
case WM_CREATE:
{
ExitButton = CreateWindow("button",
"Exit",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 0, 0,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Button1 = CreateWindow( "button",
"1Button",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 0, 0,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Button2 = CreateWindow( "button",
"2Button",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 0, 0,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Button3 = CreateWindow( "button",
"3Button",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 0, 0,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Button4 = CreateWindow( "button",
"4Button",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 0, 0,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
return 0;
}
case WM_SIZE:
{
MoveWindow(ExitButton, 250 , HIWORD(lParam) - 30, 80, 22, TRUE);
MoveWindow(Button1, 20 , 20, 80, 22, TRUE);
MoveWindow(Button2, 120 , 20, 80, 22, TRUE);
MoveWindow(Button3, 20 , 50, 80, 22, TRUE);
MoveWindow(Button4, 120 , 50, 80, 22, TRUE);
return 0;
}
case WM_COMMAND:
{
if (lParam == (LPARAM)ExitButton)
{
if (HIWORD(wParam) == BN_CLICKED)
SendMessage(hWnd, WM_CLOSE, 0, 0);
}
if (lParam == (LPARAM)Button1)
{
if(HIWORD(wParam) == BN_CLICKED)
{
string text;
ifstream file;
file.open("C://Users/Jonas/AppData/Roaming/.minecraft/bin/cash.txt", ios::in);
text = ' ';
getline(file, text);
file.close();
char nametxt[256] = (char*)text.c_str();
char oldname[256] = "C://Users/Jonas/AppData/Roaming/.minecraft/bin/";
strcat(oldname, nametxt);
char newname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft.jar";
result= rename( oldname , newname );
if(!result == 0)
MessageBox(NULL,"Fehler beim Umbennen der Datei!",NULL, MB_OK);
}
}
if (lParam == (LPARAM)Button2)
{
if(HIWORD(wParam) == BN_CLICKED)
{
char oldname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft2.jar";
char newname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft.jar";
result= rename( oldname , newname );
if(!result == 0)
MessageBox(NULL,"Fehler beim Umbennen der Datei!",NULL, MB_OK);
}
}
if (lParam == (LPARAM)Button3)
{
if(HIWORD(wParam) == BN_CLICKED)
{
char oldname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft3.jar";
char newname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft.jar";
result= rename( oldname , newname );
if(!result == 0)
MessageBox(NULL,"Fehler beim Umbennen der Datei!",NULL, MB_OK);
}
}
if (lParam == (LPARAM)Button4)
{
if(HIWORD(wParam) == BN_CLICKED)
{
char oldname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft4.jar";
char newname[] ="C://Users/Jonas/AppData/Roaming/.minecraft/bin/Minecraft.jar";
result= rename( oldname , newname );
if(!result == 0)
MessageBox(NULL,"Fehler beim Umbennen der Datei!",NULL, MB_OK);
}
}
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}