Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 25 JAN 2011 11:03:22PM Yun Lee wrote:

I tried to open MS Word, MS Excel and CutePDF files using OLE.

I successed to open MS Word and MS Excel but not CutePDF.

My code is

oPDF	= OleCreateInstance("VSPDF.VSPDF.1")
status=OleStatus()
if status then
   msg(@window,'Create Instance Error: ':status)
   return
end
oPage  =OleCallMethod(oPDF, 'OPEN', file)
status=OleStatus()
if status then
   msg(@window,'CallMethod Error: ':status)
   return
end
OlePutProperty(oPDF, 'Visible', -1)

It has CallMethod Error. Can someone please help me how I can fix?

Yun


At 25 JAN 2011 11:57PM ftomeo@srpcs.com's Frank Tomeo wrote:

Yun,

I use something more like this, that will open basically any file that has a program associated with it:

Function [/color]OpenDoc(Name) 
[/color] 
[/color]Declare function [/color]ShellExecute, IsEventContext, Get_Property, FindWindow, BringWindowToTop 
[/color] 
[/color]if [/color]IsEventContext() [/color]then 
  [/color]Parent=[/color]@window 
  [/color]Frame =Get_Property(Parent, [/color]"MDIFRAME"[/color]) 
  [/color]if [/color]len(Frame) [/color]then 
    [/color]Parent=Frame 
  [/color]end 
  [/color]hwnd=Get_Property(Parent, [/color]"HANDLE"[/color]) 
[/color]end else 
  [/color]hwnd=[/color]0 
[/color]end 
[/color] 
[/color]rv=ShellExecute(hwnd, [/color]"open"[/color]:[/color]\00\[/color], Name:[/color]\00\[/color], [/color]\00\[/color], [/color]\00\[/color], [/color]0[/color]) 
[/color] 
handle=FindWindow([/color]"IEFrame"[/color]:[/color]\00\[/color], [/color]""[/color]) 
Success=BringWindowToTop(handle) 
[/color] 
[/color]Return [/color]rv[/color][/color][/size]         
               

As long as the PDF is not corrupt, it should work. At minimum, it will open the default reader and display an error if there is an issue with the file.

ftomeo@srpcs.com SRP Computer Solutions, Inc.


At 25 JAN 2011 11:57PM ftomeo@srpcs.com's Frank Tomeo wrote:

Yun,

I use something more like this, that will open basically any file that has a program associated with it:

Function [/color]OpenDoc(Name) 
[/color] 
[/color]Declare function [/color]ShellExecute, IsEventContext, Get_Property, FindWindow, BringWindowToTop 
[/color] 
[/color]if [/color]IsEventContext() [/color]then 
  [/color]Parent=[/color]@window 
  [/color]Frame =Get_Property(Parent, [/color]"MDIFRAME"[/color]) 
  [/color]if [/color]len(Frame) [/color]then 
    [/color]Parent=Frame 
  [/color]end 
  [/color]hwnd=Get_Property(Parent, [/color]"HANDLE"[/color]) 
[/color]end else 
  [/color]hwnd=[/color]0 
[/color]end 
[/color] 
[/color]rv=ShellExecute(hwnd, [/color]"open"[/color]:[/color]\00\[/color], Name:[/color]\00\[/color], [/color]\00\[/color], [/color]\00\[/color], [/color]0[/color]) 
[/color] 
handle=FindWindow([/color]"IEFrame"[/color]:[/color]\00\[/color], [/color]""[/color]) 
Success=BringWindowToTop(handle) 
[/color] 
[/color]Return [/color]rv[/color][/color][/size]         
               

As long as the PDF is not corrupt, it should work. At minimum, it will open the default reader and display an error if there is an issue with the file.

ftomeo@srpcs.com SRP Computer Solutions, Inc.


At 25 JAN 2011 11:58PM Frank Tomeo wrote:

Yun,

I use something more like this, that will open basically any file that has a program associated with it:

