|
You last visited: Today at 14:39
Advertisement
DLL + Gui
Discussion on DLL + Gui within the C/C++ forum part of the Coders Den category.
01/04/2013, 23:11
|
#16
|
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,902
Received Thanks: 25,407
|
Die MFC ist in den Express-Versionen nicht vorhanden. Vielleicht solltest du erstmal abklären, ob der TE die MFC hat, bevor du eine Lösung damit anbietest.
Kleine Dialoge sind auch ganz schnell mit der reinen Win32 API erledigt btw.
|
|
|
01/05/2013, 11:29
|
#17
|
elite*gold: 12
Join Date: Jun 2009
Posts: 2,621
Received Thanks: 1,239
|
Ich verstehe teilweise nur Bahnhof :O
-> Back to topic :
--> Ich verwende jetzt erstmal die Konsole, die sich mit der DLL dann öffnet, darüber ist es ersteinmal
einfacher für mich und ausreichend für meine Anwendungen. Allerdings hätte ich hier mal eine Frage :
Zum Einstieg habe ich mir die Source von xWaffeleisen geholt hier :
Code:
// Coded by xWaffeleisen
// Credits: Eiscremekugel(IlluSsioN) & Disconnect
#include <windows.h>
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <io.h> /* _open_osfhandle */
#include <fcntl.h> /* for _O_TEXT and _O_BINARY */
using namespace std;
DWORD dwKey = 0x0;
DWORD dwDropDelay = 1000;
bool bAutoDrop = false;
DWORD dwDropYangFunc = 0x0;
int iVersion = 0;
void DropYang(int iYang)
{
if (iVersion < 3)
{
__asm
{
MOV ECX,DWORD PTR DS:[0x5F4FC8]
PUSH iYang
PUSH 0
CALL dwDropYangFunc
}
}
else
{
__asm
{
MOV ECX,DWORD PTR DS:[0x5F1CF4]
PUSH iYang
PUSH 0
CALL dwDropYangFunc
}
}
}
/*
MOV ECX,DWORD PTR DS:[5F4FC8]
PUSH EDX
PUSH 0
CALL metin2.0041E020
*/
void Console()
{
int hCrtIn, hCrtOut;
FILE *conIn, *conOut;
AllocConsole();
hCrtIn = _open_osfhandle ((intptr_t) GetStdHandle(STD_INPUT_HANDLE), _O_TEXT);
hCrtOut = _open_osfhandle ((intptr_t) GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
conIn = _fdopen( hCrtIn, "r" );
conOut = _fdopen( hCrtOut, "w" );
*stdin = *conIn;
*stdout = *conOut;
}
void CatchKeystrokes(HWND hWnd)
{
bool KeyIsPressed = false;
while (true)
{
while (dwKey != 0x0)
{
if (GetAsyncKeyState(dwKey) < 0)
{
if (!KeyIsPressed)
{
DropYang(1);
}
KeyIsPressed = true;
}
else
{
KeyIsPressed = false;
}
Sleep(5);
}
Sleep(5);
}
}
void AutoDrop()
{
while (true)
{
while (bAutoDrop)
{
DropYang(1);
Sleep(dwDropDelay);
}
Sleep(5);
}
}
void ConsoleThread()
{
char command[255]={0}; // Char zum Einlesen der Eingaben
SetConsoleTitleA("Metin2 YangDropBot by xWaffeleisen"); // Titel ändern
do
{
system("cls");
printf("Please choose your Metin2 Version\n");
printf("1: Metin2 DE\n");
printf("2: Metin2 US\n");
printf("3: Metin35 PServer\n");
printf("\n> ");
scanf_s("%s%*c",&command); // Lesen der Eingabe
if (strcmp ( command , "1" ) == 0)
{
dwDropYangFunc = 0x0041E020;
iVersion = 1;
}
if (strcmp ( command , "2" ) == 0)
{
dwDropYangFunc = 0x0041E0C0;
iVersion = 2;
}
if (strcmp ( command , "3" ) == 0)
{
dwDropYangFunc = 0x0041DEF0;
iVersion = 3;
}
} while (dwDropYangFunc==0x0);
while (1)
{
system("cls");
printf("Commands: start, stop, setdelay, setkey\n\n");
printf("> ");
scanf_s("%s%*c",&command); // Lesen der Eingabe
if (strcmp ( command , "start" ) == 0)
{
bAutoDrop = true;
}
if (strcmp ( command , "stop" ) == 0)
{
bAutoDrop = false;
}
if (strcmp ( command , "setkey" ) == 0)
{
system("cls");
printf("Please insert a Key (F5-F8)\n\n");
printf("> ");
scanf_s("%s%*c",&command); // Lesen der Eingabe
if (strcmp ( command , "F5" ) == 0)
{
dwKey = 0x74;
}
if (strcmp ( command , "F6" ) == 0)
{
dwKey = 0x75;
}
if (strcmp ( command , "F7" ) == 0)
{
dwKey = 0x76;
}
if (strcmp ( command , "F8" ) == 0)
{
dwKey = 0x77;
}
}
if (strcmp ( command , "setdelay" ) == 0)
{
system("cls");
printf("Please insert a Delay (ms)\n\n");
printf("> ");
scanf_s("%s%*c",&command); // Lesen der Eingabe
dwDropDelay = atoi(command);
}
}
}
int __stdcall DllMain(_In_ void * _HDllHandle, _In_ unsigned _Reason, _In_opt_ void * _Reserved)
{
if(DLL_PROCESS_ATTACH == _Reason)
{
Console();
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ConsoleThread, NULL, 0, NULL);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CatchKeystrokes, NULL, 0, NULL);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AutoDrop, NULL, 0, NULL);
}
return 1;
}
Doch bei die Auswahl zwischen 1, 2 und 3 funktioniert iwie nicht richtig. Mir schein das ganze zwar logisch, das Programm gibt auch keine Fehler aus, jedoch klappt dies nicht in der Anwendung.
[Originalthread :  ]
Mit freundlichen Grüßen,
.Stefan
|
|
|
01/06/2013, 12:56
|
#18
|
elite*gold: 0
Join Date: Dec 2012
Posts: 255
Received Thanks: 110
|
^ Das ist der größte Rotzcode den ich seit langem gesehen habe...
|
|
|
01/06/2013, 17:09
|
#19
|
elite*gold: 0
Join Date: Feb 2009
Posts: 2,715
Received Thanks: 5,305
|
^Wohl kaum, dann siehst du einfach zuwenig Codes....
Und es liegt daran das die Adressen der eigentlichen Gameengine Funktionen nicht uptodate sind. "12-12-2009, 19:59"
|
|
|
01/06/2013, 17:19
|
#20
|
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,902
Received Thanks: 25,407
|
^Doch.
Quote:
Originally Posted by .Stefan
Code:
void DropYang(int iYang)
{
}
void CatchKeystrokes(HWND hWnd)
{
}
void AutoDrop()
{
}
void ConsoleThread()
{
}
[...]
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ConsoleThread, NULL, 0, NULL);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CatchKeystrokes, NULL, 0, NULL);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AutoDrop, NULL, 0, NULL);
|
Der Programmierer, der das in die Welt gesetzt hat, gehört geschlagen.
Vom ganzen unnötigen Inline-ASM mal ganz zu schweigen.
|
|
|
01/06/2013, 19:12
|
#21
|
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
|
Quote:
Originally Posted by .Stefan
[...]
Zum Einstieg habe ich mir die Source von xWaffeleisen geholt hier :
[...]
Doch bei die Auswahl zwischen 1, 2 und 3 funktioniert iwie nicht richtig. Mir schein das ganze zwar logisch, das Programm gibt auch keine Fehler aus, jedoch klappt dies nicht in der Anwendung.
[...]
|
Dann solltest du dir eher ein  zum Einstieg holen, als
irgendeinen schlecht programmierten Hack.
Quote:
|
Originally Posted by SandMann016
^Wohl kaum, dann siehst du einfach zuwenig Codes....
|
... Ist auch besser so, wenn man nur wenig davon sieht.
|
|
|
01/11/2013, 18:00
|
#22
|
elite*gold: 12
Join Date: Jun 2009
Posts: 2,621
Received Thanks: 1,239
|
Ich habe meinen Hack für Mt2 in C++ fertig, aber trotzdem danke für die Hilfe
|
|
|
All times are GMT +1. The time now is 14:39.
|
|