Page 2 of 2

Posted: Sat Aug 13, 2005 4:34 am
by Truth_Seeker
I found the way to delete.

Code: Select all

CmdTarget\Exec(?CGID_MSHTML, #idm_delete, #olecmdexecopt_dontpromptuser, 0, 0)
I get the feeling that doing things with tables and the rest is going to be hard. If you have some good links to documentation, I would really appreciate it :).

Posted: Sat Aug 13, 2005 4:37 am
by Ziltch
I just did some web searchs and I have installed the MS PSDKfor MS server 2003 sp1 . It covers all MS o/s not just 2003 as it name suggests. It helped figuring out the Constants.

http://www.microsoft.com/downloads/deta ... laylang=en

Posted: Sat Aug 13, 2005 7:09 am
by Truth_Seeker
Well I can delete things, using a button but it is like the webgadget blocks the actualy Delete key. Even if I set up a keyboardshortcut, the gadge still blocks the delete key. Anyone know why or how to fix it?

Posted: Sat Aug 13, 2005 1:50 pm
by Ziltch
Have you tried

Code: Select all

If GetAsyncKeyState_(#VK_DELETE)
 .....
Endif 
This method works for me.

Posted: Sat Aug 13, 2005 3:14 pm
by Truth_Seeker
No, I have not but that would be global even if my program is not active. Correct?

Posted: Sat Aug 13, 2005 4:11 pm
by Truth_Seeker

Code: Select all

      If GetForegroundWindow_() = WindowID(0)
        If GetAsyncKeyState_(#VK_DELETE)
        
          CmdTarget\Exec(?CGID_MSHTML, #idm_delete, #olecmdexecopt_dontpromptuser, 0, 0)
        EndIf
      EndIf
This seems to fix the problem.

But now the problem is that it deletes too much at a time.

Here is the total source with the above added:

Code: Select all

Enumeration 1 
  #olecmdid_open          
  #olecmdid_new        
  #olecmdid_save          
  #olecmdid_saveas            
  #olecmdid_savecopyas    
  #olecmdid_print        
  #olecmdid_printpreview        
  #olecmdid_pagesetup        
  #olecmdid_spell            
  #olecmdid_properties  
  #olecmdid_cut          
  #olecmdid_copy        
  #olecmdid_paste            
  #olecmdid_pastespecial    
  #olecmdid_undo            
  #olecmdid_redo          
  #olecmdid_selectall        
  #olecmdid_clearselection 
  #olecmdid_zoom            
  #olecmdid_getzoomrange      
  #olecmdid_updatecommands  
  #olecmdid_refresh            
  #olecmdid_stop              
  #olecmdid_hidetoolbars      
  #olecmdid_setprogressmax    
  #olecmdid_setprogresspos  
  #olecmdid_setprogresstext    
  #olecmdid_settitle          
  #olecmdid_setdownloadstate  
  #olecmdid_stopdownload    
  #olecmdid_ontoolbaractivated 
  #olecmdid_find 
  #olecmdid_delete 
  #olecmdid_httpequiv 
  #olecmdid_httpequiv_done 
  #olecmdid_enable_interaction 
  #olecmdid_onunload 
  #olecmdid_propertybag2 
  #olecmdid_prerefresh 
  #olecmdid_showscripterror 
  #olecmdid_showmessage 
  #olecmdid_showfind 
  #olecmdid_showpagesetup 
  #olecmdid_showprint 
  #olecmdid_clos 
  #olecmdid_allowuilesssaveas 
  #olecmdid_dontdownloadcss 
  #olecmdid_updatepagestatus 
  #olecmdid_print2 
  #olecmdid_printpreview2 
  #olecmdid_setprinttemplate 
  #olecmdid_getprinttemplate 
  #olecmdid_pageactionblocked      = 55; no 53 or 54 
  #olecmdid_pageactionuiquery      
  #olecmdid_focusviewcontrols      
  #olecmdid_focusviewcontrolsquery 
  #olecmdid_showpageactionmenu    
EndEnumeration 

Enumeration 0 
  #olecmdexecopt_dodefault      
  #olecmdexecopt_promptuser        
  #olecmdexecopt_dontpromptuser    
  #olecmdexecopt_showhelp        
EndEnumeration 


Enumeration 
  #idm_alignbottom              
  #idm_alignhorizontalcenters  
  #idm_alignleft                
  #idm_alignright              
  #idm_aligntogrid              
  #idm_aligntop                
  #idm_alignverticalcenters    
  #idm_arrangebottom            
  #idm_arrangeright            
  #idm_bringforward            
  #idm_bringtofront            
  #idm_centerhorizontally      
  #idm_centervertically        
  #idm_code                    
  #idm_delete     =17              
  #idm_fontname                
  #idm_fontsize                
  #idm_group                    
  #idm_horizspaceconcatenate    
  #idm_horizspacedecrease      
  #idm_horizspaceincrease      
  #idm_horizspacemakeequal      
  #idm_insertobject            
  #idm_multilevelredo     =30      
  #idm_sendbackward        =32      
  #idm_sendtoback              
  #idm_showtable                
  #idm_sizetocontrol            
  #idm_sizetocontrolheight      
  #idm_sizetocontrolwidth      
  #idm_sizetofit                
  #idm_sizetogrid              
  #idm_snaptogrid              
  #idm_taborder                
  #idm_toolbox                  
  #idm_multilevelundo      =44    
  #idm_ungroup                
  #idm_vertspaceconcatenate    
  #idm_vertspacedecrease        
  #idm_vertspaceincrease        
  #idm_vertspacemakeequal      
  #idm_justifyfull              
  #idm_backcolor                
  #idm_bold                    
  #idm_bordercolor              
  #idm_flat                    
  #idm_forecolor                
  #idm_italic                  
  #idm_justifycenter            
  #idm_justifygeneral          
  #idm_justifyleft              
  #idm_justifyright            
  #idm_raised                  
  #idm_sunken                  
  #idm_underline                
  #idm_chiseled                
  #idm_etched                  
  #idm_shadowed                
  #idm_find                    
  #idm_showgrid               = 69 
EndEnumeration 
#idm_2d_position = 2394 

;#msocmdexecopt_dodefault = 0 
Debug "#IDM_BOLD  = "+Str(#idm_bold ) 

If OpenWindow(0, 0, 0, 640, 480, #PB_Window_ScreenCentered|#PB_Window_SystemMenu, "WebGadget Edit") 
  If CreateGadgetList(WindowID())  
    
    WebGadget(0, 5, 5, 630, 340, "www.google.com") 
    ButtonGadget(1, 5, 350, 100, 25, "Bold") 
    ButtonGadget(2, 110, 350, 100, 25, "Test")
    ButtonGadget(3, 210, 350, 100, 25, "Delete")
    
    ; get webgadgets IWebBrowser2 interface: 
    Browser.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA)    
    
    ; wait For page To be loaded.. 
    Repeat 
      While WindowEvent(): Wend 
      Delay(1) 
      Browser\get_Busy(@IsBusy.l) 
    Until IsBusy = 0 
    
    ; get the document interface 
    If Browser\get_Document(@DocumentDispatch.IDispatch) = #S_OK 
      
      ; query For IHTMLDocument3: 
      If DocumentDispatch\QueryInterface(?IID_IHTMLDocument2, @Document.IHTMLDocument2) = #S_OK 
        
        ; here you have a IHTMLDocument2 pointer,  can work with it... 
        Document\put_designMode(Ansi2Uni("On")) ;Turns on Edit Mode 
        CmdTarget.IOleCommandTarget 
        If DocumentDispatch\QueryInterface(?IID_IOleCommandTarget, @CmdTarget.IOleCommandTarget) = #S_OK 
          
          CmdTarget\Exec(?CGID_MSHTML, #idm_2d_position, #olecmdexecopt_dontpromptuser, @var, NULL) ;Lets you drag  drop items 
          ; CmdTarget\Release() 
        EndIf 
        
        Document\Release() 
      EndIf 
      
      DocumentDispatch\Release()    
    EndIf 
    
    vb.l 
    
    Repeat 
      EventID = WaitWindowEvent() 
      
      If EventID = #PB_Event_Gadget ;checks For the events 
        Select EventGadgetID() ;Checks For Gadget Events 
          Case 0 
            
            Debug "Web Gadget " 
            
          Case 1 
            Debug "bold button " 
            ;Document\execCommand(Ansi2Uni("Delete"), #False, #Null, @vOut) 
            CmdTarget\Exec(?CGID_MSHTML, #idm_bold,#olecmdexecopt_dontpromptuser  , 0, 0) 
            ; Document\execCommand(Ansi2Uni("Bold"), #False, #Null, @vOut)      
            
          Case 2 
            Debug "test button " 
            Document\queryCommandState(Ansi2Uni("Bold"), @vb) 
            MessageRequester("Bold State", Str(vb)) 
            
          Case 3
            Debug "delete button "
            CmdTarget\Exec(?CGID_MSHTML, #idm_delete, #olecmdexecopt_dontpromptuser, 0, 0)
            
        EndSelect 
      EndIf
      
      If GetForegroundWindow_() = WindowID(0)
        If GetAsyncKeyState_(#VK_DELETE)
        
          CmdTarget\Exec(?CGID_MSHTML, #idm_delete, #olecmdexecopt_dontpromptuser, 0, 0)
        EndIf
      EndIf
      
    Until EventID = #PB_EventCloseWindow 
    If CmdTarget 
      CmdTarget\Release() 
    EndIf 
  EndIf 
EndIf 

End 


DataSection 

IID_IHTMLDocument2:  ; {332c4425-26cb-11d0-b483-00c04fd90119} 
Data.l $332C4425 
Data.w $26CB, $11D0 
Data.b $B4, $83, $00, $C0, $4F, $D9, $01, $19 

IID_IOleCommandTarget:  ; {b722bccb-4e68-101b-a2bc-00aa00404770} 
Data.l $B722BCCB 
Data.w $4E68, $101B 
Data.b $A2, $BC, $00, $AA, $00, $40, $47, $70
 
CGID_MSHTML: ; { 0xDE4BA900, 0x59CA, 0x11CF, { 0x95, 0x92, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } } 
Data.l $DE4BA900 
Data.w $59CA, $11CF 
Data.b $95, $92, $44, $45, $53, $54, $00, $00 
EndDataSection

Posted: Mon Aug 21, 2006 12:01 am
by Dare
Hey, great stuff here guys!