Function [/color]OpenDoc(Name) 
[/color] 
[/color]Declare function [/color]ShellExecute, IsEventContext, Get_Property, FindWindow, BringWindowToTop 
[/color] 
[/color]if [/color]IsEventContext() [/color]then 
  [/color]Parent=[/color]@window 
  [/color]Frame =Get_Property(Parent, [/color]"MDIFRAME"[/color]) 
  [/color]if [/color]len(Frame) [/color]then 
    [/color]Parent=Frame 
  [/color]end 
  [/color]hwnd=Get_Property(Parent, [/color]"HANDLE"[/color]) 
[/color]end else 
  [/color]hwnd=[/color]0 
[/color]end 
[/color] 
[/color]rv=ShellExecute(hwnd, [/color]"open"[/color]:[/color]\00\[/color], Name:[/color]\00\[/color], [/color]\00\[/color], [/color]\00\[/color], [/color]0[/color]) 
[/color] 
handle=FindWindow([/color]"IEFrame"[/color]:[/color]\00\[/color], [/color]""[/color]) 
Success=BringWindowToTop(handle) 
[/color] 
[/color]Return [/color]rv[/color][/color][/size]         
               

As long as the PDF is not corrupt, it should work. At minimum, it will open the default reader and display an error if there is an issue with the file.

ftomeo@srpcs.com SRP Computer Solutions, Inc.


At 26 JAN 2011 01:30PM Barry Stevens wrote:

Create a form with an 'ole control' about:blank and in the create event do:

call Send_Message(@window : '.OLECONTROL_1', 'NAVIGATE2', FullPath)

with the FulPath being passed.


At 26 JAN 2011 08:47PM Yun Lee wrote:

Hello Frank,

I changed my routine to yours.

I checked sysprocs table and there is dll_shell and dll_shell32 which I created and run declare fcns.

When I run my progrm I have error with msg "The application or DLL C:\WINDOWS\system32\SHELL.DLL is not a valid Windows image".

I searched internet and did fcs /scannow and still have same problem.

Can you please explain what the problem is and how to fix?


At 26 JAN 2011 08:54PM Yun Lee wrote:

Hello Frank,

Thank you for your help.

I changed my codes to yours.

But I have error "C:\windows\system32\shell.dll is not a valid Windows image". I searched internet and did fcs scannow, but still have same problem. In the sysprocs table there is dll_shell which has proper code for ShellExecute. Sysprocs table record name must be dll_shell or dll_shell32?

Can you please explain why this error occurs?


At 13 FEB 2011 10:52PM Yun Lee wrote:

Sorry I returned from other works.

I failed using ShellExecute and I am tring to use original one.

I checked OI help and searched web. So I know the method and property for VSPrinter.

I changed the program like

oleObj = OleCreateInstance('VSPRINTER7.VSPRINTER.1')

    status=OleStatus()
	if status then
	   msg(@window,'PDF CreateInstance Error: ':status)
	   return
	end
OlePutProperty(oleObj, 'PREVIEW', true$)
	status=OleStatus()
	if status then
	   msg(@window,'OLE Preview Error code: ':status)
	end
	ReturnValue=OleCallMethod(oleObj, "PrintFile", FILE)
	status=OleStatus()
	if status then
	   msg(@window,'OLE PrintFile Error code: ':status)
	end

This program has no error but nothing happened.

It looks so simple but it doesn't work.

I am still learning and I really need help.


At 14 FEB 2011 09:13AM Bob Carten wrote:

Yun -

Frank's post about ShellExecute is the best approach. Your shellExecute error might be a sympton of earlier virus infections on your machine. I looked on google, foound other people who have received this message and solved it by re-installing the dll. See

http://www.daniweb.com/forums/thread269828.html

- Bob


At 14 FEB 2011 05:39PM Yun Lee wrote:

Thank you Frank, Barry and Bob.

I will try more with those solutions.


At 28 FEB 2011 06:34PM Yun Lee wrote:

I rewrite my code to

rv=ShellExecuteA(hwnd, "open":\00\, Name:\00\, \00\, \00\, 0)

instead of

rv=ShellExecute(hwnd, "open":\00\, Name:\00\, \00\, \00\, 0)

It works. So it is ShellExecuteA not ShellExecute for 32bit(?)

Thanks everyone.

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/c73eaf6ee1b45b09852578240016481b.txt
  • Last modified: 2024/01/04 21:00
  • by 127.0.0.1