Convidado 26/7/2012, 16:32
POrque não aplica um icone no mesmo?
Crie um módulo no form e o nomeeie de BasIcone..
Cole neste módulo:
Option Compare Database
Option Explicit
'---Posted by Klaus Probst---
'--------------------------------------------------------------------------------
'API: Put a custom icon in the form's caption bar
'--------------------------------------------------------------------------------
'There are no direct way to place a custom icon in a form's caption bar.
'However, by loading an ICO file into memory, we can assign the icon to
'a form by sending a WM_SETICON message to the window.
'Code courtesy of Klaus H. Probst
'// Place all this in a module
Private Declare Function LoadImage Lib "User32" _
Alias "LoadImageA" _
(ByVal hInst As Long, _
ByVal lpsz As String, _
ByVal un1 As Long, _
ByVal n1 As Long, _
ByVal n2 As Long, _
ByVal un2 As Long) _
As Long
Private 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 Const WM_GETICON = &H7F
Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0
Private Const ICON_BIG = 1
'// LoadImage() image types
Private Const IMAGE_BITMAP = 0
Private Const IMAGE_ICON = 1
Private Const IMAGE_CURSOR = 2
Private Const IMAGE_ENHMETAFILE = 3
'// LoadImage() flags
Private Const LR_DEFAULTCOLOR = &H0
Private Const LR_MONOCHROME = &H1
Private Const LR_COLOR = &H2
Private Const LR_COPYRETURNORG = &H4
Private Const LR_COPYDELETEORG = &H8
Private Const LR_LOADFROMFILE = &H10
Private Const LR_LOADTRANSPARENT = &H20
Private Const LR_DEFAULTSIZE = &H40
Private Const LR_LOADMAP3DCOLORS = &H1000
Private Const LR_CREATEDIBHeader = &H2000
Private Const LR_COPYFROMRESOURCE = &H4000
Private Const LR_SHARED = &H8000
Public Function SetFormIcon(frm As Form, IconPath As String) As Boolean
Dim hIcon As Long
hIcon = LoadImage(0&, IconPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE)
'// wParam = 0; Setting small icon. wParam = 1; setting large icon
If hIcon <> 0 Then
Call SendMessage(frm.hWnd, WM_SETICON, 0, ByVal hIcon)
SetFormIcon = True
End If
End Function
'Função para obter o path do mdb corrente
Function CurrentDbDir() As String
Dim StrName As String
StrName = CurrentDb.Name
CurrentDbDir = Left(StrName, Len(StrName) - Len(Dir(StrName)))
End Function
Public Function SetReportIcon(rpt As Report, IconPath As String) As Boolean
Dim hIcon As Long
hIcon = LoadImage(0&, IconPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE)
'// wParam = 0; Setting small icon. wParam = 1; setting large icon
If hIcon <> 0 Then
Call SendMessage(rpt.hWnd, WM_SETICON, 0, ByVal hIcon)
SetReportIcon = True
End If
End Function
Public Function CarregaIcone(NomeForm As Form)
Dim strCaminho As String
'caminho e nome do ícone
strCaminho = CurrentDbDir & "\" & "Sistema.ico"
'Chama a função para colocar o icone
Call SetFormIcon(NomeForm, strCaminho)
End Function
Public Function CarregaIconeRpt(NomeReport As Report)
Dim strCaminho As String
'caminho e nome do ícone
strCaminho = CurrentDbDir & "\" & "Sistema.ico"
'Chama a função para colocar o icone
Call SetReportIcon(NomeReport, strCaminho)
End Function
E ao abrir do Form:
Call CarregaIcone(Me)
Dentro da pasta do BD, coloque um icone de sua preferencia renomeando-0 para Sistema.ico