INFORMATICA Y OCIO

Foros de informática
  Inicio    Normas    Buscar   Miembros   Clanes   Regístrese   Perfil   Conéctese para revisar sus mensajes   Conectarse 
[informatica] + [videos graciosos] + [ultimos mensajes] + [top usuarios] + [contacto]
VB - Nuevo boton en la barra de titulo

 
Publicar Nuevo Tema   Responder al Tema    Índice del Foro Foroz comunity :: Programación
Ver tema anterior :: Ver siguiente tema  
Autor Mensaje
DarkSigma
Conociendo Foroz
Conociendo Foroz


Registrado: 23 Sep 2004
Mensajes: 24

MensajePublicado: Vie Sep 24, 2004 3:28 am    Título del mensaje: VB - Nuevo boton en la barra de titulo Responder citando
Bueno tengo muchas de estas cosas asi que les dejo algunas (Codigos) espero y les sean utiles Wink:

Código:

' Add in a module this code:

Option Explicit

'*********************
'* API Declarations  *
'*********************
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As Rect) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook&) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

'*********************
'* Type Declarations *
'*********************
Private Type Rect
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Type CWPSTRUCT
    lParam As Long
    wParam As Long
    Message As Long
    hwnd As Long
End Type

Private MiaFormHandle As Long

'*********************
'* Consts            *
'*********************
Const WM_MOVE = &H3
Const WM_SETCURSOR = &H20
Const WM_NCPAINT = &H85
Const WM_COMMAND = &H111

Const SWP_FRAMECHANGED = &H20
Const GWL_EXSTYLE = -20

'*********************
'* Vars              *
'*********************
Private WHook&
Private ButtonHwnd As Long

Public Sub Init(MiaForm As Form, TestoPulsante As String)
    ' Handle della form
    MiaFormHandle = MiaForm.hwnd
    'Create the button that is going to be placed in the Titlebar
    ButtonHwnd& = CreateWindowEx(0&, "Button", TestoPulsante, &H40000000, 50, 50, 14, 14, MiaFormHandle, 0&, App.hInstance, 0&)
    'Show the button cause it´s invisible
    Call ShowWindow(ButtonHwnd&, 1)
    'Initialize the window hooking for the button
    WHook = SetWindowsHookEx(4, AddressOf HookProc, 0, App.ThreadID)
    Call SetWindowLong(ButtonHwnd&, GWL_EXSTYLE, &H80)
    Call SetParent(ButtonHwnd&, GetParent(MiaFormHandle))
End Sub

Public Sub Terminate()
    'Terminate the window hooking
    Call UnhookWindowsHookEx(WHook)
    Call SetParent(ButtonHwnd&, MiaFormHandle)
End Sub

Public Function HookProc&(ByVal nCode&, ByVal wParam&, Inf As CWPSTRUCT)
    Dim FormRect As Rect
    Static LastParam&
    If Inf.hwnd = GetParent(ButtonHwnd&) Then
        If Inf.Message = WM_COMMAND Then
            Select Case LastParam
                'If the LastParam is cmdInTitlebar call the Click-Procedure
                'of the button
                Case ButtonHwnd&: Call Screen.ActiveForm.cmdInTitlebar_Click
            End Select
        ElseIf Inf.Message = WM_SETCURSOR Then
            LastParam = Inf.wParam
        End If
        ElseIf Inf.hwnd = MiaFormHandle Then
        If Inf.Message = WM_NCPAINT Or Inf.Message = WM_MOVE Then
            'Get the size of the Form
            Call GetWindowRect(MiaFormHandle, FormRect)
            'Place the button int the Titlebar
            Call SetWindowPos(ButtonHwnd&, 0, FormRect.Right - 75, FormRect.Top + 6, 17, 14, SWP_FRAMECHANGED)
        End If
    End If
End Function

' Add in your form this code:

Private Sub Form_Load()
  Call Init(Me, "?")
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Call Terminate
End Sub

Public Sub cmdInTitlebar_Click()
  MsgBox "Ciao!", vbInformation
End Sub

' That's all! :)

_________________
.:: DarkSigma ::.

[Wenn Sie Hier Hineingehen... Sie Beloren Den Himmel...]

.:: SigmaSystem ::.
Volver arriba
Ver perfil del usuario Enviar mensaje privado
n3tsky
Forero
Forero


Registrado: 18 Sep 2004
Mensajes: 129
Ubicación: Mi Pc

MensajePublicado: Lun Oct 11, 2004 11:16 pm    Título del mensaje: Boton Responder citando
??? Question
_________________
I wanna be a Good Designer ! Wink
Volver arriba
Ver perfil del usuario Enviar mensaje privado Enviar correo Yahoo Messenger MSN Messenger
malder
Moderador
Moderador


Registrado: 10 Ene 2004
Mensajes: 4814
Ubicación: foroz de por vida

