Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save an image from the clipboard
Message
From
30/09/2008 14:48:58
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01349799
Message ID:
01351886
Views:
22
Which means that IE's caption will also be the same, I guess? Like when you go to Universal Thread, IE will always show "Universal Thread" in the upper left corner of the browser.

I regularly use some functions which checks whether IE is open and at the right URL. If not, IE is started and navigated to the right URL. My customers love it, since they don't have to do things manually. In my case I also check whether my users are logged in at the websites also, and if not, my code logs them in via automation. This is some of teh code I use, without the login code
Local lnTime,lTest, llAlredyup
lnTime=1200 && 12 seconds
lox=.Null.
Release lox
Public lox
oShell = Createobject("Shell.Application")
&& A collection of the open windows that belong to the Shell
oShellWindows = oShell.Windows
For Each oIE In oShellWindows
   If "IEXPLORE.EXE" $ Justfname(Upper(oIE.FullName))
      If 'YOURCOMPANY'$Upper(oIE.LocationName)
         lox=oIE
         llAlredyup=.T.
         Exit 
      Endif
   Endif
Endfor
oShellWindows = Null
oShell = Null
If !llAlredyup And Vartype(lox)#'O'
   lox=Createobject('internetexplorer.application')
   lox.Navigate('http://.......')
   lox.Visible=.T.
   Wait 'navigates!' Window Nowait
   If !NavComplete(lox,lnTime)
      ??Chr(7)
      Wait 'Timeout error!' Window
      lox.Visible=.F.
      Release lox
      Return
   Endif
   Wait Clear
Endif
*****************************************************************************
Function NavComplete
   Lpara toIE, tnTimeout
   lnTimeout=Iif( Type("tnTimeout")="N",tnTimeout ,60 )
   lnTimeElapsed=0
   lnStartSeconds=Seconds()
   Do While .T.
      If toIE.ReadyState=4
         Do While .T.
            If toIE.Document.ReadyState="complete"
               Return .T.
            Endif
            If (Seconds()-lnStartSeconds)>lnTimeout
               Return .F.
            Endif
         Enddo
      Endif
      If (Seconds()-lnStartSeconds)>lnTimeout
         Return .F.
      Endif
   Enddo
Endfunc
>What actually happens is that the operators answer a phone call and get insurance details. They then can go online and verify the details on the website. What they need now is a snapshot of the page at that time. It is always the same page as far as i know just different contents.
>~M
>
>>Do you always capture pictures from the same homepage? If so, I suggest this code, which is a modified version of some code Sergey gave me earlier:
>>Release lox
>>Public lox
>>oShell = Createobject("Shell.Application")
>>&& A collection of the open windows that belong to the Shell
>>oShellWindows = oShell.Windows
>>For Each oIE In oShellWindows
>>   If "IEXPLORE.EXE" $ Justfname(Upper(oIE.FullName))
>>      If 'YOURNAME'$Upper(oIE.LocationName) && Change YOURNAME to IE's caption for the relevant homepage
>>         lox=oIE
>>         Exit 
>>      Endif
>>   Endif
>>Endfor
>>oShellWindows = Null
>>oShell = Null
>>gdip = CreateObject("gpInit")
>>img = CreateObject("gpImage")
>>img.Capture(lox.HWND)
>>img.SaveAsJPEG("123456")
>>
>>
>>
>>>I have the code below but while it works on my pc it does not on the customers. They have the same version of internet explorer and are using the same version of my application that i am. When i do this i get a screen shot of the internet explorer page while they get a screen shot of the application. any ideas?
>>>
>>>Set Procedure To gpImage Additive
>>>Declare Long FindWindow in Win32API String ClassName, String WindowName
>>>gdip = CreateObject("gpInit")
>>>img = CreateObject("gpImage")
>>>abc = findwindow("IEFrame",NULL)
>>>img.Capture(abc)
>>>img.SaveAsJPEG("123456")
>>>
>>>~M
>>>
>>>>Requires GPIMAGE, http://gpimage2.googlepages.com/
>>>>
>>>>Function saveclipasjpg
>>>>   Lparameters cFilename
>>>>   Local llReturn, GDIP, img
>>>>   If Pcount()=0 Or Vartype(cFilename)#'C'
>>>>      cFilename="ClipImage"
>>>>   Endif
>>>>   cFilename=Forceext(cFilename,'jpg')
>>>>   Erase (cFilename)
>>>>   If clipIsImage() &&Len(_cliptext)=0
>>>>      #include gpimage.h
>>>>      If Not "GPIMAGE" $ Set("Procedure")
>>>>         Set Procedure To gpimage Additive
>>>>      Endif
>>>>      GDIP = Createobject("gpInit")
>>>>      img = Createobject("gpImage")
>>>>      img.FromClipboard()
>>>>      img.saveAsJpeg(cFilename)
>>>>*!*      Release gdip
>>>>*!*      Release img
>>>>   Endif
>>>>   Return filesize(cFilename)>0
>>>>*************************************************************************************************
>>>>Function clipIsImage
>>>>   #Define CF_BITMAP           2
>>>>   Declare short IsClipboardFormatAvailable In win32api Integer cbformat
>>>>   Return IsClipboardFormatAvailable(CF_BITMAP)#0
>>>>*************************************************************************************************
>>>>Function filesize
>>>>   Lparameters lcFileName
>>>>   Local lnReturn,lnAsize
>>>>   Local Array laDummy(1)
>>>>   lnReturn=0
>>>>   lnAsize=Adir(laDummy,lcFileName)
>>>>   Do Case
>>>>      Case lnAsize=1 && Only one match, our goal
>>>>         lnReturn=laDummy(2)
>>>>      Case lnAsize=0 && No match
>>>>         lnReturn=0
>>>>      Otherwise     && More than one match
>>>>         lnReturn=-1
>>>>   Endcase
>>>>Return lnReturn
>>>>
>>>>
>>>>
>>>>>hi all,
>>>>>I have an image ont he clipboard, i can go into paint and paste it in there, but what i want to do is have a button on the form and save the image as a predetermined file name, is this possible?
>>>>>~M
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform