Hi there,
I have some vb6 programs, bigger than 5MB, that i can't build using IDE,
only running vb /make.
Does anyone have this problem too?
1. Creating Menu Bitmaps with alpha channel for Windows Vista in VB6
I am trying to create a simple icon at runtime with an alpha channel that I
can apply to the menu. I have been somewhat successful at this using
CreateIcon and DrawIconEx as well as one or two other ways, but my problems
is that if the user's machine is not set to 32 bit colors in display
settings, then it doesn't work. The following is the code that I used to do
this. Please help me fix this problem.
As you can see I have tried setting the menu image several ways all with the
same result. As long it is 32 bit in display settings, everything works,
otherwise it fails to draw anything.
Private Sub cmdTestBmp_Click()
SetMenuImage Array(0, 1), CreateOverrideBitmap
End Sub
Private Sub SetMenuImage(ByVal MenuTree As Variant, ByVal Bmp As Long)
'MenuTree is an array that holds a zero based menu index path to the desired
menu
Dim MainMenuHandle As Long
Dim MenuHandle As Long
Dim i As Integer
Dim mii As MENUITEMINFO
Dim mi As MENUINFO
' Get the menu handle.
MainMenuHandle = GetMenu(Me.hwnd)
MenuHandle = MainMenuHandle
For i = LBound(MenuTree) To UBound(MenuTree) - 1
MenuHandle = GetSubMenu(MenuHandle, MenuTree(i))
Next i
With mi
.cbSize = Len(mi)
.fMask = MIM_STYLE
.dwStyle = MNS_NOCHECK
End With
SetMenuInfo GetSubMenu(MenuHandle, MenuTree(UBound(MenuTree))), mi
With mii
.cbSize = Len(mii)
'.fMask = MIIM_CHECKMARKS
'.fMask = MIIM_CHECKMARKS Or MIIM_BITMAP
.fMask = MIIM_BITMAP
.hbmpItem = Bmp
'.hbmpChecked = Bmp
'.hbmpUnchecked = Bmp
End With
' Assign the picture.
SetMenuItemInfo MainMenuHandle, GetMenuItemID(MenuHandle,
MenuTree(UBound(MenuTree))), 0, mii
'SetMenuItemBitmaps MainMenuHandle, GetMenuItemID(MenuHandle,
MenuTree(UBound(MenuTree))), 0, Bmp, Bmp
End Sub
Public Function CreateOverrideBitmap() As Long
Dim pixels(15, 15) As Long
Dim maskArray(255) As Long
Dim hIcon As Long
Dim nWidth As Long
Dim nHeight As Long
Dim hBmp As Long
Dim hOrigBmp As Long
Dim m_hDC As Long
Dim m_hDIb As Long
Dim m_hBmpOld As Long
Dim m_lPtr As Long
Dim m_tBI As BITMAPINFO
Dim bCreated As Boolean
m_hDC = CreateCompatibleDC(0)
If (m_hDC <> 0) Then
With m_tBI.bmiHeader
.biSize = Len(m_tBI.bmiHeader)
.biWidth = nWidth
.biHeight = nHeight
.biPlanes = 1
.biBitCount = 32
.biCompression = BI_RGB
.biSizeImage = .biWidth * 4 * .biHeight
End With
m_hDIb = CreateDIBSection(m_hDC, m_tBI, DIB_RGB_COLORS, m_lPtr, 0, 0)
If m_hDIb <> 0 Then
m_hBmpOld = SelectObject(m_hDC, m_hDIb)
bCreated = True
Else
DeleteObject m_hDC
m_hDC = 0
End If
End If
hBmp = CreateCompatibleBitmap(m_hDC, nWidth, nHeight)
'hBmp = CreateCompatibleBitmap(m_hDC, 16, 16)
hOrigBmp = SelectObject(m_hDC, hBmp)
hIcon = CreateIcon(0, nWidth, nHeight, 1, 32, VarPtr(maskArray(0)),
VarPtr(pixels(0, 0)))
DrawIconEx m_hDC, 0, 0, hIcon, nWidth, nHeight, 0, 0, DI_NORMAL 'DI_MASK
DestroyIcon hIcon
hBmp = SelectObject(m_hDC, hOrigBmp)
If (m_hDC <> 0) Then
If (m_hDIb <> 0) Then
SelectObject m_hDC, m_hBmpOld
DeleteObject m_hDIb
End If
DeleteObject m_hDC
End If
DeleteDC m_hDC
m_hDC = 0
m_hDIb = 0
m_hBmpOld = 0
m_lPtr = 0
CreateOverrideBitmap = hBmp
End Function
2. use a .NET Windows Control in VB6.0 ??? - .NET Windows Forms
Hi, I've written a Client under VB6 that can load dlls an show forms from it. ok. It's simple, I know. But now I have .NET C# Window Forms and it still work, but when I minimize a form and than maximize, I cant write in the text boxes, I wrote in before minimized. Without minimize I can. Crazy!!! An Ideas? Hope so, Tom ;o)
4. use a .NET Windows Control in VB6.0 ??? - VB.Net
5. Starting and Stopping Windows Services using VB6
Does anyone know how to start and stop already-installed Windows Services using Visual Basic 6? I don't need to do anything else with the services other than start and stop them. I'm using Windows 2000 Professional. Any help here would be greatly appreciated! Many thanks Andy
6. Java GUI(Swing) VS Windows forms in VB6/VB.NET - Java GUI Programming
7. Windows 2003 - debugging VB6-DLL
need to debug a COM component written in VB 6. The .DLL is called from asp. All runs well under Windows 2000 (I remember, I had to ad a lot of rights to the user doing the debugging) I just run the dll (F5) in VB, the browser opens the .asp- page where the DLL is called and I see the request in the VB-Debugger. Very nice! It does not run under Windows 2003. Any Ideas? I tried to give the Application pool running the application admin rights. but it does not work. I can not find any errormessage in the event log. your help is very much appreciated. Beat .