Can you fix the problem

Reply

Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

Can you fix the problem

 
0
  #1
Feb 13th, 2005
Hi,
I have code to open program that work(on attach files).
My problem is when I change code to open another file it error.
Ex:
Right code:
Call Shell(li & "\" & "Program Files\Microsoft Office\Office10\POWERPNT.EXE", 1)
Error code:
Call Shell(li & "\" & "aa.pdf", 1)
Error say:"Invalid procedure call or argument"
I have file on my computer.
Can anyone help me with this problem please?
Thanks!
seyha
Attached Files
File Type: zip Code.zip (1.3 KB, 13 views)
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 35
Reputation: koolsid is an unknown quantity at this point 
Solved Threads: 6
koolsid's Avatar
koolsid koolsid is offline Offline
Light Poster

Re: Can you fix the problem

 
0
  #2
Feb 13th, 2005
Call statement Transfers control to a Sub procedure, Function procedure, or dynamic-link library (DLL)procedure.

I believe that you cannot use "CALL" to call a file which is not executable.
same goes with SHELL...

Call Shell(AppName, 1) Where AppName contains the path of the Executable file.

try it with any other directory and try calling an executable.. it will work.

If you try calling a .txt or .bmp, it will give you the same error message...
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

Re: Can you fix the problem

 
0
  #3
Feb 13th, 2005
So what can I do with the problem? Can you make the file for me please?
Thanks! I hope will here from you soon.
seyha


Originally Posted by koolsid
Call statement Transfers control to a Sub procedure, Function procedure, or dynamic-link library (DLL)procedure.

I believe that you cannot use "CALL" to call a file which is not executable.
same goes with SHELL...

Call Shell(AppName, 1) Where AppName contains the path of the Executable file.

try it with any other directory and try calling an executable.. it will work.

If you try calling a .txt or .bmp, it will give you the same error message...
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 35
Reputation: koolsid is an unknown quantity at this point 
Solved Threads: 6
koolsid's Avatar
koolsid koolsid is offline Offline
Light Poster

Re: Can you fix the problem

 
0
  #4
Feb 14th, 2005
Originally Posted by Seyha Eng
So what can I do with the problem? Can you make the file for me please?
Thanks! I hope will here from you soon.
seyha
Sure, I'll give the code in the evening when i come back from office.... Leaving for office now :-)

Try using commondialog controls with FSO (file system objects....)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Can you fix the problem

 
0
  #5
Feb 14th, 2005
the problem is you are trying to launch a PDF file, not an EXE file. If you want to open the pdf file, you'll have to use the path to adobe. Something like "c:\program files\adobe\adobe.exe aa.pdf" or something along those lines. the Shell function doesn't decipher extentions. It runs an application. Plain and simple. For a POSSIBLE solution to launching a program based on the extention (in cahoots with the registries, HKCR) you might want to look at the API call "shellexecute." That one does wonders
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 35
Reputation: koolsid is an unknown quantity at this point 
Solved Threads: 6
koolsid's Avatar
koolsid koolsid is offline Offline
Light Poster

Re: Can you fix the problem

 
0
  #6
Feb 14th, 2005
Originally Posted by Comatose
the problem is you are trying to launch a PDF file, not an EXE file. If you want to open the pdf file, you'll have to use the path to adobe. Something like "c:\program files\adobe\adobe.exe aa.pdf" or something along those lines. the Shell function doesn't decipher extentions. It runs an application. Plain and simple. For a POSSIBLE solution to launching a program based on the extention (in cahoots with the registries, HKCR) you might want to look at the API call "shellexecute." That one does wonders
You are right that it runs only applications. Even if you mention the filename with the path and the corresponding exe ("c:\program files\adobe\adobe.exe aa.pdf") or as a matter of fact ("c:\windows\notepad.exe aaa.txt") it still won't run... that's what i am trying to imply. working on it right now. should come up with the code ASAP :-)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Can you fix the problem

 
0
  #7
Feb 14th, 2005
the way to go is the shellexecute api.... it launches the default application for the specified file. It's how a lot of VB app's launch the default web browser to visit a specific URL (or whatever the case may be). ShellExecute is powerful, it can run an EXE or figure out which program to call for a specific extention!

thread reference (possible answer): http://www.daniweb.com/techtalkforums/thread18470.html
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC