Solved

VB6, IIS4 (on NT4 SP4), and ShellExecute

Posted on 2000-04-20
104
1,949 Views
Last Modified: 2008-03-03
I've been using ShellExecute successfully for years on 95/98/NT systems to open/print Adobe Acrobat PDFs w/ the user's default prog. w/ NO problems.

I'm writing a VB6 prog., running on NT4 SP4 w/ IIS4, that lets visitors to our Website fax the PDF forms to a fax # they enter on an HTML form. I do this in my stand-alone progs. w/:

lngResult = ShellExecute(GetDesktopWindow(),"Print",strFile,0&,0&,vbMinimized)

Where:
GetDesktopWindow():the hWnd of the Desktop.
strFile: Full path to file.

Everything is submitted to the prog. PERFECTLY, but the ShellExecute function returns "2" which according to the Win32 API means, "File not found." If I hard-code the path to the file into the function, compile the function into an EXE, and then double-click on it while sitting at the server, it works FINE!

This HAS to be a security issue. Any ideas?

Take all the points you want up to 1000. This has been driving me nuts, and I've lost an entire work day to this @#$&!
0
Comment
Question by:ngjc
  • 42
  • 24
  • 22
  • +5
104 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2736933
0
 

Author Comment

by:ngjc
ID: 2736940
Edited text of question.
0
 

Author Comment

by:ngjc
ID: 2736952
Thanks. You posted the reply right before I changed the "NT4 SP2" in the question to "NT4 SP4"

I thought of that, and made SURE that in the properties for file type PDF, the long path was quoted so it reads:

"C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe"

Again, my code works fine if I put the function, and its dependencies, into a stand-alone EXE, and execute it FROM the server via double-clicking on it.

Thanks, though!
0
 
LVL 1

Expert Comment

by:prakashbitra
ID: 2736970
assign strFile with                     app.path & "\file1.Ext"
0
 

Author Comment

by:ngjc
ID: 2737005
Thanks. You posted the reply right before I changed the "NT4 SP2" in the question to "NT4 SP4"

I thought of that, and made SURE that in the properties for file type PDF, the long path was quoted so it reads:

"C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe"

Again, my code works fine if I put the function, and its dependencies, into a stand-alone EXE, and execute it FROM the server via double-clicking on it.

Thanks, though!
0
 

Author Comment

by:ngjc
ID: 2737020
The problem is not that the file is not found.

The file DOES exist, proven with the fact that the Dir(strFile) function I inserted above the ShellExecute function, returns the filename, as expected.

If instead of calling the EXE in my HTML form with:
<form name="Form" method="post" action="http://myserver.com/scripts/myprog/myprog.exe">

I literally code strFile to the same value as submitted by the form and double-click on the EXE while sitting AT the NT server, it works!

I'm actually looking at the debug code sent to my browser now, which shows the valid filename, including path, but the ShellExecute statement, when run via "CGI" request, takes a dump, and returns SE_ERROR_FNF.

I really hope I've explained it thoroughly enough :)
0
 

Author Comment

by:ngjc
ID: 2737049
The problem is not that the file is not found.

The file DOES exist, proven with the fact that the Dir(strFile) function I inserted above the ShellExecute function, returns the filename, as expected.

If instead of calling the EXE in my HTML form with:
<form name="Form" method="post" action="http://myserver.com/scripts/myprog/myprog.exe">

I literally code strFile to the same value as submitted by the form and double-click on the EXE while sitting AT the NT server, it works!

I'm actually looking at the debug code sent to my browser now, which shows the valid filename, including path, but the ShellExecute statement, when run via "CGI" request, takes a dump, and returns SE_ERROR_FNF.

I really hope I've explained it thoroughly enough :)
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2737060
just one more piece of clarification for me...the users access this page via the net and fill out this form.  the program is on the server which calls this shellexecute method and it sends all the correct data but returns the error value.  this occurs only when the users execute the program from their computer but all is well when it is executed directly from the server.  is this correct?
0
 
LVL 27

Expert Comment

by:Ark
ID: 2737083
Hi
Just a comment - VB IDE is "very clever" with string convertion and do this as it likes. Try
strFile = StrConv(strFile, vbUnicode)
Cheers
0
 

Author Comment

by:ngjc
ID: 2737090
Ding ding ding!!!

Exactly!
0
 

Author Comment

by:ngjc
ID: 2737117
That Ding ding ding!!! incidentally, was for AzraSound's appraisal of the situation.

I'm still hurting.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2737126
so you are using shellexecuteex in conjunction with the shellexecute?  perhaps you can post the applicable area of the code here.  declarations, error-handling, etc...
0
 

Author Comment

by:ngjc
ID: 2737140
No, I'm just using ShellExecute.

The code I posted in the initial question is what is failing (plus the added StrConv from the suggestion by Ark):

lngResult = ShellExecute(GetDesktopWindow(),"Print",StrConv(strFile,vbUnicode),0&,0&,vbMinimized)

The debug I get back when lngResult is < 32 is:

"Error Processing Request

File Exists: True
Local Path: C:\INSAPP\PROGRA~1\TERMMA~1\FORMS\AGLUR.PDF
ShellExecute returned: 2
Status: 200 OK Content-type: text/html"

Where:
File Exists = Dir(strFile) > Empty
Local Path = strFile
ShellExecute returned = lngResult

It's pretty cut-and-dry; I have used this code in my company's "flagship" app for about a year and a half w/ no problems. It works GREAT on NT4...except now when called as a CGI EXE.
0
 
LVL 27

Expert Comment

by:Ark
ID: 2737186
0
 

Author Comment

by:ngjc
ID: 2738496
No problem there. This is a straightforward Internet app.

People are not connecting to the server thru RAS or anything.

Do any of you know about NT/IIS security issues? Could that be it? I have no idea how to grant my EXE the "right" to run a program on the server, if THAT is what the problem is.

Am I way off base? Like I said, if I LOCALLY double-click on the EXE it works as expected, but when it is launched as a CGI, ShellExecute returns a File not found, but the VB Dir() function SAYS IT IS!!!
0
 
LVL 27

Expert Comment

by:Ark
ID: 2738877
Hi
I don't thing it's security problem. If so, you would receive another error code. And, as you said, your app works good exept of one string (ShellExecute). Try to comment this string and play with another file functions from VB - Open, Copy, Rename. Do them work correct? If yes, then problem is in ShellExecute function.
Did you try it with short file names? If it works, you have to reinstall SP4.
Others tricks you can try:
1. ' If you said that your code works fine alone on NT, don't need to use StrConv
   FileCopy strFile, "c:\temp.pdf"
   lngResult = ShellExecute(GetDesktopWindow(),"Print","c:\temp.pdf",0&,0&,vbMinimized)
   Kill "c:\temp.pdf"
2. Try to force passing string ByVal (Sometimes this trick help me with API)
   lngResult = ShellExecute(GetDesktopWindow(),"Print",ByVal strFile,0&,0&,vbMinimized)
3. Try to send pointer to string. For this change declaration:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As Long, ByVal lpParameters As Long, ByVal lpDirectory As Long, ByVal nShowCmd As Long) As Long
Then in code:
lpFile = StrPtr(strFile)
lngResult = ShellExecute(GetDesktopWindow(),"Print",ByVal lpFile,0&,0&,vbMinimized)
4. Some API function return error, but executed OK. What's about On Error Resume Next?
5. Which file ShellExecute can not find? May be Acrobat? Try to use ShellExecute (or VB Shell) to launch Acrobat.exe with command line parameters to print strFile (sorry, didn't work with acrobat file, so can not provide command line).

PS. Check your ShellExecute declaration - in your case last 3 parameters should be "As Long" (not as string like in API viewer)

Cheers
0
 

Author Comment

by:ngjc
ID: 2738957
Ok, those were really good suggestions, thanks, and I tried them all(also w/some variations as well). I changed my declaration of ShellExecute accordingly.
Here are the results:

1) Copying to c:\temp.pdf resulted in a successful file copy, but ShellExecute returned 2. Copying to App.Path & "\temp.pdf" resulted in successful file copy, but ShellExecute returned 2.

2) With ByVal, still a 2.

3) Passing pointer to string also resulted in 2.

4) I know that the API is returning an error because it is not accomplishing the ShellExecute. Here's the evidence:
  1) Acrobat is not being launched.
  2) Because of #1 no faxes are being sent.

5) Since VB commands seemed to be working so well, I went as far as doing this:
Shell "Start " & strFile
....and then even using SENDKEYS to try to print it. Nothing even launched.
If I do the same from the Run dialog ON the NT server, it works.
Unfortunately, the command-line parameter to print "/p" causes a print dialog to appear, which I really can't have happen. Since nothing happened anyway, I guess it doesn't matter.

The reason I think it's a security problem is because the code works fine when I, as Administrator, double-click on the same code as an EXE, but not when submit the form, thereby running the EXE.

Also, I can use the following VB file functions to my heart's content:
Open, Copy, Kill, Rename

Shell, however, which I tried as a test alternative to ShellExecute, does NOT! I tried Shelling Acrobat AND Notepad, for example, and nothing happened in either case, but only when run as CGI.

Just for fun, IS there a way to make sure that my EXE has "full-run of the machine" so I can double-check that???
0
 
LVL 27

Expert Comment

by:Ark
ID: 2739041
Hi
It seems that "File not found" error isn't for .pdf file, but for associated file. Unfortunatelly, can not check this - I'm under W98. You can check your app running by adding MsgBox at any place, but I'm sure, it works. BTW, when you tried to launch notepad, did you use FULL path? It seems that from CGI you don't have access to your registry and system parameters (ini, windir$, winsysdir$ etc.)
Cheers
0
 

Author Comment

by:ngjc
ID: 2739050
An hour later...

SHELLing Acrobat by calling it explicitly with:

(I have Declared DoubleQuote a Const=""")

Shell DoubleQuote & "C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe" & DoubleQuote & " " & strFile

....no longer returns an error, but ShellExecute still does.

I'm really confused now. Why would ShellExecute not work when my EXE is called by MS Internet Information Server?
0
 

Author Comment

by:ngjc
ID: 2739062
I'm under Win98 as well here at home. I will have to drive out to the office tomorrow to go check and see if Acrobat is actually opening, or if VB is misbehaving and Shell is not returning an error as it should if there WAS a problem.

At any rate, I HAVE to use ShellExecute. ShellExecute DOES work on this NT machine, otherwise the stand-alone code wouldn't work, nor would double-clicking on an Acrobat document, which does work as well.

Hmmm. I think I'm going to go play in traffic for awhile...
0
 
LVL 27

Expert Comment

by:Ark
ID: 2739084
So, your app works and can call acrobat reader. There are to things which can produce error at ShellExecute:
1. ShellExecute can not find associated file because have no rights to registry access. You can try to check this with FindExecutable API
2. ShellExecute Find executable file, but can not read default dir from registry.
in this case you have to pass "C:\Program Files\Adobe\Acrobat 4.0\Reader\" as lpDirectory parameter instead 0& (don't forget to change declaration back As String)
Cheers
0
 

Author Comment

by:ngjc
ID: 2739101
I've tried that already, but I had myself if I didn't try it again!

One last thing before I throw myself into the path of an oncoming sport utility vehicle...

ShellExecute has failed with the following document types:
..TXT(Notepad),.WRI(WordPad),.PDF(Acrobat),.HTML(MSIE)

That tells me that we're on to something...

Thanks for staying with me Ark!!!
0
 

Author Comment

by:ngjc
ID: 2739168
Ok, now I've changed the ShellExecute Delcaration to String var type for everything except for the nShowCmd parameter, which is OK by the API Viewer, VBnet, and a bunch of other ref. sites.

The Directory parameter according to the Win32 SDK is supposed to be the Default Directory...for WHAT?

I tried your suggestions, and variations...

hWndDesktop = hWnd of Desktop
strFile = full path to .pdf file
DoubleQuote = """

1) ShellExecute hWndDesktop, "Print", strFile, "", "C:\Program Files\Adobe\Acrobat 4.0\Reader\"

2)  ShellExecute hWndDesktop, "Print", strFile, "", "C:\Program Files\Adobe\Acrobat 4.0\Reader"

3) ShellExecute hWndDesktop, "Print", strFile, "", DoubleQuote & "C:\Program Files\Adobe\Acrobat 4.0\Reader\" & DoubleQuote

4) ShellExecute hWndDesktop, "Print", strFile, "", DoubleQuote & "C:\Program Files\Adobe\Acrobat 4.0\Reader" & DoubleQuote

All of the above failed with a return code of...you guessed it, 2.

I ALSO tried, since you made me think of the Registry, WRITING to the Registry, and reading the value back...

Not only did it NOT store the value, but reading it back using VB's GetSetting(AppName,Section,Key,DefaultValue) should return the supplied DefaultValue, right? It DIDN'T! It returned an EMPTY string!

Now we're getting somewhere...what do I DO? This IS some kind of securityish problem. Who would have thought that MS security would be TOO tight?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2739188
have you looked to see from IIS what read and write permissions are granted for this folder and file?
0
 

Author Comment

by:ngjc
ID: 2739212
That's part of the problem. I'm not sure how. I've read thoroughly through the IIS Help, and everything, but I'm still having trouble.

I DO know how to grant the user/visitor rights to view/read, or execute files, allow/disallow directory listing, etc., but HOW DO YOU GRANT AN EXE FILE ACCESS TO THE WindowsNT Registry, which seems now to be the root of the problem?

....like I was saying in the beginning.

Sorry. I'm a little burned-out!

Anyway, I can read/write/rename/delete ANY file anywhere I want from the VB6 EXE, BUT I can't run ShellExecute correctly I'm guessing due to the fact that my EXE is not allowed access to read the Registry or use any API functions that utilize the Registry, like ShellExecute.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2739218
http://www.winntmag.com/Articles/Content/5375_01.html

that article talks about setting registry permissions for NT
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2739222
http://charon.assert.ee/counters/iis.htm

additional settings that i have seen related to other cgi errors
0
 

Author Comment

by:ngjc
ID: 2739238
Thanks. I will obviously have to go out to the office tomorrow to try out the Registry edits.

Since ShellExecute observes system policies, I'm assuming that my EXE inherited the policies of the IUSR_computername account. I'm HOPING that's what it is.

I will let you know as soon as I find out!
0
 

Author Comment

by:ngjc
ID: 2739250
I'm still going to try the edits like I said previously, but I just realized that it is strange that I have delete rights from VB, using the Kill command, but no Registry access rights.

Right now, the IUSR_ Internet guest account is restricted to read-only rights, as is should be, so I think that VB somehow circumvents the security in its commands, while the API functions adhere to it.

I wonder how VB got published, considering it wouldn't qualify for the "Windows Logo" program without considering system security & policies? Heh.
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2740629
i get the impression you are the Admin on that NT system.
is that correct ?
if so - why not try to install the ADOBE under a default user, or whatever user that the server is usually works with when on ?
0
 

Author Comment

by:ngjc
ID: 2745852
After 8 hours of fiddling @ work: here's the story so far:

*Using advapi32.dll's GetUserName function, I have absolutely verified that my EXE has inherited the IUSER_<servername> account's rights.

*I adjusted the NT "Permissions" in the Registry so that it, (the IUSER_... account) has "Full Access" to it.

*I (temporarily) made that account a member of every group, giving it access, supposedly, to everything.

*ShellExecute still fails with a return code of 2 (file not found).

*The VB Shell command does NOTHING, AND returns NO ERROR!

Out of pure desperation I tried the following:

Shell "Start <path to Acrobat EXE> <file to open>"

It appeared that nothing had happened, but a quick look in NT Task Manager showed that Acrobat HAD LOADED, but no window was displayed! In fact, they stayed loaded until I rebooted the server. Attempts at ending the process resulted in "Access Denied" dialogs.

I added an AppActivate in my program to see what would happen if I tried to activate the hidden Arobat window. I received the error "70: Permission Denied," when I SHOULD have received "5: Illegal Function Call or Argument"

To absolutely be sure that it wasn't something quirky with Acrobat, I changed the path to that of Wordpad, and the exact same thing happened.

Nearing the point of insanity, and knowing that "CreateProcess" does not reportedly respect NT security, I tried it, and nothing happened.

What the heck do I do now? I hope the info I've provided is useful.
0
 
LVL 27

Expert Comment

by:Ark
ID: 2745884
Hi
To check registry Permission, try FindExecutable:
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long

Dim DummyDir As String, FileName As String, ret as Long
Dim AssocExec As String * 255

AssocExec = Space(255)
FileName = "c:\anypdf.pdf"
ret = FindExecutable(FileName, Dummy, AssocExec)
AssocExec = Trim$(AssocExec)
If ret <=32 Then
   MsgBox "Can not access registry " & ret
Else If IsEmpty(AssocExec) Then
   MsgBox "Can not find executable"
Else
   MsgBox "Executable for *.pdf " & AssocExec
End If

Cheers
0
 
LVL 27

Expert Comment

by:Ark
ID: 2745895
Hi
Another thought: try
Declare Function WinExec& Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long)
instead of VB Shell function
And second - you're right and CreateProcess doesn't check security, so you can launch App whith this function. How did you call CreateProcess?
0
 

Author Comment

by:ngjc
ID: 2745992
Hi again! I think I'm going to increase this one to 1300 in a few minutes.

First, here are the results of the FindExecutable API call:
"Executable for *.pdf C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe"

So far so good.

Ok, here's how I called CreateProcess:

Declaration:
Private Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long

lngResult = CreateProcessA(0&, Chr(34) & "C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRD32.exe" & Chr(34), 0&, 0&, 1&,NORMAL_PRIORITY_CLASS, 0&, 0&, startup, procinfo)

startup is of type STARTUPINFO
proc is of type PROCESS_INFORMATION
NORMAL_PRIORITY_CLASS = &H20&

I ONLY did that because I wanted to see what happened, as I need to be able to call the app using ShellExecute to avoid the Print dialog which appears with the unsupported and undocumented "/p" command-line parameter.

Also, I forgot to mention that when I used the WaitForSingleObject API call to wait until it was done, Acrobat stayed loaded in memory, but never got a response to the Print dialog, which never showed, so my app "hung."

Eagerly awaiting reply...
0
 

Author Comment

by:ngjc
ID: 2745993
Adjusted points from 1000 to 1300
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746013
you said you couldnt end process with task manager?  i guess that means trying to use postmessage wouldnt do much better either.  you say createprocess didnt do anything...perhaps you can enumerate all the processes just to check what is or isnt running.
0
 

Author Comment

by:ngjc
ID: 2746025
I'm sure that PostMessage would do the same, too.

I'm not as much worried about ending the process as why it won't interact with the desktop at all, and why ShellExecute returns a 2 when it should tell me something else, and true for that matter!
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746069
did you make any other initializations in your structures that you passed to the createprocess function?





0
 

Author Comment

by:ngjc
ID: 2746125
No, I didn't initialize all the flags, etc. I'm aware of a good portion of what the various flags do (not all), but seeing as it was just a test, and CreateProcess would never do what I needed it to, I worked with it as detailed above.

The test case, like ShellExecute, worked as expected on Windows98 and NT4 UNTIL it was called as a CGI. Then, it did nothing but load the Acrobat module in memory, displaying no windows.

Shell "start <path to any EXE>" produced identical results, loading the EXE, showing no windows and then doing nothing.

Shell "<path to any EXE>" did absolutely nothing.

The results of the FindExecutable call shows that proper access to the Registry is working, so ShellExecute should also work...unless a "feature" of NT is to not allow any application containing a form to be run via CGI.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746142
how bout trying to forceably show adobe using the showwindow api?

Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long


Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_NORMAL = 1
Public Const SW_SHOW = 5
Public Const SW_RESTORE = 9


using one of those constants


0
 

Author Comment

by:ngjc
ID: 2746211
I'll give that a shot tomorrow, as I'm at home now, and not able to see the NT Desktop.

The problem with that solution, if it works, is that I'll have to use a loop, with a timeout of say, 30 secs, that continually tries to successfully show the Print dialog, and then a SendKeys to "press Enter" on the Print dialog when/if it appears.

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746223
also have you looked at trying to print the document directly with print api functions?
0
 

Author Comment

by:ngjc
ID: 2746245
No...not know such stuff...elaborate.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746260
i think there are a number of printing api functions you may want to try.  setjob,startdoc, and startdocprinter for example.  i dont even have a printer to test them out on but they seem rather trivial.  plus you can always reference msdn for more info.



The StartDoc function starts a print job.

Public Declare Function StartDoc Lib "gdi32" Alias "StartDocA" (ByVal hdc As Long, lpdi As DOCINFO) As Long

Public Type DOCINFO
        cbSize As Long
        lpszDocName As String
        lpszOutput As String
End Type







0
 

Author Comment

by:ngjc
ID: 2746312
I took a look, and it doesn't "feel" like it applies. How would the API function print an Acrobat document w/out launching the program?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746328
i was under the impression that it was able to send the information directly to the printer.  this is an article i read awhile back that reminded me of the printer api functions:

http://support.microsoft.com/support/kb/articles/q154/0/78.asp?FR=0
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2746334
upon closer inspection i think youre right...however at this point i'm throwing out any ideas i can think of
0
 
LVL 27

Expert Comment

by:Ark
ID: 2746765
Hi again
I thing we're near solution and it must be simply. I don't agree that you can not start app from cgi - you start your own App without any problem! BTW, does your app have interface or it's just bas module?
0
 
LVL 27

Expert Comment

by:Ark
ID: 2746820
Just a crazy thought:
Since VB IDE support only one thread of execution, try to compile you app??
0
 
LVL 27

Expert Comment

by:Ark
ID: 2746965
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2747882
also it may be good to just try print apis anyways b/c i have seen questions posted previously where a user was unable to shell certain things like dialup connection on NT4.
0
 

Author Comment

by:ngjc
ID: 2749109
To Ark:

I couldn't agree more that I should be able to start an app from my program!

My CGI app has no forms, and neither did my test code, which was just enough lines to get Acrobat to print a document from a hard-coded path.

Oh god yes, I have compiled the app!!! I develop at home and the office, and copy the files to the "Web" directory on our server. I'd actually love to have the VB IDE on the server, but I just don't have the time to go through that whole process. I'm spread thin here as it is, and seeing as I'm 4 days deep into this project, I MAY have to give up and call MS for $75....and HOPE they have an answer. This would be the 2nd time in my life...

I also took a look at the article about ending tasks you mentioned. It is a bummer, to say the least, that I, who built, set up, and maintain the server, don't have sufficient privileges to end a program!!!

Thanks!

To AzraSound:

I'd try the API's...but isn't ShellExecute an API func? Kidding. Ok, the problem with it is that 1) I don't think it applies, and 2) the time involved to learn how to manage low-level printing routines is not cost-effective at this point. If there was cut-and-paste, you fill in the filename and go code available, I'd give it a shot, but all in all, I've put now ~60 hours into what should be (and was) 1 line of code with no results. Such is life, I know, but I am just dreading the impending conversation w/ my boss.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ngjc
ID: 2749576
I think this is going to be the last comment.

It appears that this is completely impossible due to a bug in NT4.

One CANNOT from a CGI program cause NT4 to run another process, regardless of privileges...end of story!

I have finally tried everything, I think.

I wrote a command-line utility (i.e. NO FORMS) that faxed a file (using the associated EXE to open it) using the following command:
FAXFILE <file> <fax#>

It worked PERFECTLY from Start->Run.

When I called IT from my CGI, BOTH the EXEs stayed in memory, consuming 3MB each, and doing NOTHING. NO ERRORS WHATSOEVER WERE RETURNED BY THE OS or VB6. PROCESSES LOCKED.
0
 
LVL 27

Expert Comment

by:Ark
ID: 2749596
It's annoying that I can not check up the code at my machine and just can send the supposition. I still can not uderstand why ShellExecute return 2. We found that file name passing OK, executable - OK. Which more files does this function need? May be it's printer and/or control panel or system files? Did you grant user access to them?
Did you try windows scripting host to run program?
Cheers
0
 

Author Comment

by:ngjc
ID: 2749628
Supposing it is necessary, how can I ensure that the user has access to the printer and control panel?

ShellExecute is no longer returning 2, by the way! It is just locking up my EXE now.

I started referring to the file(s) strictly by UNC path, and ShellExecute stopped returning errors. Heck, it just STOPPED.

If I SHELL instead, I get "Error 5: Illegal Function Call or Argument." A Dir() function returns that the file exists, so I have access to the file.

I'm not sure how this is for progress, but it's something.
0
 
LVL 27

Expert Comment

by:Ark
ID: 2749629
Sample code for scripting:
Dim wshShell As New IWshShell_Class
Private Sub Command1_Click()
  Dim sCommand As String, bWait As Boolean
  sCommand = "calc.exe"
  bWait = True
  wshShell.Run sCommand, WshNormalFocus, bWait
End Sub
This is code for VB, but you can call WSH directly from CGI.
Cheers
0
 
