Error calling a service

Error calling a service

Postby Adolfo » 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
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Error calling a service

Postby mauri.menabue » Tue Aug 25, 2020 7:13 am

Hi
Try : WinExec( cCmdLine )
User avatar
mauri.menabue
 
Posts: 146
Joined: Thu Apr 17, 2008 2:38 pm

Re: Error calling a service

Postby puenteda » Tue Aug 25, 2020 1:16 pm

Hi,

I also use winexec without problems:

WINEXEC(cPtch+"\recibe.bat",1)

Regards
Daniel Puente
Argentina
puenteda
 
Posts: 24
Joined: Thu Oct 02, 2014 3:51 am

Re: Error calling a service

Postby Adolfo » Tue Aug 25, 2020 2:05 pm

None of...

WaitRun()
WinExec()
ShellExecute()

They do everything but printing in LPT1, BUT if I call the .bat from command line, it does
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Error calling a service

Postby mauri.menabue » Tue Aug 25, 2020 2:40 pm

hi
Try : SET PRINTER TO cDummyFile.txt
bye
User avatar
mauri.menabue
 
Posts: 146
Joined: Thu Apr 17, 2008 2:38 pm

Re: Error calling a service

Postby Adolfo » Tue Aug 25, 2020 3:01 pm

mauri.menabue wrote:hi
Try : SET PRINTER TO cDummyFile.txt
bye


Hi.. can't control it... the service is in charge on printing, not my APP
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Error calling a service

Postby karinha » Tue Aug 25, 2020 4:49 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7244
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error calling a service

Postby Adolfo » Tue Aug 25, 2020 9:51 pm

;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 22 guests