Groups > Superbase > Superbase 2 programming > Re: ShellExecute




ShellExecute

ShellExecute
Mon, 26 Mar 2007 14:09:31 -040
I cross-posted because although, I use SBV2 a test on SBCLASSIC gave me 
an odd error.

I use something like this IN SBV2 to open .pdf files among other things

SUB main()
  runcmd$ = "I:\MyImages\A1234567.pdf"
  CALL OpenShell(runcmd$)
  END SUB


SUB OpenShell(runcmd$)
  REGISTER CLEAR
  runmode%% = 1
  REGISTER "Shell","ShellExecute","JJCCCCI"
  retval#% = CALL
("ShellExecute",0,"open",runcmd$,"","",3
)
  REGISTER CLEAR
  END SUB

But it has been giving me errors since Acrobat Reader 7.0. (An acrobat 
error) so I've been using Acrobat Reader 6.0.  However starting with 
6.05 or 6.06, I get error.  I switched for a bit to Foxit but I don't 
like certain aspects of that.

So figuring that the problem had something to do with 16/32 bit issues.

I tried the above code in the demo of SBClassic, and it works totally fine.

But then I thought, well with SBCLASSIC I really should be about to make 
a call to the 32bit version of Shell.

So I tried this:


SUB main()
  runcmd$ = "I:\IMAGES\A1234567.pdf"
  CALL OpenShell(runcmd$)
  END SUB


SUB OpenShell(runcmd$)
  REGISTER CLEAR
  runmode%% = 1
  REGISTER "Shell32","ShellExecuteA","JJCCCCI"
  retval#% = CALL
("ShellExecuteA",0,"open",runcmd$,"","",
3)
  REGISTER CLEAR
  END SUB


It works BUT, I get Superbase dialog saying it can't find "Shell32"
and 
then just goes on its merry way and works.  Why?

OK, while typing this I tried one more thing, being explicit with the path.

REGISTER
"C:\WINNT\SYSTEM32\Shell32","ShellExecuteA","JJCCCCI&qu
ot;

No more error.  But why the "can't find dialog" and but still working
in 
the first shell32 example?

JDK

PS, I've also discovered that using DDE avoids the problem altogether

SUB DDEExample(runcmd$)
  REM const char * DDE_CMD_STRING =
"[FileOpenEx(\"c:\\test.pdf\")]";
  REM const char * ACRO_DDESERVER = "acroview";
  REM const char * ACRO_DDETOPIC = "control";
  DDETERM 1
  DDEINIT 1,"acroview","control"
  message$ = "[FileOpen(" + CHR$ (34) +
"I:\IMAGES\A38131.pdf" + CHR$ 
(34) + ")]"
  DDEEXEC 1,message$
  DDETERM 1
Post Reply
Re: ShellExecute
Mon, 26 Mar 2007 18:28:51 -050
John,

Are you familiar with the gswin32 stuff, that prints to pdf with a ghostscript
driver (I think)?

I have this running just fine, though I have not checked Acrobat versions
lately.

There is a LOT of code!

Digging around, I have gs851w32.exe and blat.dll and a lot of routines people
have posted. I concocted something that converts a Superbase form to PDF
somehow, using some or all of it. There is a .bat file created in the process.
It's very convoluted, but works like a charm every time.

For the moment, all I can say is, no DDE, I think it uses:

  ' For printing a file directly use the following API-Code (ShellExecute):
  ' This will open, print and close the file!
FUNCTION APIShellPrint%(printme$,reg%%)
  IF reg%% THEN
     REGISTER CLEAR
     REGISTER
"shell32.dll","ShellExecuteA","JJFFFFJ" AS
"ShellExecute"
  END IF
  DIM b%%,c%%,a$,c$,d$
  b%% = Superbase.Handle
  a$ = "Print"
  c$ = ""
  d$ = ""
  c%% = 1
  APIShellPrint% = CALL ("ShellExecute",b%%,a$,printme$,c$,d$,c%%)
  IF reg%% THEN REGISTER CLEAR
  END FUNCTION

I will do more digging and chop out some hunks of the relevant code if you need
it. It's all mixed up with an email attachment/PDF generator routines of some
sort. The form-to-pdf part is what I needed.

Peter



On Mon, 26 Mar 2007 13:09:31 -0500, Kromkowski <kromkowski@verizon.net>
wrote:

> I cross-posted because although, I use SBV2 a test on SBCLASSIC gave me
> an odd error.
>
> I use something like this IN SBV2 to open .pdf files among other things
>
> SUB main()
>   runcmd$ = "I:\MyImages\A1234567.pdf"
>   CALL OpenShell(runcmd$)
>   END SUB
>
>
> SUB OpenShell(runcmd$)
>   REGISTER CLEAR
>   runmode%% = 1
>   REGISTER "Shell","ShellExecute","JJCCCCI"
>   retval#% = CALL
("ShellExecute",0,"open",runcmd$,"","",3
)
>   REGISTER CLEAR
>   END SUB
>
> But it has been giving me errors since Acrobat Reader 7.0. (An acrobat
> error) so I've been using Acrobat Reader 6.0.  However starting with
> 6.05 or 6.06, I get error.  I switched for a bit to Foxit but I don't
> like certain aspects of that.
>
> So figuring that the problem had something to do with 16/32 bit issues.
>
> I tried the above code in the demo of SBClassic, and it works totally
fine.
>
> But then I thought, well with SBCLASSIC I really should be about to make
> a call to the 32bit version of Shell.
>
> So I tried this:
>
>
> SUB main()
>   runcmd$ = "I:\IMAGES\A1234567.pdf"
>   CALL OpenShell(runcmd$)
>   END SUB
>
>
> SUB OpenShell(runcmd$)
>   REGISTER CLEAR
>   runmode%% = 1
>   REGISTER
"Shell32","ShellExecuteA","JJCCCCI"
>   retval#% = CALL
("ShellExecuteA",0,"open",runcmd$,"","",
3)
>   REGISTER CLEAR
>   END SUB
>
>
> It works BUT, I get Superbase dialog saying it can't find
"Shell32" and
> then just goes on its merry way and works.  Why?
>
> OK, while typing this I tried one more thing, being explicit with the
path.
>
> REGISTER
"C:\WINNT\SYSTEM32\Shell32","ShellExecuteA","JJCCCCI&qu
ot;
>
> No more error.  But why the "can't find dialog" and but still
working in
> the first shell32 example?
>
> JDK
>
> PS, I've also discovered that using DDE avoids the problem altogether
>
> SUB DDEExample(runcmd$)
>   REM const char * DDE_CMD_STRING =
"[FileOpenEx(\"c:\\test.pdf\")]";
>   REM const char * ACRO_DDESERVER = "acroview";
>   REM const char * ACRO_DDETOPIC = "control";
>   DDETERM 1
>   DDEINIT 1,"acroview","control"
>   message$ = "[FileOpen(" + CHR$ (34) +
"I:\IMAGES\A38131.pdf" + CHR$
> (34) + ")]"
>   DDEEXEC 1,message$
>   DDETERM 1
>   END SUB
>
Post Reply
Re: ShellExecute
Mon, 26 Mar 2007 23:10:13 +010
Kromkowski wrote:
> SUB OpenShell(runcmd$)
>  REGISTER CLEAR
>  runmode%% = 1
>  REGISTER
"Shell32","ShellExecuteA","JJCCCCI"
>  retval#% = CALL
("ShellExecuteA",0,"open",runcmd$,"","",
3)
>  REGISTER CLEAR
>  END SUB
> 
> 
> It works BUT, I get Superbase dialog saying it can't find
"Shell32" and
> then just goes on its merry way and works.  Why?

make sure that you add the .dll to shell32 in the register command. This
is something specific to NT-based operating systems.

Post Reply
Re: ShellExecute
Tue, 27 Mar 2007 16:06:58 -040
At one point I did something with that, and certainly I've looked at it 
over the years.

But long ago, I just ended up investing in PDF995 (which as the name 
implies is $9.95, less per unit for multiple licenses.) And I just print 
to PDF995 which gets install as the printer I can set.  Makes everything 
very simple, nothing convoluted at all about it.

