Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: vbgedo en Julio 14, 2014, 08:29:10 pm
-
Hola Encontré este código a través de este tema
http://leandroascierto.com/foro/index.php?topic=2298.0 (http://leandroascierto.com/foro/index.php?topic=2298.0)
Option Explicit
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateDIBSection Lib "gdi32.dll" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByRef lplpVoid As Any, ByVal handle As Long, ByVal dw As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32.dll" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function SetWindowPos Lib "user32.dll" (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 GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
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 UpdateLayeredWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal hdcDst As Long, pptDst As Any, psize As Any, ByVal hdcSrc As Long, pptSrc As Any, ByVal crKey As Long, ByRef pblend As BLENDFUNCTION, ByVal dwFlags As Long) As Long
Private Declare Function GdipCreateFromHDC Lib "gdiplus" (ByVal hdc As Long, graphics As Long) As Long
Private Declare Function GdipDeleteGraphics Lib "gdiplus" (ByVal graphics As Long) As Long
Private Declare Function GdipDrawImageRect Lib "gdiplus" (ByVal graphics As Long, ByVal image As Long, ByVal x As Single, ByVal y As Single, ByVal Width As Single, ByVal Height As Single) As Long
Private Declare Function GdipLoadImageFromFile Lib "gdiplus" (ByVal filename As String, image As Long) As Long
Private Declare Function GdipGetImageWidth Lib "gdiplus" (ByVal image As Long, Width As Long) As Long
Private Declare Function GdipGetImageHeight Lib "gdiplus" (ByVal image As Long, Height As Long) As Long
Private Declare Function GdipDisposeImage Lib "gdiplus" (ByVal image As Long) As Long
Private Declare Function GdiplusStartup Lib "gdiplus" (gToken As Long, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As Long
Private Declare Sub GdiplusShutdown Lib "gdiplus" (ByVal gToken As Long)
Private Type BLENDFUNCTION
BlendOp As Byte
BlendFlags As Byte
SourceConstantAlpha As Byte
AlphaFormat As Byte
End Type
Private Type Size
cx As Long
cy As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors() As Long
End Type
Private Type GdiplusStartupInput
GdiplusVersion As Long
DebugEventCallback As Long
SuppressBackgroundThread As Long
SuppressExternalCodecs As Long
End Type
Private Const ULW_ALPHA As Long = &H2
Private Const DIB_RGB_COLORS As Long = 0
Private Const AC_SRC_ALPHA As Long = &H1
Private Const AC_SRC_OVER As Long = &H0
Private Const WS_EX_LAYERED As Long = &H80000
Private Const GWL_EXSTYLE As Long = -20
Private Const HWND_TOPMOST As Long = -1
Private Const SWP_NOMOVE As Long = &H2
Public Const HTCAPTION As Long = 2
Public Const WM_NCLBUTTONDOWN As Long = &HA1
Public Function SplashForm(Frm As Form, sImgPath As String) As Boolean
Dim GpInput As GdiplusStartupInput
Dim BI As BITMAPINFO
Dim hImage As Long
Dim hGraphics As Long
Dim SZ Ace Size
Dim PT As POINTAPI
Dim mDC As Long
Dim hBitmap As Long
Dim BF As BLENDFUNCTION
Dim gToken As Long
Dim OldhBitmap As Long
GpInput.GdiplusVersion = 1
If GdiplusStartup(gToken, GpInput) = 0 Then
If GdipLoadImageFromFile(StrConv(sImgPath, vbUnicode), hImage) = 0 Then
Call GdipGetImageWidth(hImage, SZ.cx)
Call GdipGetImageHeight(hImage, SZ.cy)
mDC = CreateCompatibleDC(Frm.hdc)
With BI.bmiHeader
.biSize = Len(BI.bmiHeader)
.biBitCount = 32
.biWidth = SZ.cx
.biHeight = SZ.cy
.biPlanes = 1
.biSizeImage = .biWidth * .biHeight * (.biBitCount / 8)
End With
hBitmap = CreateDIBSection(mDC, BI, DIB_RGB_COLORS, ByVal 0, 0, 0)
OldhBitmap = SelectObject(mDC, hBitmap)
Call GdipCreateFromHDC(mDC, hGraphics)
Call GdipDrawImageRect(hGraphics, hImage, 0, 0, SZ.cx, SZ.cy)
Call GdipDisposeImage(hImage)
Call GdipDeleteGraphics(hGraphics)
Call GdiplusShutdown(gToken)
Else
Call GdiplusShutdown(gToken)
MsgBox "Error reading image" , vbCritical
Exit Function
End If
Else
MsgBox "Failed to start GDI +" , vbCritical
Exit Function
End If
SetWindowLong Frm.hwnd, GWL_EXSTYLE, GetWindowLong(Frm.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetWindowPos Frm.hwnd, HWND_TOPMOST, 0, 0, SZ.cx, SZ.cy, SWP_NOMOVE
With BF
.AlphaFormat = AC_SRC_ALPHA
.BlendOp = AC_SRC_OVER
.SourceConstantAlpha = 255
End With
SplashForm = UpdateLayeredWindow(Frm.hwnd, Frm.hdc, ByVal 0&, SZ, mDC, PT, 0, BF, ULW_ALPHA)
DeleteObject SelectObject (MDC OldhBitmap)
DeleteDC mDC
End Function
Option Explicit
Private Sub Form_Load()
Call SplashForm(Me, "C:\Users\Windows\Desktop\FormTransp\aaa.png")
End Sub
Private Sub Form_DblClick()
Unload Me
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Call ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub
Quiero poner las herramientas en forma hay una manera o una solución para eso
A la espera de ayuda
Gracias a todos
-
No entiendo, que significa "quiero poner las herramientas"?
-
Me parece que uso un traductor, y se refiere a poner controles sobre el formulario, y bueno la respuesta mas corta es no :D
-
No entiendo, que significa "quiero poner las herramientas"?
i need to add tools on form
-
Me parece que uso un traductor, y se refiere a poner controles sobre el formulario, y bueno la respuesta mas corta es no :D
This is exactly that I want but why no ?
-
hello, give an explanation of why not in English is complicated for me, you can put controls, but these are not rendered, there are some methods, which is to put another container window on same.
if you are interested in deepening the topic see the following suite of classes cWidget.cls
http://leandroascierto.com/blog/estado-del-tiempo/
-
hello, give an explanation of why not in English is complicated for me, you can put controls, but these are not rendered, there are some methods, which is to put another container window on same.
if you are interested in deepening the topic see the following suite of classes cWidget.cls
http://leandroascierto.com/blog/estado-del-tiempo/
Thank you for help
but I don't understand this example
If there is another solution please help me
Wait for Help