FBIagent
Erfahrenes Mitglied
Moin,
so ich bin es mal wieder mit einem kleinen Problem.
Erstmal der Code:
gotoxy.dll ensteht durch folgendes:
main.cpp
Jetzt bekomme ich immer meine kleine Meldung "Error: function!".
libgotoxy.a ist auch gelinkt.
Keine Ahnung warum. Vieleicht könnt ihr mir weiter helfen.
THX im Vorraus
MFG FBIagent
so ich bin es mal wieder mit einem kleinen Problem.
Erstmal der Code:
gotoxy.dll ensteht durch folgendes:
Code:
#include <windows.h>
bool APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
return true;
}
__declspec(dllexport) void gotoxy(short x, short y)
{
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X=x-1;
pos.Y=y-1;
SetConsoleCursorPosition(hCon,pos);
}
main.cpp
Code:
#include <iostream>
#include <windows.h>
typedef void(_stdcall *consolePointerGotoXY)(short x,short y);
//HINSTANCE hDLL;
HMODULE hDLL;
consolePointerGotoXY gotoxy;
int main()
{
hDLL = LoadLibrary("gotoxy.dll");
if(hDLL!=NULL)
{
gotoxy = (consolePointerGotoXY)GetProcAddress(hDLL,"gotoxy");
if(!gotoxy)
{
std::cout << "Error: function!";
FreeLibrary(hDLL);
std::cin.get();
return 1;
}
else
{
gotoxy(10,10);
}
}
else
{
std::cout << "Error: dll!";
std::cin.get();
return 1;
}
system("Pause");
return 0;
}
Jetzt bekomme ich immer meine kleine Meldung "Error: function!".
libgotoxy.a ist auch gelinkt.
Keine Ahnung warum. Vieleicht könnt ihr mir weiter helfen.
THX im Vorraus
MFG FBIagent
Zuletzt bearbeitet: