PDA

View Full Version : Simply DLL


ras78
09 May 2007, 06:54
Hello guys,
I'm trying to crate a simply dll for my scenery. With this dll I should be able to set values for usrvr5 and therefore, condition my objects.
Basically I read an offset and set value for another one (without checking its value for the moment). Here's my code:

#include <windows.h>
#include <stdlib.h>
#include "FSUIPC_User.h"


BOOL APIENTRY DllMain (HINSTANCE hInst,
DWORD result,
DWORD size,
LPVOID reserved)
{
int visibility[5];

//test code
if (FSUIPC_Open(SIM_FS2K4, &result))
{
FSUIPC_Read(0x238, 3, visibility, &result)
FSUIPC_Write(0x0DDE, 1, &size, &result);
FSUIPC_Write(0x8001, 12, "IKB3BI67TCHEtest.dll", &result);
FSUIPC_Process(&result);
}
FSUIPC_Close();
return EXIT_SUCCESS;
}

My DevC++ compiles my dll succesfully, but when I put it into \modules folder, fs does not load it. Anyone know why?
I'm newbie with C Dll, so I don't know how to debug.

thanks

arno
09 May 2007, 15:17
Hi,

I would have to dig up my own DLL code to see the real differences, but one thing I am missing in your code is a sort of timer or loop to make sure this call is done more than once. Now it will probably happen only once.

Also, you will not see much of your DLL being loaded, unless you have coded a menu entry in it as well. So the only way to see if it is running, would be to check if the variables are set correctly.

Paavo
09 May 2007, 15:29
You need import/export tables etc.

See:
http://www.fsdeveloper.com/forum/showpost.php?p=7770&postcount=7