Of course, scanners have now integrated that also. So creating the PDFs 
has always been less a problem (although not much) than keeping track of 
them and opening the documents from Superbase.  I've had an integrated 
image thing since 1994, when the document flavor of choice was a .tif, 
but in the past 5 to 10 years, I converted to almost an exclusive .pdf 
system.

This is how I created PDF version of my land value maps from Superbase.

And WP X3 (still the choice of word processing for attorneys) has been 
pretty closely integrated with Acrobat.

The Acrobat SDK is free for downloading and is pretty well documented.

By the way, they note: "Some developers have developed the capability of 
generating PDF from their own applications without using Adobe products. 
Some of these developers have used the Adobe PDF Library product to 
extend their own application. Others have built PDF-generation 
capability into their applications from scratch. This type of 
development is not supported by Adobe."

I think technically, the ShellPrint is actually DDE via Windows rather 
than via the application itself.

JDK


Peter Barus wrote:
> John,
> 
> Are you familiar with the gswin32 stuff, that prints to pdf with a
ghostscript driver (I think)?
> 
> I have this running just fine, though I have not checked Acrobat versions
lately.
> 
> There is a LOT of code!
> 
> Digging around, I have gs851w32.exe and blat.dll and a lot of routines
people have posted. I concocted something that converts a Superbase form to PDF
somehow, using some or all of it. There is a .bat file created in the process.
It's very convoluted, but works like a charm every time.
> 
> For the moment, all I can say is, no DDE, I think it uses:
> 
>   ' For printing a file directly use the following API-Code
(ShellExecute):
>   ' This will open, print and close the file!
> FUNCTION APIShellPrint%(printme$,reg%%)
>   IF reg%% THEN
>      REGISTER CLEAR
>      REGISTER
"shell32.dll","ShellExecuteA","JJFFFFJ" AS
"ShellExecute"
>   END IF
>   DIM b%%,c%%,a$,c$,d$
>   b%% = Superbase.Handle
>   a$ = "Print"
>   c$ = ""
>   d$ = ""
>   c%% = 1
>   APIShellPrint% = CALL
("ShellExecute",b%%,a$,printme$,c$,d$,c%%)
>   IF reg%% THEN REGISTER CLEAR
>   END FUNCTION
> 
> I will do more digging and chop out some hunks of the relevant code if you
need it. It's all mixed up with an email attachment/PDF generator routines of
some sort. The form-to-pdf part is what I needed.
> 
> Peter
> 
> 
> 
> On Mon, 26 Mar 2007 13:09:31 -0500, Kromkowski
<kromkowski@verizon.net> wrote:
> 
>> I cross-posted because although, I use SBV2 a test on SBCLASSIC gave
me
>> an odd error.
>>
>> I use something like this IN SBV2 to open .pdf files among other
things
>>
>> SUB main()
>>   runcmd$ = "I:\MyImages\A1234567.pdf"
>>   CALL OpenShell(runcmd$)
>>   END SUB
>>
>>
>> SUB OpenShell(runcmd$)
>>   REGISTER CLEAR
>>   runmode%% = 1
>>   REGISTER
"Shell","ShellExecute","JJCCCCI"
>>   retval#% = CALL
("ShellExecute",0,"open",runcmd$,"","",3
)
>>   REGISTER CLEAR
>>   END SUB
>>
>> But it has been giving me errors since Acrobat Reader 7.0. (An acrobat
>> error) so I've been using Acrobat Reader 6.0.  However starting with
>> 6.05 or 6.06, I get error.  I switched for a bit to Foxit but I don't
>> like certain aspects of that.
>>
>> So figuring that the problem had something to do with 16/32 bit
issues.
>>
>> I tried the above code in the demo of SBClassic, and it works totally
fine.
>>
>> But then I thought, well with SBCLASSIC I really should be about to
make
>> a call to the 32bit version of Shell.
>>
>> So I tried this:
>>
>>
>> SUB main()
>>   runcmd$ = "I:\IMAGES\A1234567.pdf"
>>   CALL OpenShell(runcmd$)
>>   END SUB
>>
>>
>> SUB OpenShell(runcmd$)
>>   REGISTER CLEAR
>>   runmode%% = 1
>>   REGISTER
"Shell32","ShellExecuteA","JJCCCCI"
>>   retval#% = CALL
("ShellExecuteA",0,"open",runcmd$,"","",
3)
>>   REGISTER CLEAR
>>   END SUB
>>
>>
>> It works BUT, I get Superbase dialog saying it can't find
"Shell32" and
>> then just goes on its merry way and works.  Why?
>>
>> OK, while typing this I tried one more thing, being explicit with the
path.
>>
>> REGISTER
"C:\WINNT\SYSTEM32\Shell32","ShellExecuteA","JJCCCCI&qu
ot;
>>
>> No more error.  But why the "can't find dialog" and but still
working in
>> the first shell32 example?
>>
>> JDK
>>
>> PS, I've also discovered that using DDE avoids the problem altogether
>>
>> SUB DDEExample(runcmd$)
>>   REM const char * DDE_CMD_STRING =
"[FileOpenEx(\"c:\\test.pdf\")]";
>>   REM const char * ACRO_DDESERVER = "acroview";
>>   REM const char * ACRO_DDETOPIC = "control";
>>   DDETERM 1
>>   DDEINIT 1,"acroview","control"
>>   message$ = "[FileOpen(" + CHR$ (34) +
"I:\IMAGES\A38131.pdf" + CHR$
>> (34) + ")]"
>>   DDEEXEC 1,message$
>>   DDETERM 1
>>   END SUB
>>
Post Reply
Re: ShellExecute
Wed, 28 Mar 2007 09:05:51 -050
Since I sell my licenses to customers I tend to like free stuff when it comes to
PDF drivers and whatnot.




On Tue, 27 Mar 2007 15:06:58 -0500, Kromkowski <kromkowski@verizon.net>
wrote:

> At one point I did something with that, and certainly I've looked at it
> over the years.
>
> But long ago, I just ended up investing in PDF995 (which as the name
> implies is $9.95, less per unit for multiple licenses.) And I just print
> to PDF995 which gets install as the printer I can set.  Makes everything
> very simple, nothing convoluted at all about it.
>
> Of course, scanners have now integrated that also. So creating the PDFs
> has always been less a problem (although not much) than keeping track of
> them and opening the documents from Superbase.  I've had an integrated
> image thing since 1994, when the document flavor of choice was a .tif,
> but in the past 5 to 10 years, I converted to almost an exclusive .pdf
> system.
>
> This is how I created PDF version of my land value maps from Superbase.
>
> And WP X3 (still the choice of word processing for attorneys) has been
> pretty closely integrated with Acrobat.
>
> The Acrobat SDK is free for downloading and is pretty well documented.
>
> By the way, they note: "Some developers have developed the capability
of
> generating PDF from their own applications without using Adobe products.
> Some of these developers have used the Adobe PDF Library product to
> extend their own application. Others have built PDF-generation
> capability into their applications from scratch. This type of
> development is not supported by Adobe."
>
> I think technically, the ShellPrint is actually DDE via Windows rather
> than via the application itself.
>
> JDK
>
>
> Peter Barus wrote:
>> John,
>>
>> Are you familiar with the gswin32 stuff, that prints to pdf with a
ghostscript driver (I think)?
>>
>> I have this running just fine, though I have not checked Acrobat
versions lately.
>>
>> There is a LOT of code!
>>
>> Digging around, I have gs851w32.exe and blat.dll and a lot of routines
people have posted. I concocted something that converts a Superbase form to PDF
somehow, using some or all of it. There is a .bat file created in the process.
It's very convoluted, but works like a charm every time.
>>
>> For the moment, all I can say is, no DDE, I think it uses:
>>
>>   ' For printing a file directly use the following API-Code
(ShellExecute):
>>   ' This will open, print and close the file!
>> FUNCTION APIShellPrint%(printme$,reg%%)
>>   IF reg%% THEN
>>      REGISTER CLEAR
>>      REGISTER
"shell32.dll","ShellExecuteA","JJFFFFJ" AS
"ShellExecute"
>>   END IF
>>   DIM b%%,c%%,a$,c$,d$
>>   b%% = Superbase.Handle
>>   a$ = "Print"
>>   c$ = ""
>>   d$ = ""
>>   c%% = 1
>>   APIShellPrint% = CALL
("ShellExecute",b%%,a$,printme$,c$,d$,c%%)
>>   IF reg%% THEN REGISTER CLEAR
>>   END FUNCTION
>>
>> I will do more digging and chop out some hunks of the relevant code if
you need it. It's all mixed up with an email attachment/PDF generator routines
of some sort. The form-to-pdf part is what I needed.
>>
>> Peter
>>
>>
>>
>> On Mon, 26 Mar 2007 13:09:31 -0500, Kromkowski
<kromkowski@verizon.net> wrote:
>>
>>> I cross-posted because although, I use SBV2 a test on SBCLASSIC
gave me
>>> an odd error.
>>>
>>> I use something like this IN SBV2 to open .pdf files among other
things
>>>
>>> SUB main()
>>>   runcmd$ = "I:\MyImages\A1234567.pdf"
>>>   CALL OpenShell(runcmd$)
>>>   END SUB
>>>
>>>
>>> SUB OpenShell(runcmd$)
>>>   REGISTER CLEAR
>>>   runmode%% = 1
>>>   REGISTER
"Shell","ShellExecute","JJCCCCI"
>>>   retval#% = CALL
("ShellExecute",0,"open",runcmd$,"","",3
)
>>>   REGISTER CLEAR
>>>   END SUB
>>>
>>> But it has been giving me errors since Acrobat Reader 7.0. (An
acrobat
>>> error) so I've been using Acrobat Reader 6.0.  However starting
with
>>> 6.05 or 6.06, I get error.  I switched for a bit to Foxit but I
don't
>>> like certain aspects of that.
>>>
>>> So figuring that the problem had something to do with 16/32 bit
issues.
>>>
>>> I tried the above code in the demo of SBClassic, and it works
totally fine.
>>>
>>> But then I thought, well with SBCLASSIC I really should be about to
make
>>> a call to the 32bit version of Shell.
>>>
>>> So I tried this:
>>>
>>>
>>> SUB main()
>>>   runcmd$ = "I:\IMAGES\A1234567.pdf"
>>>   CALL OpenShell(runcmd$)
>>>   END SUB
>>>
>>>
>>> SUB OpenShell(runcmd$)
>>>   REGISTER CLEAR
>>>   runmode%% = 1
>>>   REGISTER
"Shell32","ShellExecuteA","JJCCCCI"
>>>   retval#% = CALL
("ShellExecuteA",0,"open",runcmd$,"","",
3)
>>>   REGISTER CLEAR
>>>   END SUB
>>>
>>>
>>> It works BUT, I get Superbase dialog saying it can't find
"Shell32" and
>>> then just goes on its merry way and works.  Why?
>>>
>>> OK, while typing this I tried one more thing, being explicit with
the path.
>>>
>>> REGISTER
"C:\WINNT\SYSTEM32\Shell32","ShellExecuteA","JJCCCCI&qu
ot;
>>>
>>> No more error.  But why the "can't find dialog" and but
still working in
>>> the first shell32 example?
>>>
>>> JDK
>>>
>>> PS, I've also discovered that using DDE avoids the problem
altogether
>>>
>>> SUB DDEExample(runcmd$)
>>>   REM const char * DDE_CMD_STRING =
"[FileOpenEx(\"c:\\test.pdf\")]";
>>>   REM const char * ACRO_DDESERVER = "acroview";
>>>   REM const char * ACRO_DDETOPIC = "control";
>>>   DDETERM 1
>>>   DDEINIT 1,"acroview","control"
>>>   message$ = "[FileOpen(" + CHR$ (34) +
"I:\IMAGES\A38131.pdf" + CHR$
>>> (34) + ")]"
>>>   DDEEXEC 1,message$
>>>   DDETERM 1
>>>   END SUB
>>>
>>
>
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact