Fuzz Grandmaster Cheater
Reputation: 0
Joined: 12 Nov 2006 Posts: 531
|
Posted: Sat Sep 06, 2008 9:29 am Post subject: [c++] Program wont open... |
|
|
#include <windows.h>
#include "stdafx.h"
#define IDC_BUTTON_hButton 43
DWORD myval;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static char gszClassName[] = "db Tutorial";
static HINSTANCE ghInstance = NULL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX WndClass;
HWND hwnd;
MSG Msg;
ghInstance = hInstance;
WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = NULL;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = ghInstance;
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = gszClassName;
WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&WndClass)) {
MessageBox(0, "Error Registering Window!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}
hwnd = CreateWindowEx(
WS_EX_STATICEDGE,
gszClassName,
"FBiT",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
320, 240,
NULL, NULL,
ghInstance,
NULL);
if(hwnd == NULL) {
MessageBox(0, "Window Creation Failed!", "OH SHIT-", MB_ICONSTOP | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
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) {
HWND hButton, hStatic;
switch(Message) {
case WM_CREATE:
hButton = CreateWindowEx(
NULL,
"Button",
"Button Example",
WS_BORDER | WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0,
110, 30,
hwnd, (HMENU)IDC_BUTTON_hButton,
ghInstance,
NULL);
//hCombo = CreateWindowEx(
// NULL,
// "ComboBox",
// "darkblue",
// WS_BORDER | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
// 0, 30,
//100, 100,
//hwnd, NULL,
//ghInstance,
//NULL);
// hEdit = CreateWindowEx(
// NULL,
// "Edit",
// "edit box example",
// WS_BORDER | WS_CHILD | WS_VISIBLE,
// 0, 60,
// 100, 30,
// hwnd, NULL,
// ghInstance,
// NULL);
// / hList = CreateWindowEx(
// NULL,
/// "ListBox",
// "db db db",
// WS_BORDER | WS_CHILD | WS_VISIBLE,
// 100, 0,
/// 100, 200,
// hwnd, NULL,
/// ghInstance,
// NULL);
// hScroll = CreateWindowEx(
// NULL,
// "ScrollBar",
// "",
hStatic = CreateWindowEx(
NULL,
"Static",
"hi",
WS_CHILD | WS_VISIBLE,
0, 31,
100, 30,
hwnd, NULL,
ghInstance,
NULL);
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BUTTON_hButton:
{
// MessageBox(hwnd, "hi", "hi", MB_OK);
}
break;
}
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
int poke_window(char wname[50], DWORD addr, BYTE newbyte[12],int nbyte)
{
HWND Wnd=0;
LPDWORD PID;
DWORD Proc=0;
HANDLE Hproc;
DWORD MWritte;
Wnd = FindWindow(NULL, wname); // see if it exist
if ( Wnd )
{
Proc = GetWindowThreadProcessId(Wnd,(LPDWORD) &PID); //get a PROCESS number
if (Proc)
{
Hproc= OpenProcess(PROCESS_ALL_ACCESS,NULL,(DWORD)PID);
if(Hproc)
WriteProcessMemory (Hproc, (LPVOID)addr, newbyte, nbyte,&MWritte);
}
}
return(0);
}
int poke_read(char wname[50], DWORD addr, BYTE newbyte[12],int nbyte)
{
HWND Wnd=0;
LPDWORD PID;
DWORD Proc=0;
HANDLE Hproc;
Wnd = FindWindow(NULL, wname); // see if it exist
if ( Wnd )
{
Proc = GetWindowThreadProcessId(Wnd,(LPDWORD) &PID); //get a PROCESS number
if (Proc)
{
Hproc= OpenProcess(PROCESS_ALL_ACCESS,NULL,(DWORD)PID);
if(Hproc)
ReadProcessMemory (Hproc, (LPVOID)addr, &myval, nbyte, NULL);
}
}
return(0);
}
No errors. Why does it fail to open?[/b]
_________________
|
|