Error Link2019



  • #include <iostream>
    #include "windows.h"
    #include <windows.h>
    #include <d3d9.h>
    #include <iostream>
    #include <d3dx9.h>
    #include <Dwmapi.h> 
    #include <TlHelp32.h>
    #include <D3dx9core.h>
    
    #pragma comment (lib, "d3dx9.lib")
    #pragma comment (lib, "d3d9.lib")
    #pragma comment (lib, "d3dx9")
    #pragma comment (lib, "Dwmapi.lib")
    
    using namespace std;
    ////////////////////////////////////
    /*Offsets*/
    ////////////////////////////////////
    DWORD pid;
    HWND hwnd;
    DWORD Clientshell;
    DWORD Health = 0x0074E4B4;
    int Health1;
    DWORD PosY = 0x0CD076F8;
    float PosY1;
    DWORD PosX = 0x0CD076F4;
    float PosX1;
    DWORD PosZ = 0x0CD076F0;
    float PosZ1;
    ////////////////////////////////////
    ////////////////////////////////////
    /*Overlay*/
    ////////////////////////////////////
    int s_width = 800;
    int s_height = 600;
    #define CENTERX (GetSystemMetrics(SM_CXSCREEN)/2)-(s_width/2)
    #define CENTERY (GetSystemMetrics(SM_CYSCREEN)/2)-(s_height/2)
    LPDIRECT3D9 d3d;    // the pointer to our Direct3D interface
    LPDIRECT3DDEVICE9 d3ddev;
    HWND hWnd;
    const MARGINS  margin = { 0,0,s_width,s_height };
    LPD3DXFONT pFont;
    
    LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
    void initD3D(HWND hWnd)
    {
    	d3d = Direct3DCreate9(D3D_SDK_VERSION);    // create the Direct3D interface
    
    	D3DPRESENT_PARAMETERS d3dpp;    // create a struct to hold various device information
    
    	ZeroMemory(&d3dpp, sizeof(d3dpp));    // clear out the struct for use
    	d3dpp.Windowed = TRUE;    // program windowed, not fullscreen
    	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;    // discard old frames
    	d3dpp.hDeviceWindow = hWnd;    // set the window to be used by Direct3D
    	d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;     // set the back buffer format to 32-bit
    	d3dpp.BackBufferWidth = s_width;    // set the width of the buffer
    	d3dpp.BackBufferHeight = s_height;    // set the height of the buffer
    
    	d3dpp.EnableAutoDepthStencil = TRUE;
    	d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
    
    	// create a device class using this information and the info from the d3dpp stuct
    	d3d->CreateDevice(D3DADAPTER_DEFAULT,
    		D3DDEVTYPE_HAL,
    		hWnd,
    		D3DCREATE_SOFTWARE_VERTEXPROCESSING,
    		&d3dpp,
    		&d3ddev);
    
    	D3DXCreateFont(d3ddev, 50, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &pFont);
    
    }
    
    void DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt)
    {
    	RECT FontPos = { x, y, x + 120, y + 16 };
    	char buf[1024] = { '\0' };
    	va_list va_alist;
    
    	va_start(va_alist, fmt);
    	vsprintf_s(buf, fmt, va_alist);
    	va_end(va_alist);
    	g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
    }
    
    void render()
    {
    	// clear the window alpha
    	d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0);
    
    	d3ddev->BeginScene();    // begins the 3D scene
    
    	DrawString(10, 50, D3DCOLOR_ARGB(255, 255, 0, 0), pFont, "CHEAT");
    
    	d3ddev->EndScene();    // ends the 3D scene
    
    	d3ddev->Present(NULL, NULL, NULL, NULL);   // displays the created frame on the screen
    }
    
    char* ReadINI(char* szSection, char* szKey, const char* szDefaultValue)
    {
    	char* szResult = new char[255];
    	memset(szResult, 0x00, 255);
    	GetPrivateProfileString(szSection, szKey,
    		szDefaultValue, szResult, 255, ".\\conf.ini");
    	return szResult;
    }
    
    int WINAPI WinMain(HINSTANCE hInstance,
    	HINSTANCE hPrevInstance,
    	LPSTR lpCmdLine,
    	int nCmdShow)
    {
    	char * value = ReadINI("CONFIGURATION", "WIN_NAME", "none");
    
    	RECT rc;
    
    	HWND newhwnd = FindWindow(NULL, value);
    	if (newhwnd != NULL) {
    		GetWindowRect(newhwnd, &rc);
    		s_width = rc.right - rc.left;
    		s_height = rc.bottom - rc.top;
    	}
    	else {
    		ExitProcess(0);
    	}
    	WNDCLASSEX wc;
    
    	ZeroMemory(&wc, sizeof(WNDCLASSEX));
    
    	wc.cbSize = sizeof(WNDCLASSEX);
    	wc.style = CS_HREDRAW | CS_VREDRAW;
    	wc.lpfnWndProc = WindowProc;
    	wc.hInstance = hInstance;
    	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    	wc.hbrBackground = (HBRUSH)RGB(0, 0, 0);
    	wc.lpszClassName = "WindowClass";
    
    	RegisterClassEx(&wc);
    
    	hWnd = CreateWindowEx(0,
    		"WindowClass",
    		"",
    		WS_EX_TOPMOST | WS_POPUP,
    		rc.left, rc.top,
    		s_width, s_height,
    		NULL,
    		NULL,
    		hInstance,
    		NULL);
    
    	SetWindowLong(hWnd, GWL_EXSTYLE, (int)GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TRANSPARENT);
    	SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 0, ULW_COLORKEY);
    	SetLayeredWindowAttributes(hWnd, 0, 255, LWA_ALPHA);
    
    	ShowWindow(hWnd, nCmdShow);
    
    	initD3D(hWnd);
    	MSG msg;
    	::SetWindowPos(FindWindow(NULL, value), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    	while (TRUE)
    	{
    		::SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    
    		if (!FindWindow(NULL, value))
    			ExitProcess(0);
    		render();
    		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    		{
    			TranslateMessage(&msg);
    			DispatchMessage(&msg);
    		}
    
    		if (msg.message == WM_QUIT)
    			exit(0);
    
    	}
    
    	return msg.wParam;
    }
    
    LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	switch (message)
    	{
    	case WM_PAINT:
    	{
    		DwmExtendFrameIntoClientArea(hWnd, &margin);
    	}break;
    
    	case WM_DESTROY:
    	{
    		PostQuitMessage(0);
    		return 0;
    	} break;
    	}
    
    	return DefWindowProc(hWnd, message, wParam, lParam);
    }
    
    int main()
    {
    	SetConsoleTitle("cheat");
    	cout << "Please Open Cod4x." << endl;
    
    	while (1)
    	{
    		hwnd = FindWindow(NULL, "Call of Duty 4 X");
    			if (!hwnd)
    			{
    
    				continue;
    			}
    			else
    			{
    				break;
    			}
    	}
    	system("cls");
    	GetWindowThreadProcessId(hwnd, &pid);
    	HANDLE phandle = OpenProcess(PROCESS_VM_READ, 0, pid);
    	Clientshell = (DWORD)GetModuleHandle("client.dll");
    	while (1)
    	{
    		cout << "hi" << endl;
    		cout << "new" << endl;
    
    		ReadProcessMemory(phandle, (void*)Health, &Health1, sizeof(Health1), 0);
    		cout << "Health:" << Health1 << endl;
    		ReadProcessMemory(phandle, (void*)PosY, &PosY1, sizeof(PosY1), 0);
    
    		system("cls");
    		Sleep(10);
    	}
    	getchar();
    
    }
    

    I get this error (error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_Direct3DCreate9@4" in Funktion ""void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z)".)
    (error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_D3DXCreateFontA@48" in Funktion ""void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z)".)
    (warning LNK4272: Bibliothekcomputertyp "x64" steht in Konflikt mit dem Zielcomputertyp "X86")

    Pls help me
    Ps. its for learning


  • Mod

    Alex2202 schrieb:

    warning LNK4272: Bibliothekcomputertyp "x64" steht in Konflikt mit dem Zielcomputertyp "X86"



  • Ich habe es jetzt umgestellt auf x64
    aber nun kommen folgende fehler
    error C2704: "DrawString": Systeminterne __va_start nur in variabler Argumentliste zulässig
    warning C4244: "return": Konvertierung von "WPARAM" in "int", möglicher Datenverlust
    warning C4311: "Typumwandlung": Zeigerverkürzung von "HMODULE" zu "DWORD"
    warning C4302: "Typumwandlung": Verkürzung von "HMODULE" in "DWORD"
    warning C4312: "Typumwandlung": Konvertierung von "DWORD" in größeren Typ "void *"
    warning C4312: "Typumwandlung": Konvertierung von "DWORD" in größeren Typ "void *"



  • Schonmal nen C++-Buch in die Hand genommen und gelesen?



  • Habs jetzt in C++ Primer gefunden . Nur nicht diesen Fehler (error C2704: "DrawString": Systeminterne __va_start nur in variabler Argumentliste zulässig)
    Finde im internet aber nicht die lösung



  • Sagt der Fehler doch: du hast eine feste Argumentliste, willst aber variabel viele Argumente verarbeiten. Das geht nicht, weil du zum Verarbeiten variabel vieler Argumente eben auch eine variable Argumentliste brauchst.

    Siehe z.B. http://www.cplusplus.com/reference/cstdarg/va_start/
    Beachte besonders die ...



  • Alex2202 schrieb:

    Habs jetzt in C++ Primer gefunden . Nur nicht diesen Fehler (error C2704: "DrawString": Systeminterne __va_start nur in variabler Argumentliste zulässig)
    Finde im internet aber nicht die lösung

    https://stackoverflow.com/questions/19326612/meaning-of-compilation-error-error-c2704-va-start-intrinsic-only-allowed-in

    Siehe akzeptierte Antwort.

    Ferner empfiehlt es sich, VS auf Englisch umzustellen: Auch wenn die Übersetzung recht gut ist, wird man nur selten etwas zu den deutschen
    Fehlermeldungen in Suchmaschinen finden. Dazu ist Englisch in der Programmierwelt zu sehr verbreitet. Ich kenne wirklich niemanden, der
    Projektmappen erstellt und Vorlagenargumente zwischen spitze Klammern schreibt, wenn er C++ programmiert.


Anmelden zum Antworten