Htmlviewer Select All & Copy with Javascript

Here’s some old code that I was using way back… The Mac code still works, but not able to test the Windows and Linux code to see if they still work…

All of this gets added to a module

[code]Public Sub Copy(Extends viewer As HTMLViewer)
’ Copies the current selection inside the HTMLViewer to the clipboard.

#if TargetCocoa
Declare Sub copy Lib “Cocoa” Selector “copy:” (id As Integer, sender As Integer)
copy viewer.Handle, viewer.Handle

#elseif TargetLinux
Soft Declare Function gtk_bin_get_child Lib “libgtk” (bin As Integer) as Integer
Soft Declare Sub webkit_web_view_copy_clipboard Lib “libwebkitgtk-1.0.so” (web_view As Integer)
webkit_web_view_copy_clipboard(gtk_bin_get_child(viewer.Handle))

#elseif TargetWin32
DIM t_cef_browser As MemoryBlock = Ptr(viewer.Handle)
DIM t_get_focused_frame As NEW CefGetFocusedFrameDelegate(t_cef_browser.Ptr(80))
DIM t_cef_frame As MemoryBlock = Ptr(t_get_focused_frame.Invoke(t_cef_browser))
DIM t_cef_frame_copy As NEW CefFrameCopyDelegate(t_cef_frame.Ptr(28))
t_cef_frame_copy.Invoke(t_cef_frame)
#endif
End Sub
[/code]

Private Sub CefFrameCopyDelegate(p_cef_frame_t As Ptr)
Private Function CefGetFocusedFrameDelegate(p_cef_browser_t As Ptr) as Integer