LVL 27

Expert Comment

by:Ark
ID: 2749645
Forgot about referencing...
Make reference to Windows Scripting Host Object Model. Or you can use late binding through CreateObject.
0
 
LVL 27

Expert Comment

by:Ark
ID: 2749763
Hi again
It seems we are posting messages at the same time <smile>.
>ShellExecute is no longer returning 2< it's step forward <smile>. Now I thing that the problem is with class/thread priority. Try GetPriorityClass / SetPriorityClass API. Try to set Priority up to 31 - real time. I'm not familiar with priorities and now look through documentation. May be Azra can help?
By the way, from API help file:
>If lpFile specifies a document file, nShowCmd should be zero (not vbMinimize as in your sample).
0
 

Author Comment

by:ngjc
ID: 2749777
At the risk of sounding stupid, you lost me. I understand what Windows Scripting Host is, but have no idea how to late-bind or otherwise use CreateObject, aside from the example in the VB help.

What's its Class Name?

After poking around the Adobe SDK, I noticed that supposedly, Adobe exposes Reader to the VB programmer through OLE objects. I included their OCX in a test project, and then used the Object Browser to find out its Class Name, etc, which is:

Class: "Pdf" member of "PdfLib"

Couldn't I just use CreateObject to create an instance of it? The problem is, I don't know how!

Set objPDF = CreateObject("Pdf")
does not work. I can't add forms to a project marked for "Unattended Execution."

Arrrgh.
0
 

Author Comment

by:ngjc
ID: 2749782
I'll try setting the nShowCmd = 0 before anything else. I can't believe I missed that *smack*.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2749784
http://www.winmag.com/library/1998/0801/how0066.htm

short article talking about wsh

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2749786
>If lpFile specifies a document file, nShowCmd should be zero (not vbMinimize as in your sample).


if thats been the problem the whole time we're all going to shoot ourselves
0
 
LVL 27

Expert Comment

by:Ark
ID: 2749842
Here is Microsoft sample for Run method:
http://msdn.microsoft.com/scripting/windowshost/doc/wsMthRun.htm
You can find a lot of information about windows scripting host at:
http://wsh.glazier.co.nz/
About Adobe OCX - I didn't work with it but heared that it's full of bugs, but I'll try it and post results here.
Cheers
0
 

Author Comment

by:ngjc
ID: 2749854
Thanks for the info on WSH. That site is very nice.

I found some interesting info about OLE and Acrobat Exchange 3, which I do own.

Did I find code samples at Adobe's website? No, of course not. I found plenty of 404's there for code. Grrr. Apparently, the word, "free" is not in their vocabulary anymore.

I DID find some stuff at codecuts.com, which I had never even heard of until minutes ago.

So far, it's crashed my system twice, but the third time is the charm, right?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2749873
i dont know how if problem could be priority related.  the OS does set/maintain the priorites for processes but it shouldnt completely halt one, as it appears to do so in this case.

http://www.asptoday.com/articles/19991223.htm

http://www.15seconds.com/issue/990902.htm


two instances i see using createobject with adobe and pdf files.  two different approaches.  one is of the vbscript form and the other asp. actually i went to google.com and searched for "CreateObject pdf" and got lots of results
0
 
LVL 27

Expert Comment

by:Ark
ID: 2749896
From Acrobat help:
No Acrobat products are multithreaded at this time and any attempts to access the
Acrobat API in a multithreaded manner will cause the viewer to hang or crash.
Cheers
0
 

Author Comment

by:ngjc
ID: 2750045
AzraSound: Thanks a lot for those articles, they will be helpful for other tasks in the future, but the 15seconds.com article is using Adobe PDF Forms as Input, and the asptoday.com article is about printing Word documents as PDF's. Both are great, but at this second I just need to print a PDF to our Fax Server's printer driver.

Ark and AzraSound:

Here's what I've done so far, which results in perfection on NT/98 if run from Start->Run, but fails as CGI:

Public Sub PrintAcrobatDoc(strFileName As String)

Dim AcroExchAVDoc As Object
Dim AcroExchPDDoc As Object
Dim AcroExchApp As Object
Dim iNumberOfPages As Integer

Set AcroExchApp = CreateObject("AcroExch.App")
Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
Set AcroExchPDDoc = CreateObject("AcroExch.PDDoc")

' Show the Acrobat Exchange window
'
' Commenting out this line below when run as CGI causes a "90: Object variable or With block variable not set" error. If not CGI, it just keeps the UI invisible, which is desired.
' Leaving it in causes the app and Acrobat Exchange to hang indefinitely when run as CGI!
AcroExchApp.Show
' Open pdf file
AcroExchAVDoc.Open strFileName, ""
' Get the PDDoc associated with the open AVDoc
Set AcroExchPDDoc = AcroExchAVDoc.GetPDDoc
AcroExchAVDoc.GetPDDoc"
' Get the number of pages for this pdf iNumberOfPages = AcroExchPDDoc.GetNumPages - 1
' Print all pages in this document
AcroExchAVDoc.PrintPages 0, iNumberOfPages, 2, True, False
' Close file
AcroExchAVDoc.Close True

' Close Acrobat Exchange
AcroExchApp.Exit

End Sub


Also, just to see WHAT line was causing the error 90, I put a MsgBox in after each line of code, telling me where it currently was. The app hung before creating an instance of Acrobat Exchange! ...and before you say it, yep, I had the "Unattended Execution" checkbox for the VB project UNchecked when I added the MsgBoxes.

This seems to jive w/ my theory about desktop interaction blowing the thing.

Any ideas now?
0
 
LVL 27

Expert Comment

by:Ark
ID: 2750196
Hi
Why not use early binding?
Make reference (VB Menu ->Project ->References...) to Acrobat Control for ActiveX. Then
Dim AcroRead As New Pdf
Private Sub Command1_Click()
  Dim sFile As String
  sFile = "c:\doc\myfile.pdf"
  AcroRead.src = sFile
  AcroRead.Print
' or
' AcroRead.Open sFile
End Sub

And second, take a quick look at http://pw2.netcom.com/~obrienk/index.html
Source code provide CreateProcess and WaitForSingleObjects API functions
Cheers
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2750245
0
 

Author Comment

by:ngjc
ID: 2750296
Ark:

Your suggestion, while it would work, requires that I have a form in my project then, and this has to be an unattended app. The code using CreateObject as-is works on the server when I call it explicitly at Start->Run, but not as CGI. (It even works, of course, from my Win98 Desktop, if dropped into a .VBS file!)

Re: Second, that's the code (exactly) as I was using for CreateProcess, which stalled @ WaitForSingleObjects, as the process never completed, presumably due to the brief point at which a dialog is presented...even though it does not require user input.

BTW, Is there any reason at all why the VB code involving CreateObjects would return error 90? I didn't even get the dreaded "couldn't create object" error!

AzraSound:

That page you referenced explains it all. It's amazing that we didn't find it earlier. I'm kinda at a loss as to what to do now though, as it APPEARS as though no matter what, an EXE called by IIS and all subsequent EXE's inherit the inability to interact with the NT Desktop! Is this true?

Acrobat Exchange IS a single-threaded object, so does that mean that it is impossible, even if called by my app in the way described a few posts ago (CreateObjects), to produce results? (I could ensure that it cannot be called again if currently active.)

I also saw on a MS page that IIS calls components differently; 1) via inetinfo.exe, and 2) directly. It didn't seem to explain what criteria determines HOW, or if that fact would have an impact in my situation. Sometimes I get a little lost in the terminology du jour that MS uses.

What I will do is narrow down the problem somewhat by attempting to create an instance of Word via CreateObject(Word.Application) and print a test document on the server.

We're getting close now. I really don't want to accept defeat and say that it is impossible to simply print a PDF!

Thank you both for this help so far. I hope it has been as educational for you as it has been for me :) <grinding teeth>
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2750333
Also from article it appears you should create object using server.createobject unless you are working from behind a firewall.  in general it seems to be the preferred method  (off to do a bit more research)  

<I hope it has been as educational for you as it has been for me>

so far i've learned that i dont plan on trying to print a pdf document via cgi script anytime soon.  =)
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2750351
http://support.microsoft.com/support/kb/articles/Q243/5/44.asp

that table pretty much sums it up.  single threaded is just a no no when it comes to asp.  how sad.  i still feel there must be some workaround.  perhaps we need to take a step back and try to attack it from a different angle.  i, like you, hate to admit defeat to anything.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2750396
actually everytime i see a refernce to STA's it only refers to using the objects in a particular scope.  i.e., it always says "do not create a STA in application or session scope".  however it seems to be ok with page scope (at least it doesnt mention a problem with using it that way). now this is all pretty foreign to me, what it entails to create this object with only page scope is beyond me.  i presume you to have more knowledge about that than i do.


PRB: COM Objects Fail to Print When Called From ASP
http://support.microsoft.com/support/kb/articles/Q184/2/91.ASP
0
 
LVL 27

Expert Comment

by:Ark
ID: 2750420
Hi guys
Are you sure that WordPad is single-threading app?
Take another look:
http://support.microsoft.com/support/kb/articles/Q156/2/23.ASP
0
 

Author Comment

by:ngjc
ID: 2750627
I had already scoured the pages you guys mentioned. It's good to know that I'm on the same level here.

About taking a step back:

What a great idea. I walked away from this PC (which can be an abbreviation for MANY things) and rethought the whole thing. You know what? I came up with an answer!

I thought back to my early 80's programming roots, which was easy given my state of mind after 24 hours w/ no sleep and a couple of beers to "take the edge off." I just decided to work around the whole thing with what I guess I'd call "semaphore" files.

My CGI app has NO problems with creating files, so what I did was write a "listener" program that watches a folder on the server using the FindXXXXXChangeNotification Kernel Functions for job files that my CGI program creates. The files contain the path to the file to open w/ the associated program, and the phone # to fax the file to. Once the file has been submitted to the fax server, the job file is deleted.

Since the program that does the actual fax printing is NOT called by IIS, it has all the privileges I want it to have. The dreaded single-threaded problem w/ Acrobat Exchange is avoided as the listener program doesn't try to open more than one instance of it. I could get really cool and have it listen on a TCP port for job submissions, but that is for later...

So far, it works HERE on my Win98 machine. I have no way of starting a new program on the server until tomorrow, when I'm at work. BUT, since we know that ShellExecute worked fine when the program was started w/out IIS's involvement, I'm not worried. Well, not TOO worried.

How's that? Sorry about my habit of writing a novel each time, btw!
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2750648
how's that? thats perfect! it did seem we were getting nowhere fast (nowhere seemed to exist at more than one place at a time however) and i was starting to get pretty discouraged about the whole thing...i could only imagine how you felt.  thats when i mentioned we needed a new angle. luckily you were on the same page with me (and probably the same beer).  it sounds great and i'm anxious to hear the words of joy tomorrow when you get that sucker rolling!
0
 
LVL 1

Expert Comment

by:mathies
ID: 2752779
Very simple.

ShellExecute don't support 32bit name
replace Program Files by Progra~1 and every directory more than 8 char to 8.

If you want, you can use the API to do the job for you.

0
 

Author Comment

by:ngjc
ID: 2753217
Actually, ShellExecute DOES support 32-bit names.

I have used it successfully for years using a long pathname enclosed in quotes.

Just for the heck of it, though, in the first day of posts, you'll see that I tried using the short pathname...you never know.

http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/ShellExecute.htm
0
 

Author Comment

by:ngjc
ID: 2753730
It works it works it works it works!!!!!

I was approaching this all wrong; plenty of sleep, eating well, and no beer. I just needed to turn my brain upside down to come up w/ something. Damn NT.

Thanks guys, for all the help.

Now, we have to decide how to pass out dem points!

I'll talk w/ you later. I'm freaking insane with joy right now...
0
 
LVL 27

Expert Comment

by:Ark
ID: 2753733
Hello ngic
In Russia says: the shortiest way is which you know best <smile>. Just one thing about "semaphore". You have a good practice with files at 80's, but now is 21 century. What's about using Registry? You''l need 2 app for this - one should start with system and work at background for registry monitoring and second will launch from CGI. Here is sample code:
First App (RegMon)
'---bas module---
'you don't need all constants - choose which you need
Const INFINITE = &HFFFFFFFF
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_NOTIFY_CHANGE_NAME = &H1
Const REG_NOTIFY_CHANGE_ATTRIBUTES = &H2
Const REG_NOTIFY_CHANGE_LAST_SET = &H4
Const REG_NOTIFY_CHANGE_SECURITY = &H8
Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME Or REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or REG_NOTIFY_CHANGE_SECURITY)
Private Declare Function RegNotifyChangeKeyValue Lib "advapi32" (ByVal hKey As Long, ByVal bWatchSubtree As Boolean, ByVal dwNotifyFilter As Long, ByVal hEvent As Long, ByVal fAsynchronous As Boolean) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function CreateEvent Lib "kernel32" Alias "CreateEventA" (ByVal lpEventAttributes As Long, ByVal bManualReset As Long, ByVal bInitialState As Long, ByVal lpName As String) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Dim hKey As Long

