Error calling a service
Posted: Tue Aug 25, 2020 3:00 am
Hi fivewinners
I posted this same question on the spanish forum.
I have a service running in a PC, in order to comunicate with it I call a bat file from within mi app.
Like this WAITRUN("DO.BAT",0)
Do.bat contains this
reply.exe "archivo.txt" "nolog" "url:127.0.0.1">>exito.txt
It receives an info in "archivo,txt", process it, then answers in "exito.txt" and prints a ticket in LPT1
If I call the .bat file directly works with no problem, but if I call it from inside my app with waitrun() or Shellexecute() does everything but printing.
So I did a simple program in Pelles C to probe it.
#include <stdio.h>
#include <windows.h>
#include <shellapi.h>
int main()
{
#define WIN32_DEFAULT_LIBS
static char *cmdstr="do.bat";
ShellExecute(NULL,"open",cmdstr,NULL,NULL,SW_HIDE);
return 0;
}
.. and it works with no problem....
If I call the .bat file from cmd, works fine and prints in LPT1
If I execute the Pelles C program, works fine and prints in LPT1
If I call the .bat file from inside my FWH app, works fine BUT DOES NOT PRINT
I'm getting frustrated, there's no explanation (to me) why it acts differently.
Any help will be appreciated
From Chile
Adolfo
I posted this same question on the spanish forum.
I have a service running in a PC, in order to comunicate with it I call a bat file from within mi app.
Like this WAITRUN("DO.BAT",0)
Do.bat contains this
reply.exe "archivo.txt" "nolog" "url:127.0.0.1">>exito.txt
It receives an info in "archivo,txt", process it, then answers in "exito.txt" and prints a ticket in LPT1
If I call the .bat file directly works with no problem, but if I call it from inside my app with waitrun() or Shellexecute() does everything but printing.
So I did a simple program in Pelles C to probe it.
#include <stdio.h>
#include <windows.h>
#include <shellapi.h>
int main()
{
#define WIN32_DEFAULT_LIBS
static char *cmdstr="do.bat";
ShellExecute(NULL,"open",cmdstr,NULL,NULL,SW_HIDE);
return 0;
}
.. and it works with no problem....
If I call the .bat file from cmd, works fine and prints in LPT1
If I execute the Pelles C program, works fine and prints in LPT1
If I call the .bat file from inside my FWH app, works fine BUT DOES NOT PRINT
I'm getting frustrated, there's no explanation (to me) why it acts differently.
Any help will be appreciated
From Chile
Adolfo