MensajePublicado: Mar Oct 12, 2004 12:38 am    Título del mensaje: Responder citando
creo que son codigos para el visual basic emm jeje esto a mi me suena a chino porq de programacion.... npi
_________________
Un titulo descriptivo te da mayor posibilidad a encontrar una buena ayuda.
Por favor lee las normas
Volver arriba
Ver perfil del usuario Enviar mensaje privado Enviar correo MSN Messenger
D_13
Conociendo Foroz
Conociendo Foroz


Registrado: 24 Sep 2004
Mensajes: 42

MensajePublicado: Mar Oct 12, 2004 7:24 am    Título del mensaje: Responder citando
es para seguridad en la conexion, o es para romper alguna seguridad o vulnereabilidad ???? (creo q es para lo segundo) pero no sep en donde o como se los usa, es un código para crearlo como ejecutable ?? pero de ley los guardo porq pueden servir pa luego , uno nunca sabe.... esta bueno Dark Sigma si tienes alguno para pass te lo agradecería...
_________________
la informacion debe ser libre para todos, si la tienes y no la compartes... ¿por qué estás aqui?
busca tu destino y síguelo hasta el último byte....
Volver arriba
Ver perfil del usuario Enviar mensaje privado Enviar correo Visitar sitio web del autor MSN Messenger
ExTeRnAl
Moderador
Moderador


Registrado: 24 Mar 2004
Mensajes: 2526
Ubicación: Montevideo - Uruguay

MensajePublicado: Mar Oct 12, 2004 8:07 am    Título del mensaje: Responder citando
malder escribió:
creo que son codigos para el visual basic emm jeje esto a mi me suena a chino porq de programacion.... npi


Chino basico le diria yo Razz

Salu2
_________________
Volver arriba
Ver perfil del usuario Enviar mensaje privado Visitar sitio web del autor Dirección AIM Yahoo Messenger
Hackimail
Yo soy el foro
Yo soy el foro


Registrado: 09 Jul 2004
Mensajes: 1412

MensajePublicado: Mar Oct 12, 2004 8:31 am    Título del mensaje: Responder citando
ExTeRnAl escribió:
malder escribió:
creo que son codigos para el visual basic emm jeje esto a mi me suena a chino porq de programacion.... npi


Chino basico le diria yo Razz

Salu2
esque lo que pasa es que no sabes visual........bueno ese codigo es para hacer tipo las opciones que estan abajo de la barra de titulo archivo,ayuda,herramientas,ventana etc etc
_________________
puto el que me edite los posts
Volver arriba
Ver perfil del usuario Enviar mensaje privado Yahoo Messenger
Link
Forero
Forero


Registrado: 07 Sep 2004
Mensajes: 123

MensajePublicado: Sab Oct 16, 2004 8:43 am    Título del mensaje: Responder citando
en realidad sirve para ponser un boton con signo de interrogante en la barra de titulo...al lado de minimizar, maximizar y cerrrar o la x que todas las ventanas tienen
Volver arriba
Ver perfil del usuario Enviar mensaje privado Enviar correo Visitar sitio web del autor MSN Messenger
Link
Forero
Forero


Registrado: 07 Sep 2004
Mensajes: 123

MensajePublicado: Sab Oct 16, 2004 8:45 am    Título del mensaje: Responder citando
muchisimas gracias DarkSigma, realmente sirven tus posts..me ayudaron bastante ...si puedes de cuando en cuando postear cosas como estas te lo agradeceria mucho...
bueno saludos y gracias otra vez
Volver arriba
Ver perfil del usuario Enviar mensaje privado Enviar correo Visitar sitio web del autor MSN Messenger
suko
Yo soy el foro
Yo soy el foro


Registrado: 14 Sep 2004
Mensajes: 809
Ubicación: España.

MensajePublicado: Mie Nov 03, 2004 4:31 am    Título del mensaje: Responder citando
weno supongo ke ese codigo sirve para añadir un boton en la barra de titulo de la appz...y se le podria poner cualkier funcion....no??

se poko de VB...casi nada
_________________
Si no intentas grandes cosas, nunca las conseguiras.

[url=http://www.mundowarezweb.com]

Entra a MuNDowAREzwEB.CoM / Elinks / Torrents / Emule / Bittorrent[/url]
Volver arriba
Ver perfil del usuario Enviar mensaje privado Enviar correo Visitar sitio web del autor MSN Messenger
Mostrar mensajes anteriores:   
Publicar Nuevo Tema   Responder al Tema    Índice del Foro Foroz comunity :: Programación Todas las horas están en GMT + 1 Hora
Página 1 de 1
Saltar a:  
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
 
Articulos relacionados
En Internet >> Borrar el historial de la barra de di...
En Hardware >> Mi pc se enciende pero no arranca, bo...
En Off topic >> De Nuevo, PillaoZ 2008
En Hardware >> Nuevo Record personal en OC en Pentiu...
En Música/General >> Adolescentes -Lo Nuevo Y Lo Mejor
 

 
Foroz comunity Tema RSS 




by phpBB  
informatica Videos graciosos webmasters theme by Scott Stubblefield Top foroz