Clipper On Line • Ver Tópico - Prender janela console/GUI dentro de janela GUI

Prender janela console/GUI dentro de janela GUI

Aqui você poderá oferecer suas Contribuições, Dicas e Tutoriais (Texto ou Vídeo) que sejam de interesse de todos.

Moderador: Moderadores

 

Prender janela console/GUI dentro de janela GUI

Mensagempor dbsh » 05 Dez 2021 09:41

Testado com QT 4.8.7, deve funcionar na 5
Acredito de deva funcionar com outras GUI
Se faltar alguma função, ou duvidas, na medida do possível estou a disposição.

OBS:
Crie as janelas da forma que você sempre criou depois execute:
windows api ...


#command WINDOWS API <dll: USER, KERNEL, ADVAPI> <f> PARAMETRO <list,...> [TO <var>] => ;
   [var> := ]wapi_32( #<dll>, <(f)>[, <list>])

//windows api user SetParent parametro WinId(), WinId(QMainWindowGet():MdiArea)
windows api user SetParent parametro WinId(), WinId(QMainWindowGet())

/*
User = DLL Windows
SetParent = Method/Propriedade/Funcao da DLL
WinId = Parametro para "SetParent"
*/

FUNCTION wapi_32( nDll, sFuncao, ... )
LOCAL hHandleDll, uVar, sDll

DO CASE
CASE ValType( nDll ) = "C"
    sDll := nDll
    IF !'.DLL' $ Upper(sDll)
       IF Right(sDll, 2) = '32'
          sDll += '.dll'
       ELSE
          sDll += '32.dll'
       ENDIF
    ENDIF
CASE nDll == WAPI_USER32
    sDll := "user32.dll"
CASE nDll == WAPI_KERNEL32
    sDll := "kernel32.dll"
CASE nDll == WAPI_ADVAPI32
    sDll := "advapi32.dll"
OTHERWISE
    sDll := ''
ENDCASE

IF Empty( sDll )
   RETURN NIL
ENDIF

hHandleDll := hb_LibLoad( sDll )
uVar := hb_DynCall( { sFuncao, hHandleDll, HB_DYN_CALLCONV_STDCALL }, ... )
hb_LibFree( hHandleDll )

RETURN uVar

FUNCTION WinId( uId )
LOCAL nId

IF ValType(uId) = 'O'
   IF __ObjhasData(uId, 'WINID') .or. __ObjhasMsg(uId, 'WINID')
      nId := uId:WinId()
   ELSEIF __ObjhasData(uId, 'HWND') .or. __ObjhasMsg(uId, 'HWND')
      nId := uId:hWnd()
   ELSE
      nId := 0
   ENDIF
ELSEIF Empty( uId )
   nId := Wvt_GetWindowHandle()
ELSEIF ValType(uId) = 'N'
   nId := uId
ENDIF

RETURN nId

FUNCTION ConsoleWinPoint( nHandle )
LOCAL pWnd

DEFA nHandle TO WinId()

pWnd := win_N2P( nHandle )

RETURN pWnd

FUNCTION QAppGet( lExclui )
STATIC oApp
LOCAL oFont

IF !Empty( lExclui )
   oApp := NIL
   RETURN NIL
ENDIF

IF oApp = NIL
    oApp := QApplication()
    //oApp:InstallEventFilter( QObject() )

    addVar(oApp, 'Licenciado', clsVar())
    oApp:Licenciado:AddVar('RazaoSocial', 'Demonstracao')
    oApp:Licenciado:AddVar( 'Fantasia', 'Demonstracao')
    oApp:Licenciado:AddVar( 'CNPJ', '99.999.999/9999-99')
/*
    nFont := Val(IniRead('Fonte', 'App', '0'))
    IF Empty(nFont) .or. nFont > 72
      nFont := Int(oApp:DeskTop():availableGeometry():Width / 128)
      IF nFont > Int(oApp:DeskTop():availableGeometry():Height / 50)
        nFont := (oApp:DeskTop():availableGeometry():Height / 50)
      ENDIF
      IF nFont > 72
          nFont := 72
      ENDIF
      IF nFont < 6
          nFont := 6
      ENDIF
    ENDIF
*/
    oFont := QFont( _FONTE_FAMILY_ )
    oApp:SetFont( oFont )
ENDIF

RETURN oApp

FUNCTION QMainWindowGet( oMain )
STATIC oMainWindow := NIL

IF !Empty( oMain )
    oMainWindow := oMain
ELSEIF oMainWindow = NIL
   oMainWindow:= QMainWindow():New( QAppGet() )

/*
   oMainWindow:GT := 'QT'
   oMainWindow:Janelas := {}
   oMainWindow:MdiArea := QMdiArea(oMainWindow)
   oMainWindow:MdiArea:setStyleSheet("background:transparent;")
   oMainWindow:MdiArea:setAttribute(Qt_WA_TranslucentBackground)
   oMainWindow:MdiArea:SetBackground(QBrush(Qt_transparent))
   oMainWindow:MdiArea:SetHorizontalScrollBarPolicy(Qt_ScrollBarAsNeeded) //Qt_ScrollBarAsNeeded, Qt_ScrollBarAlwaysOff, Qt_ScrollBarAlwaysOn
   oMainWindow:MdiArea:SetVerticalScrollBarPolicy(Qt_ScrollBarAsNeeded)
   oMainWindow:MdiArea:setTabsClosable(.T.)
   oMainWindow:MdiArea:settabsMovable(.T.)
   oMainWindow:setCentralWidget(oMainWindow:MdiArea)
   //oMainWindow:MdiArea:SubWindowView()  // setViewMode(0) Exibir sub-janelas com caixilhos de janelas (padrão).
   //oMainWindow:MdiArea:TabbedView()     // setViewMode(1) Exibir sub-janelas com guias em uma barra de abas.
   oMainWindow:MdiArea:setViewMode(0)
   oMainWindow:_Done := 0
   oMainWindow:ShowMaximized()
   //QMainWindow.iconSize ( self )
   //QMainWindow.createPopupMenu ( self )
   //QMainWindow.tabPosition ( self , área Qt.DockWidgetArea  )
   //QMainWindow.setTabPosition ( self , Qt.DockWidgetAreas  areas , QTabWidget.TabPosition  tabPosition )
*/

ENDIF

RETURN oMainWindow

010011110010000001110011011101010110001101100101011100110111001101101111001000001110100100100000011000110110111101101110011100110111010001110010011101011110110101100100011011110010000001100001001000000110111001101111011010010111010001100101
01001101011000010111001001100011011011110111001100100000010000010110111001110100011011110110111001101001011011110010000001000100011001010010000001000010011011110110111001101001
0101010001100101011011000011101000100000001010000011001000110111001010010011100100101101001110010011100000110100001100110010110100110101001100100011100100110000
Avatar de usuário

dbsh
Usuário Nível 3

Usuário Nível 3
 
Mensagens: 115
Data de registro: 14 Jul 2004 14:19
Cidade/Estado: ES
Curtiu: 2 vezes
Mens.Curtidas: 15 vezes



Retornar para Contribuições, Dicas e Tutoriais

Quem está online

Usuários vendo este fórum: Nenhum usuário registrado online e 21 visitantes


Ola Amigo, espero que meu site e forum tem lhe beneficiado, com exemplos e dicas de programacao.
Entao divulgue o link da Doacao abaixo para seus amigos e redes sociais ou faça uma doacao para o site forum...
MUITO OBRIGADO PELA SUA DOACAO!
Faça uma doação para o forum
cron
v
Olá visitante, seja bem-vindo ao Fórum Clipper On Line!
Efetue o seu login ou faça o seu Registro