Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Std XL icons on my Forms

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Std XL icons on my Forms

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Std XL icons on my Forms

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Std XL icons on my Forms

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Std XL icons on my Forms

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel forms - authorise / deny forms Ian Manning Excel Programming 1 May 8th 06 05:03 PM
RefEdits and normal forms / forms in a DLL David Welch Excel Programming 0 December 1st 04 03:49 PM
Icons Tim Excel Programming 0 July 9th 04 07:13 PM
Calling Forms from Forms - Exit problems Stuart[_5_] Excel Programming 3 May 25th 04 06:50 AM
icons John A Grandy Excel Programming 5 July 20th 03 11:01 PM


All times are GMT +1. The time now is 02:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"