Página 1 de 1

Possibilidades Interessantes

Enviado: 31 Mar 2017 23:44
por asimoes
Um janela Dialog com uma chamada para Youtube
Screen Shot 03-31-17 at 11.42 PM.PNG

Possibilidades Interessantes

Enviado: 01 Abr 2017 09:52
por JoséQuintas
Fica interessante.
E dá pra fazer com qualquer LIB, até mesmo GTWVG.

Possibilidades Interessantes

Enviado: 03 Abr 2017 12:18
por sygecom
Asimoes,
Você está usando activex da Hwgui? Está usando em uma dialog comum, ou em uma MAIN MDI ?

Possibilidades Interessantes

Enviado: 03 Abr 2017 14:05
por JoséQuintas
Só pra refrescar a memória... rs

https://pctoledo.org/forum/viewto ... ex#p107313
Na prática é um recurso do Windows.
Ao criar uma janela e atribuir a classe atlaxwin, ela permite activex.
E ao colocar o nome de um arquivo, o Windows abre o que estiver associado à extensão do arquivo.

Possibilidades Interessantes

Enviado: 03 Abr 2017 18:21
por asimoes
Estou usando uma dialog usando activex classe HHtml()

Possibilidades Interessantes

Enviado: 15 Abr 2017 18:24
por asimoes
Caixa de Mensagem para utilizações diversas.

Função adaptada da MiniGUi

Código: Selecionar todos

nOpcao := ::MsgOptions( "Selecione um botão para impressão", "Atenção", oIcon, "P:\GERAL\HARBOUR\PRINTER.bmp", {"&Tela", "&Impressora", "&Abandonar"}, 3, 60)
Screen Shot 04-15-17 at 06.14 PM.PNG

Código: Selecionar todos

METHOD MsgOptions( cText, cTitle, oIcon, cImage, aOptions, nDefaultOption, nSeconds ) CLASS ClPrincipal
LOCAL nItem, nBtnWidth:=0, aBtn:=Array( Len( aOptions ) ), aImgInfo
LOCAL nBtnPosX:=10, nBtnPosY:=85
LOCAL oSay1, nWidth, nHeight, nStyle
   
   MEMVAR cOption
   
   cOption:="_"

   DEFAULT cText           TO "Selecione uma opção"
   DEFAULT cTitle          TO "Opções Disponíveis"
   DEFAULT oIcon           TO "Opcao.ico"
   DEFAULT cImage          TO ""
   DEFAULT nDefaultOption  TO 1
   DEFAULT nSeconds        TO 0

    WITH Object oBmp1 := HBitmap():AddFile( cImage,,, nWidth, nHeight )
      nWidth  := :nWidth
      nHeigth := :nHeight
   END
  
   _Font_Options := HFont():Add( "Tahoma", 0, -13, 550 ) //HFont():Add( "Tahoma", 9 )
   
   FOR EACH nItem IN aOptions
      aOptions[nItem:__EnumIndex] := AllTrim( aOptions[nItem:__EnumIndex] )
      nBtnWidth := Max( GetTextWidth(, aOptions[nItem:__EnumIndex], _Font_Options:handle), nBtnWidth )
   NEXT
      
   nBtnWidth += 5

   nStyle  := WS_POPUP + WS_VISIBLE + WS_CAPTION + DS_CENTER + WS_SYSMENU 
   
   oObjeto := ClPrincipal():New()
   

   INIT DIALOG _Options ;
        TITLE      cTitle ;
        AT         0, 0  ;
        SIZE       ( Len( aOptions ) * ( 10 + nBtnWidth ) ) + 10, 155 ;
        ICON       oIcon ;
        FONT       _Font_Options ;
        CLIPPER ;
        STYLE      nStyle 
        IF hb_FileExists( cImage ) 
           @ 10, 20 BITMAP Bitmap SHOW cImage STRETCH 0 SIZE nWidth, nHeight 
           @ 50, 30 SAY oLabel ;
                    CAPTION cText ;
                    FONT _Font_Options ;
                    SIZE _Options:nWidth - 55, 80 ;
                    COLOR hwg_RGB( 0, 0, 255 ) ;
                    STYLE ES_LEFT
        ELSE
           @ 10, 30  SAY oLabel ;
                     CAPTION cText ;
                     FONT _Font_Options ;
                     SIZE  _Options:nWidth - 55, 30 ;
                     STYLE SS_LEFT 
      ENDIF
                 
      FOR EACH nItem IN aOptions
         aBtn[nItem:__EnumIndex]:="_Btn_" + hb_NtoS( nItem:__EnumIndex )
         cOption_ := aBtn[nItem:__EnumIndex]
         @ nBtnPosX, _Options:nHeight - 35 BUTTONEX &cOption_. ;
                                           CAPTION  aOptions[nItem:__EnumIndex]  ;
                                           FONT _Font_Options ;
                                           ON CLICK { || cOption := oObjeto:PegaOpcao( &cOption_.:Name, @cOption ), ;
                                                         hwg_EndDialog(_Options:handle) } ;
                                           SIZE     nBtnWidth, 25 
         nBtnPosX += nBtnWidth + 10
      NEXT

      _Options:nInitFocus := &( aBtn[nDefaultOption] )
      
      IF nSeconds > 0
         ::Liga_Timer( _Options , .T., nSeconds * 1000, { || cOption := aOptions[nDefaultOption], hwg_EndDialog(_Options:handle) }, "oTimerOptions" )
      ENDIF
      
      
   
   ACTIVATE DIALOG _Options
  
RETURN aScan( aOptions, AllTrim( cOption ) )

METHOD PegaOpcao( cCaption, cOpcao ) CLASS ClPrincipal
   cVar := cCaption + ":Caption"
   cOpcao := &cVar.
RETURN cOpcao

METHOD Liga_Timer( oJanela, lLiga, nTime, bBlock, oTimer ) CLASS ClPrincipal
   IF lLiga
      SET TIMER &oTimer. of oJanela VALUE nTime ACTION bBlock
   ELSE
      oJanela:&oTimer.:End()   
   ENDIF
RETURN Nil

#pragma BEGINDUMP

#include <windows.h>
#include "hbapi.h"
#include <olectl.h>
#include <time.h>

HB_FUNC( GETTEXTWIDTH ) // returns the width of a string in pixels
{
   HDC   hDC        = ( HDC ) hb_parnl( 1 );
   HWND  hWnd       = ( HWND ) NULL;
   BOOL  bDestroyDC = FALSE;
   HFONT hFont      = ( HFONT ) hb_parnl( 3 );
   HFONT hOldFont   = ( HFONT ) NULL;
   SIZE  sz;

   if( ! hDC )
   {
      bDestroyDC = TRUE;
      hWnd       = GetActiveWindow();
      hDC        = GetDC( hWnd );
   }

   if( hFont )
      hOldFont = ( HFONT ) SelectObject( hDC, hFont );

   GetTextExtentPoint32( hDC, hb_parc( 2 ), hb_parclen( 2 ), &sz );

   if( hFont )
      SelectObject( hDC, hOldFont );

   if( bDestroyDC )
      ReleaseDC( hWnd, hDC );

   hb_retnl( sz.cx );
}
#pragma ENDDUMP

Possibilidades Interessantes

Enviado: 16 Abr 2017 13:30
por JoséQuintas
Só lembrando:

Com a allgui mostrei que dá pra misturar gtwvg, hwgui, e qualquer das hmgs...

Então, qualquer coisa daria pra usá-los diretamente.

:))