Sub Main()
  hKey = HKEY_CURRENT_USER ' choose yours
  If Not regKey_Exist(hKey, "MyRegKey") Then
     Dim WSHShell As Object
     Set WSHShell = CreateObject("WScript.Shell")
     WSHShell.RegWrite "HKCU\MyRegKey\FilePath", "dummy"
     WSHShell.RegWrite "HKCU\MyRegKey\PhoneNum", "dummy"
     WSHShell.RegWrite "HKCU\MyRegKey\ChangeFlag", "0"
     Set WSHShell = Nothing
  End If
  WatchReg
End Sub

Function regKey_Exist(ByVal hKey As Long, ByVal sRegKeyPath As String) As Boolean
 Dim lKeyHandle As Long
 Dim lRet As Long
 lKeyHandle = 0
 lRet = RegOpenKey(hKey, sRegKeyPath, lKeyHandle)
 If lKeyHandle = 0 Then
     regKey_Exist = False
 Else
     regKey_Exist = True
 End If
 lRet = RegCloseKey(lKeyHandle)
End Function

Private Sub WatchReg()
  Dim lRet As Long, sNewPath As String, sNewNum As String, sFlag As String
  Dim lKeyHandle As Long
  Dim sRegKeyPath As String
  Dim hEvent As Long
  hEvent = CreateEvent(0&, False, False, vbNullString)
  Dim WSHShell As Object
' your favorite late binding
  Set WSHShell = CreateObject("WScript.Shell")
  sRegKeyPath = "MyRegKey"
  lRet = RegOpenKey(hKey, sRegKeyPath, lKeyHandle)
  Do
    DoEvents
    RegNotifyChangeKeyValue lKeyHandle, True, REG_LEGAL_CHANGE_FILTER, hEvent, True
    WaitForSingleObject hEvent, INFINITE
    sFlag = WSHShell.RegRead("HKCU\" & sRegKeyPath & "\ChangeFlag")
    If sFlag = "1" Then
' Registry changed - start here your shellexecute       WSHShell.RegWrite "HKCU\MyRegKey\ChangeFlag", "0"
       sNewPath = WSHShell.RegRead("HKCU\MyRegKey\FilePath")
       sNewNum = WSHShell.RegRead("HKCU\MyRegKey\PhoneNum")
       lRet = MsgBox("Changed:" & vbCrLf & "NewPath = " & sNewPath & vbCrLf & "NewNum = " & sNewNum, vbOKCancel)
       If lRet = vbCancel Then Exit Do
    End If
  Loop
  lRet = RegCloseKey(lKeyHandle)
  CloseHandle hEvent
  Set WSHShell = Nothing
  End
End Sub
' Run this app and try to change values at HKCU\MyRegKey using regedit. When you change ChangeFlag value, msgbox appear
'You can add dummy form to show it at system tray and stop looping using Public flag bStop, which set to true at Form_unload event
 Second app will start from cgi and write to registry appropriate values using WSH (or you can use pure API). I've already show how to do this with late binding <smile>.
Cheers
0
 
LVL 27

Expert Comment

by:Ark
ID: 2753744
Hi again
Congratulation!!!
It seems you are working behind the wall af my room - we again posted messages at same time <smile>.
Cheers
0
 

Author Comment

by:ngjc
ID: 2753870
Thanks for the code and the congratulations!

I KNOW the solution was kinda ugly, but it works well. My CGI app, which displays the forms available (and a Fax It link) writes a file into the folder my listening/spooling app checks using the API. When it's idle, it uses 0% of the CPU according to NT Task Manager, so THAT'S good. I can submit TONS of faxes into the folder, and it picks them all up, one at a time, and faxes them. The turnaround is about 2 seconds!

I will check out your code...definitely! It seems, at first glance, to be only able to handle one at a time (because of the flag) and the CGI app would have to wait until the flag was reset, right? Right now the CGI app doesn't care, it just throws a file, <CStr(Timer) & ".job"> into the polling folder.

BTW, there have been over 10 faxes sent, according to my app's log since I put it up. Damn, I GUESS people like it.

I'll get back to you in a bit.

Thanks again!
0
 

Author Comment

by:ngjc
ID: 2753895
I should correct myself there, the filename is:
Format(Timer * 100, "#.JOB")

That is imperfect, as if more than one submission was made in a millisecond (!) it would write to the same file, but...

It also provides for the faxes to be FIFO.
0
 
LVL 27

Expert Comment

by:Ark
ID: 2754580
Hi
Flag is for receiving notification. RegNotify occure every time you change registry - so, if you change PhoneNumber and File Path, this event occure twice. So I change registry 3 times and every time check if flag change. BTW, another idea - write only one key with long string containing filepath and fax number and then parse string. In this case RegChange event occure only one time. Directly after this you can parse string and send fax. You can store these strings in array and send as many faxes as you want.
Cheers
0
 

Author Comment

by:ngjc
ID: 2809156
Hi.

Wow, I've been "gone" a long time, sorry.

Anyway, it's kind of funny that after all that hubub about ShellExecute that I've ended up using the Acrobat OLE Objects for printing after all. I'm using ShellExecute for possible future document types that are not .pdf, though.

I've expanded the program to accept multiple files for a job, and in the case of PDF, it merges them all into one PDF. It also emails forms in addition to faxing them. The program can now take a URL as the filename parameter, and in that case, will download the file to a temporary directory meaning we don't have to host all the files on our server. Why? A lot of the PDF forms we need are hosted on websites of the companies with which we do business, but are password protected, and their interfaces/features vary from site to site. My forms CGI program logs on to those servers, parses the HTML for the links and descriptions of each form (the parameters are all stored in an INI file. No hard-coding!), and creates a nice sorted HTML table with all the forms for a company, in addition to the forms I have created...all without having to know any of the particulars of each company's forms page, nor the logon for that matter. That also allows me to additionally offer faxing and emailing of forms, which they do not.

I'm sticking with the job-file method as opposed to using the NT Registry for a few of reasons:
1) Speed: The registry method takes approximately 50% longer (which is only a few ms longer per transaction), but nonetheless...
2) Set-up: All that needs to be done to allow programs to submit to my service is share the "job folder."
3) Ease: The program submitting a job does not have to wait until the status flag is cleared; instead, a file just needs to be written, and the CGI can then end. The service just digests the files one by one until the directory is empty.

I know I've gone into way too much detail already, but here is the "fun" part: My boss liked it so much that he had a big insurance web portal company come in and look at licensing it (as well as the marjority of my other work over the last 3 years). Their words were, "We've got tons of clients who would pay $10,000(US) a pop for this stuff." The deal is 99% complete. I would have been very excited except that he does not want to cut me in for ANY percentage of it.

Let's just say that I've got an interesting, life-changing Monday ahead of me...

Ok, to the point: Even though I didn't use any one answer/piece of code in its entirety, all the examples, advice, and conversation has been a catalyst for what I have achieved in this program in addition to clearing up the few remaining grey areas I had about 100 other things (COM, NT Security, API, etc.). In all fairness, I'd like to split the full points up between the both of you.

I really appreciate everything more than you know. If I can return the favor in any way, I would gladly do so. I guess I can't leave contact info here though(?)
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2810902
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10348773

At that link you can request that the points here be split and they will take care of it for you.  Just explain the situation and give them the URL to this question.  It sounds like you've been busy (and pretty damn productive).  Congratulations on all your success and if you ever want to give me an update or drop me a line you can reach me at AzraSound@aol.com  

Cheers!
0
 

Author Comment

by:ngjc
ID: 2812125
..at the "Saving VB Forms" question?

Are you sure?

Forgive me, for I have doubt...
0
 
LVL 27

Expert Comment

by:Ark
ID: 2812367
Hi
I join to Azra's congratulations. I don't know about splitting points, but you can ask this question at community support area. I thing you can reduce points for this question by half, choose any comment as answer and then post another "dummy" question with rest of points. I agreed with you that this thread is very interesting. You can reach me at ark@fesma.ru
Cheers
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 400 total points
ID: 2812422
how in the heck did that url get posted!?! haha  anyways, the correct URL is:

http://www.experts-exchange.com/Customer_Service/Experts_Exchange/



0
 

Expert Comment

by:Matt5000
ID: 2822076
0
 

Author Comment

by:ngjc
ID: 2843475
I took a brief look at it and am about to read it in-depth (and play around with it).

My only comments are:
1) DOH!!! (if the answer REALLY is there, and it seems to be)
2) My current method appears to be the most fool-proof, but that remains to be seen.
3) I hacked away at the whole CreateProcessAsUser thing a couple of days before even submitting this question, with no results. I was able to confirm that my CGI was logged on as the Administrator, but I still received the same errors. I may have EASILY missed something though in those 16-hour workdays!

Thanks.
0
 

Author Comment

by:ngjc
ID: 2843488
It appears to answer the question.
However, my question regarding the MSKB article is:

Will programs called by the CGI (in this example, Adobe Acrobat Reader or Exchange) INHERIT the system privileges and also be able to access the NT Desktop. They would HAVE to, or they would fail when displaying any status (i.e. "Printing...") forms.
0
 

Expert Comment

by:Matt5000
ID: 2844993
I really don't do any work with NT security, but it is my understanding that unless a program provides a different set of security credentials to a spawned process, they inheret the ones from the calling program by default.

Don't bet the farm on that, though, I've only done a minor amount of programming with Win32 C++. ;)
0
 
LVL 3

Expert Comment

by:darinw
ID: 2845996
Community Support has reduced points from 1300 to 650
0
 
LVL 3

Expert Comment

by:darinw
ID: 2845997
Hello everyone,

Reducing points to one half to allow for split.

ngjc, you can now accept one of the comments in this thread as an answer. To award the other Expert, you can create a new question in this topic area with a title of 'For ExpertName -- 10331875' using that Experts username.

Remember, the Accept Comment as Answer button is in the header of the comment.

For your convenience, you can use this link to create the new question:
http://www.experts-exchange.com/bin/NewQForm?ta=31

darinw
Customer Service
0
 
LVL 3

Expert Comment

by:darinw
ID: 2919666
Community Support has reduced points from 650 to 325
0
 
LVL 3

Expert Comment

by:darinw
ID: 2919667
Hello everyone,

I am reducing the points to 325 on this question for a split.

ngjc - You can now accept one of the comments in this thread as an answer to award the first Expert. Remember, the Accept Comment as Answer button is in the header of the comment.

For the other Expert, you must post a question in this topic area. The question title should be 'For ExpertName -- 10331875' with the appropriate Expert username inserted there and it should be for 325 points.

For your convenience, you can use this link to create the new question (right click and open in a new window):
http://www.experts-exchange.com/bin/NewQForm?ta=31

darinw
Customer Service
0
 
LVL 3

Expert Comment

by:darinw
ID: 2919692
Adjusted points from 325 to 650
0
 
LVL 3

Expert Comment

by:darinw
ID: 2919693
DOH!

darinw
Customer Service
0
 
LVL 3

Expert Comment

by:darinw
ID: 2919702
I have changed the points back to the original split amount.

Please, ngjc, finish the point split to award the Experts for the help they have given you!

darinw
Customer Service
0
 
LVL 3

Expert Comment

by:darinw
ID: 2945270
Community Support has reduced points from 650 to 400
0
 
LVL 3

Expert Comment

by:darinw
ID: 2945271
Hello everyone,

I will handle the split for this member since they seem to have gone on vacation.

I will be reducing this question to 400 points and posting a new question for 400 points for the second Expert. According to the guidelines set out, 200 points is for a hard question. Point awards that are well over 200 points border on being unfair to the rest of the Experts and Community Support will reduce any question that is over 400 points down to 400 points.

I apologize for this being necessary, but we feel it is in the best interest of the site and the Experts.

darinw
Customer Service
0
 
LVL 3

Expert Comment

by:darinw
ID: 2945281
Comment accepted as answer
0
 
LVL 3

Expert Comment

by:darinw
ID: 2945286
Ark, please post an answer at:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10449857

darinw
Customer Service
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now