Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am creating a little form and I wanted to add the standard question icon,
but I can't see how to do it. Pointers (or some code) please. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In it's simplest form:
Put all this in the Userform code module: Option Explicit Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function LoadStandardIcon Lib "user32" _ Alias "LoadIconA" _ (ByVal hInstance As Long, _ ByVal lpIconNum As enStandardIconEnum) _ As Long Private Declare Function DrawIcon Lib "user32" _ (ByVal hdc As Long, _ ByVal X As Long, _ ByVal Y As Long, _ ByVal hIcon As Long) As Long Private Enum enStandardIconEnum IDI_APPLICATION = 32512& IDI_ASTERISK = 32516& IDI_EXCLAMATION = 32515& IDI_HAND = 32513& IDI_ERROR = IDI_HAND IDI_INFORMATION = IDI_ASTERISK IDI_QUESTION = 32514& IDI_WARNING = IDI_EXCLAMATION IDI_WINLOGO = 32517 End Enum Private Sub CommandButton1_Click() Dim hwnd As Long Dim hdc As Long hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub Load the form in the usual way and click the button. You will have to work it out a bit further, but this should work. RBS "Graham Y" wrote in message ... I am creating a little form and I wanted to add the standard question icon, but I can't see how to do it. Pointers (or some code) please. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or you can do:
Private Sub UserForm_Activate() Dim hwnd As Long Dim hdc As Long DoEvents 'this is needed hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub RBS "RB Smissaert" wrote in message ... In it's simplest form: Put all this in the Userform code module: Option Explicit Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function LoadStandardIcon Lib "user32" _ Alias "LoadIconA" _ (ByVal hInstance As Long, _ ByVal lpIconNum As enStandardIconEnum) _ As Long Private Declare Function DrawIcon Lib "user32" _ (ByVal hdc As Long, _ ByVal X As Long, _ ByVal Y As Long, _ ByVal hIcon As Long) As Long Private Enum enStandardIconEnum IDI_APPLICATION = 32512& IDI_ASTERISK = 32516& IDI_EXCLAMATION = 32515& IDI_HAND = 32513& IDI_ERROR = IDI_HAND IDI_INFORMATION = IDI_ASTERISK IDI_QUESTION = 32514& IDI_WARNING = IDI_EXCLAMATION IDI_WINLOGO = 32517 End Enum Private Sub CommandButton1_Click() Dim hwnd As Long Dim hdc As Long hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub Load the form in the usual way and click the button. You will have to work it out a bit further, but this should work. RBS "Graham Y" wrote in message ... I am creating a little form and I wanted to add the standard question icon, but I can't see how to do it. Pointers (or some code) please. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks that looks like what I was expecting I know nothing about API calls.
Thanks Are there any good (free) resources of such info? "RB Smissaert" wrote: Or you can do: Private Sub UserForm_Activate() Dim hwnd As Long Dim hdc As Long DoEvents 'this is needed hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub RBS "RB Smissaert" wrote in message ... In it's simplest form: Put all this in the Userform code module: Option Explicit Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function LoadStandardIcon Lib "user32" _ Alias "LoadIconA" _ (ByVal hInstance As Long, _ ByVal lpIconNum As enStandardIconEnum) _ As Long Private Declare Function DrawIcon Lib "user32" _ (ByVal hdc As Long, _ ByVal X As Long, _ ByVal Y As Long, _ ByVal hIcon As Long) As Long Private Enum enStandardIconEnum IDI_APPLICATION = 32512& IDI_ASTERISK = 32516& IDI_EXCLAMATION = 32515& IDI_HAND = 32513& IDI_ERROR = IDI_HAND IDI_INFORMATION = IDI_ASTERISK IDI_QUESTION = 32514& IDI_WARNING = IDI_EXCLAMATION IDI_WINLOGO = 32517 End Enum Private Sub CommandButton1_Click() Dim hwnd As Long Dim hdc As Long hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub Load the form in the usual way and click the button. You will have to work it out a bit further, but this should work. RBS "Graham Y" wrote in message ... I am creating a little form and I wanted to add the standard question icon, but I can't see how to do it. Pointers (or some code) please. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, go to this site:
http://www.allapi.net/ and get the API guide. RBS "Graham Y" wrote in message ... Thanks that looks like what I was expecting I know nothing about API calls. Thanks Are there any good (free) resources of such info? "RB Smissaert" wrote: Or you can do: Private Sub UserForm_Activate() Dim hwnd As Long Dim hdc As Long DoEvents 'this is needed hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub RBS "RB Smissaert" wrote in message ... In it's simplest form: Put all this in the Userform code module: Option Explicit Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function LoadStandardIcon Lib "user32" _ Alias "LoadIconA" _ (ByVal hInstance As Long, _ ByVal lpIconNum As enStandardIconEnum) _ As Long Private Declare Function DrawIcon Lib "user32" _ (ByVal hdc As Long, _ ByVal X As Long, _ ByVal Y As Long, _ ByVal hIcon As Long) As Long Private Enum enStandardIconEnum IDI_APPLICATION = 32512& IDI_ASTERISK = 32516& IDI_EXCLAMATION = 32515& IDI_HAND = 32513& IDI_ERROR = IDI_HAND IDI_INFORMATION = IDI_ASTERISK IDI_QUESTION = 32514& IDI_WARNING = IDI_EXCLAMATION IDI_WINLOGO = 32517 End Enum Private Sub CommandButton1_Click() Dim hwnd As Long Dim hdc As Long hwnd = FindWindow(vbNullString, Me.Caption) hdc = GetDC(hwnd) DrawIcon hdc, 10, 10&, LoadStandardIcon(0&, IDI_QUESTION) End Sub Load the form in the usual way and click the button. You will have to work it out a bit further, but this should work. RBS "Graham Y" wrote in message ... I am creating a little form and I wanted to add the standard question icon, but I can't see how to do it. Pointers (or some code) please. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel forms - authorise / deny forms | Excel Programming | |||
RefEdits and normal forms / forms in a DLL | Excel Programming | |||
Icons | Excel Programming | |||
Calling Forms from Forms - Exit problems | Excel Programming | |||
icons | Excel Programming |