I have a small program which uses a DLL library, I was able to make the .EXE file run while in the IDE but it does not work outside it.
Are the EXE and DLL located in the same folder?
If not the EXE will not find the DLL.
Even better question ...What exactly is it (not) doing?
If you clicking it in Windows Explorer and there's nothing to ask for input from the user, it's entirely possible it executs and closes so fast you don't see it.
Post your code... lets see what we can do...
Yes the DLL and the ESE files are in the same directory.
When runnnig the EXE file it ends with an error message "An unhandled win32 exception ocurred in Monitor.exe"
The program is based on a Petzold example and I'm using it to read the CPU temperature through a library (Susi.dll and Susi.lib, the define file is called "REL_SUSI.h") distributed by the board manufacturer.
I am able to read and display the temperature when running the EXE file inside the IDE.
Here is the code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include "REL_SUSI.h"
int CDECL MessageBoxPrintf (TCHAR * szCaption, TCHAR * szFormat, ...)
{
TCHAR szBuffer [1024] ;
va_list pArgList ;
// The va_start macro (defined in STDARG.H) is usually equivalent to:
// pArgList = (char *) &szFormat + sizeof (szFormat) ;
va_start (pArgList, szFormat) ;
// The last argument to wvsprintf points to the arguments
_vsntprintf (szBuffer, sizeof (szBuffer) / sizeof (TCHAR),
szFormat, pArgList) ;
// The va_end macro just zeroes out pArgList for no good reason
va_end (pArgList) ;
return MessageBox (NULL, szBuffer, szCaption, 0) ;
}
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
int cputemp, cyScreen ;
float* dos;
if (SusiDllInit())
{
SusiHWMGetTemperature(1,dos);
}
cputemp= *dos;
MessageBoxPrintf (TEXT ("CPU temperature"),
TEXT ("The CPU temperature is %i degrees C"),
cputemp, cyScreen) ;
return 0 ;
}
I think your problem is the use of a pointer to float.
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
int cputemp, cyScreen ;
float dos;
if (SusiDllInit())
{
SusiHWMGetTemperature(1,&dos);
}
cputemp= (int)dos;
MessageBoxPrintf (TEXT ("CPU temperature"),
TEXT ("The CPU temperature is %i degrees C"),
cputemp, cyScreen) ;
return 0 ;
}
Try it with the changes above.
Thanks a lot Stefan it did work. I had also another mistake with an extra parameter after cputemp at the last text.