473,414 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

using MessageBox MessageBoxIcon.Exclamation

I have ordered the book .NET Framework Solutions, In Search of the Lost
Win32
API by John Paul Meuller which I think will help answer some of my questions
I have regarding making custom MessageBoxes, but that isn't going to be here
for a few days. So, I thought I would ask you guys how to put one of hte
standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my
custom MessageBox.

Thanks,

Dennis
Nov 15 '05 #1
8 13079
Hi Dennis,

The MessageBox class that's built into the Framework supports that already.

MessageBox.Show("Hello, World", "My Message Box", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);

--
Rob Windsor
G6 Consulting
Toronto, Canada
"Dennis C. Drumm" <de*******@primacode.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
I have ordered the book .NET Framework Solutions, In Search of the Lost
Win32
API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom MessageBoxes, but that isn't going to be here for a few days. So, I thought I would ask you guys how to put one of hte
standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my
custom MessageBox.

Thanks,

Dennis

Nov 15 '05 #2
Rob,

I'm creating a CUSTOM MessageBox that has some featues that the standard
one doesn't. Additional Buttons, for instance.

Dennis
"Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:ej**************@TK2MSFTNGP09.phx.gbl...
Hi Dennis,

The MessageBox class that's built into the Framework supports that already.
MessageBox.Show("Hello, World", "My Message Box", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);

--
Rob Windsor
G6 Consulting
Toronto, Canada
"Dennis C. Drumm" <de*******@primacode.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
I have ordered the book .NET Framework Solutions, In Search of the Lost
Win32
API by John Paul Meuller which I think will help answer some of my

questions
I have regarding making custom MessageBoxes, but that isn't going to be

here
for a few days. So, I thought I would ask you guys how to put one of hte
standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my
custom MessageBox.

Thanks,

Dennis


Nov 15 '05 #3

Hi Dennis,

You can find this icon in the "C:\WINDOWS\system32\user32.dll".
As a small trick, you can view the icon in a dll or exe file through the
"change icon"
window of short cut file.

To get specified icon in a file, using ExtractAssociatedIconEx API.

Sample like this:(I set the form's icon to this icon)
try
{
IntPtr iconindex=(IntPtr)1 ;
IntPtr iconid;
IntPtr icon=ExtractAssociatedIconEx(this.Handle
,@"C:\WINDOWS\system32\user32.dll",ref (IntPtr)iconindex,out
(IntPtr)iconid);
this.Icon=Icon.FromHandle(icon);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message );
}
Because this icon is the second icon in user32.dll, you should set the
index to 1.(start from 0)

Hope this helps you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| From: "Dennis C. Drumm" <de*******@primacode.com>
| References: <e$**************@TK2MSFTNGP09.phx.gbl>
<ej**************@TK2MSFTNGP09.phx.gbl>
| Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| Date: Fri, 5 Sep 2003 16:29:23 -0400
| Lines: 45
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <u0**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ipn36372-d67485.net-resource.net 216.204.76.29
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:182723
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Rob,
|
| I'm creating a CUSTOM MessageBox that has some featues that the standard
| one doesn't. Additional Buttons, for instance.
|
| Dennis
|
|
| "Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
| news:ej**************@TK2MSFTNGP09.phx.gbl...
| > Hi Dennis,
| >
| > The MessageBox class that's built into the Framework supports that
| already.
| >
| > MessageBox.Show("Hello, World", "My Message Box", MessageBoxButtons.OK,
| > MessageBoxIcon.Exclamation);
| >
| > --
| > Rob Windsor
| > G6 Consulting
| > Toronto, Canada
| >
| >
| > "Dennis C. Drumm" <de*******@primacode.com> wrote in message
| > news:e$**************@TK2MSFTNGP09.phx.gbl...
| > > I have ordered the book .NET Framework Solutions, In Search of the
Lost
| > > Win32
| > > API by John Paul Meuller which I think will help answer some of my
| > questions
| > > I have regarding making custom MessageBoxes, but that isn't going to
be
| > here
| > > for a few days. So, I thought I would ask you guys how to put one of
hte
| > > standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my
| > > custom MessageBox.
| > >
| > > Thanks,
| > >
| > > Dennis
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #4
Thanks Jeffrey:

That is what I was looking for. I wonder why system sounds and icons weren't
made easier to access from .NET? That's pretty basic stuff for building user
interface stuff, don't you think?

Thanks,

Dennis

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:Ls**************@cpmsftngxa06.phx.gbl...

Hi Dennis,

You can find this icon in the "C:\WINDOWS\system32\user32.dll".
As a small trick, you can view the icon in a dll or exe file through the
"change icon"
window of short cut file.

To get specified icon in a file, using ExtractAssociatedIconEx API.

Sample like this:(I set the form's icon to this icon)
try
{
IntPtr iconindex=(IntPtr)1 ;
IntPtr iconid;
IntPtr icon=ExtractAssociatedIconEx(this.Handle
,@"C:\WINDOWS\system32\user32.dll",ref (IntPtr)iconindex,out
(IntPtr)iconid);
this.Icon=Icon.FromHandle(icon);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message );
}
Because this icon is the second icon in user32.dll, you should set the
index to 1.(start from 0)

Hope this helps you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| From: "Dennis C. Drumm" <de*******@primacode.com>
| References: <e$**************@TK2MSFTNGP09.phx.gbl>
<ej**************@TK2MSFTNGP09.phx.gbl>
| Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| Date: Fri, 5 Sep 2003 16:29:23 -0400
| Lines: 45
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <u0**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ipn36372-d67485.net-resource.net 216.204.76.29
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:182723 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Rob,
|
| I'm creating a CUSTOM MessageBox that has some featues that the standard | one doesn't. Additional Buttons, for instance.
|
| Dennis
|
|
| "Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
| news:ej**************@TK2MSFTNGP09.phx.gbl...
| > Hi Dennis,
| >
| > The MessageBox class that's built into the Framework supports that
| already.
| >
| > MessageBox.Show("Hello, World", "My Message Box", MessageBoxButtons.OK, | > MessageBoxIcon.Exclamation);
| >
| > --
| > Rob Windsor
| > G6 Consulting
| > Toronto, Canada
| >
| >
| > "Dennis C. Drumm" <de*******@primacode.com> wrote in message
| > news:e$**************@TK2MSFTNGP09.phx.gbl...
| > > I have ordered the book .NET Framework Solutions, In Search of the
Lost
| > > Win32
| > > API by John Paul Meuller which I think will help answer some of my
| > questions
| > > I have regarding making custom MessageBoxes, but that isn't going to
be
| > here
| > > for a few days. So, I thought I would ask you guys how to put one of
hte
| > > standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my | > > custom MessageBox.
| > >
| > > Thanks,
| > >
| > > Dennis
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #5

Hi Dennis,

I am glad what I provided helps you.
I think the system sound and icons are platform related, so you need use
windows API to retrieve it.
Also, the .net is focus on the web application and it is platform
unrelated, so
.net provided no class for getting these system information.

Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| From: "Dennis C. Drumm" <de*******@primacode.com>
| References: <e$**************@TK2MSFTNGP09.phx.gbl>
<ej**************@TK2MSFTNGP09.phx.gbl>
<u0**************@TK2MSFTNGP09.phx.gbl>
<Ls**************@cpmsftngxa06.phx.gbl>
| Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| Date: Mon, 8 Sep 2003 06:27:27 -0400
| Lines: 122
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OI**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ppp-com63.net-resource.com 216.204.2.63
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:183145
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thanks Jeffrey:
|
| That is what I was looking for. I wonder why system sounds and icons
weren't
| made easier to access from .NET? That's pretty basic stuff for building
user
| interface stuff, don't you think?
|
| Thanks,
|
| Dennis
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:Ls**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Dennis,
| >
| > You can find this icon in the "C:\WINDOWS\system32\user32.dll".
| > As a small trick, you can view the icon in a dll or exe file through the
| > "change icon"
| > window of short cut file.
| >
| > To get specified icon in a file, using ExtractAssociatedIconEx API.
| >
| > Sample like this:(I set the form's icon to this icon)
| > try
| > {
| > IntPtr iconindex=(IntPtr)1 ;
| > IntPtr iconid;
| > IntPtr icon=ExtractAssociatedIconEx(this.Handle
| > ,@"C:\WINDOWS\system32\user32.dll",ref (IntPtr)iconindex,out
| > (IntPtr)iconid);
| > this.Icon=Icon.FromHandle(icon);
| > }
| > catch(Exception ex)
| > {
| > MessageBox.Show(ex.Message );
| > }
| > Because this icon is the second icon in user32.dll, you should set the
| > index to 1.(start from 0)
| >
| > Hope this helps you.
| >
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| > | From: "Dennis C. Drumm" <de*******@primacode.com>
| > | References: <e$**************@TK2MSFTNGP09.phx.gbl>
| > <ej**************@TK2MSFTNGP09.phx.gbl>
| > | Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| > | Date: Fri, 5 Sep 2003 16:29:23 -0400
| > | Lines: 45
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <u0**************@TK2MSFTNGP09.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: ipn36372-d67485.net-resource.net 216.204.76.29
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:182723
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | Rob,
| > |
| > | I'm creating a CUSTOM MessageBox that has some featues that the
| standard
| > | one doesn't. Additional Buttons, for instance.
| > |
| > | Dennis
| > |
| > |
| > | "Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
| > | news:ej**************@TK2MSFTNGP09.phx.gbl...
| > | > Hi Dennis,
| > | >
| > | > The MessageBox class that's built into the Framework supports that
| > | already.
| > | >
| > | > MessageBox.Show("Hello, World", "My Message Box",
| MessageBoxButtons.OK,
| > | > MessageBoxIcon.Exclamation);
| > | >
| > | > --
| > | > Rob Windsor
| > | > G6 Consulting
| > | > Toronto, Canada
| > | >
| > | >
| > | > "Dennis C. Drumm" <de*******@primacode.com> wrote in message
| > | > news:e$**************@TK2MSFTNGP09.phx.gbl...
| > | > > I have ordered the book .NET Framework Solutions, In Search of the
| > Lost
| > | > > Win32
| > | > > API by John Paul Meuller which I think will help answer some of my
| > | > questions
| > | > > I have regarding making custom MessageBoxes, but that isn't going
to
| > be
| > | > here
| > | > > for a few days. So, I thought I would ask you guys how to put one
of
| > hte
| > | > > standard MessageBox icons, such as MessageBoxIcon.Exclamation,
into
| my
| > | > > custom MessageBox.
| > | > >
| > | > > Thanks,
| > | > >
| > | > > Dennis
| > | > >
| > | > >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #6
Jeffrey:

Here is a follow-up question for you. I was able to extract the icons from
the dll with one of the many icon editors available out there. Each of the
icon images in this dll has about 9 different formats for different sizes
and colors. If I don't edit the icon and delete all but the image I need,
VS.net will always use the first (?) image type for that icon. In this
instance a 16/16 bit icon. And the properties for that icon in the image
properties pane of VS.net is grayed out so I can't change it. How does
VS.net decide which format of the image it will use and how can I
programmatically change it besides deleting all the formats that I don't
want it to use?

Thanks,

Dennis

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:Ls**************@cpmsftngxa06.phx.gbl...

Hi Dennis,

You can find this icon in the "C:\WINDOWS\system32\user32.dll".
As a small trick, you can view the icon in a dll or exe file through the
"change icon"
window of short cut file.

To get specified icon in a file, using ExtractAssociatedIconEx API.

Sample like this:(I set the form's icon to this icon)
try
{
IntPtr iconindex=(IntPtr)1 ;
IntPtr iconid;
IntPtr icon=ExtractAssociatedIconEx(this.Handle
,@"C:\WINDOWS\system32\user32.dll",ref (IntPtr)iconindex,out
(IntPtr)iconid);
this.Icon=Icon.FromHandle(icon);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message );
}
Because this icon is the second icon in user32.dll, you should set the
index to 1.(start from 0)

Hope this helps you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| From: "Dennis C. Drumm" <de*******@primacode.com>
| References: <e$**************@TK2MSFTNGP09.phx.gbl>
<ej**************@TK2MSFTNGP09.phx.gbl>
| Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| Date: Fri, 5 Sep 2003 16:29:23 -0400
| Lines: 45
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <u0**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ipn36372-d67485.net-resource.net 216.204.76.29
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:182723 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Rob,
|
| I'm creating a CUSTOM MessageBox that has some featues that the standard | one doesn't. Additional Buttons, for instance.
|
| Dennis
|
|
| "Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
| news:ej**************@TK2MSFTNGP09.phx.gbl...
| > Hi Dennis,
| >
| > The MessageBox class that's built into the Framework supports that
| already.
| >
| > MessageBox.Show("Hello, World", "My Message Box", MessageBoxButtons.OK, | > MessageBoxIcon.Exclamation);
| >
| > --
| > Rob Windsor
| > G6 Consulting
| > Toronto, Canada
| >
| >
| > "Dennis C. Drumm" <de*******@primacode.com> wrote in message
| > news:e$**************@TK2MSFTNGP09.phx.gbl...
| > > I have ordered the book .NET Framework Solutions, In Search of the
Lost
| > > Win32
| > > API by John Paul Meuller which I think will help answer some of my
| > questions
| > > I have regarding making custom MessageBoxes, but that isn't going to
be
| > here
| > > for a few days. So, I thought I would ask you guys how to put one of
hte
| > > standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my | > > custom MessageBox.
| > >
| > > Thanks,
| > >
| > > Dennis
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #7
Jeffrey:

..NET also support Windows Forms applications, which are not web based. I
think .NET supports a number of other platforms besides web applications.

Dennis

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:4T**************@cpmsftngxa06.phx.gbl...

Hi Dennis,

I am glad what I provided helps you.
I think the system sound and icons are platform related, so you need use
windows API to retrieve it.
Also, the .net is focus on the web application and it is platform
unrelated, so
net provided no class for getting these system information.

Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| From: "Dennis C. Drumm" <de*******@primacode.com>
| References: <e$**************@TK2MSFTNGP09.phx.gbl>
<ej**************@TK2MSFTNGP09.phx.gbl>
<u0**************@TK2MSFTNGP09.phx.gbl>
<Ls**************@cpmsftngxa06.phx.gbl>
| Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| Date: Mon, 8 Sep 2003 06:27:27 -0400
| Lines: 122
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OI**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ppp-com63.net-resource.com 216.204.2.63
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:183145 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thanks Jeffrey:
|
| That is what I was looking for. I wonder why system sounds and icons
weren't
| made easier to access from .NET? That's pretty basic stuff for building
user
| interface stuff, don't you think?
|
| Thanks,
|
| Dennis
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:Ls**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Dennis,
| >
| > You can find this icon in the "C:\WINDOWS\system32\user32.dll".
| > As a small trick, you can view the icon in a dll or exe file through the | > "change icon"
| > window of short cut file.
| >
| > To get specified icon in a file, using ExtractAssociatedIconEx API.
| >
| > Sample like this:(I set the form's icon to this icon)
| > try
| > {
| > IntPtr iconindex=(IntPtr)1 ;
| > IntPtr iconid;
| > IntPtr icon=ExtractAssociatedIconEx(this.Handle
| > ,@"C:\WINDOWS\system32\user32.dll",ref (IntPtr)iconindex,out
| > (IntPtr)iconid);
| > this.Icon=Icon.FromHandle(icon);
| > }
| > catch(Exception ex)
| > {
| > MessageBox.Show(ex.Message );
| > }
| > Because this icon is the second icon in user32.dll, you should set the
| > index to 1.(start from 0)
| >
| > Hope this helps you.
| >
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| > | From: "Dennis C. Drumm" <de*******@primacode.com>
| > | References: <e$**************@TK2MSFTNGP09.phx.gbl>
| > <ej**************@TK2MSFTNGP09.phx.gbl>
| > | Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| > | Date: Fri, 5 Sep 2003 16:29:23 -0400
| > | Lines: 45
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <u0**************@TK2MSFTNGP09.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: ipn36372-d67485.net-resource.net 216.204.76.29
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:182723
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | Rob,
| > |
| > | I'm creating a CUSTOM MessageBox that has some featues that the
| standard
| > | one doesn't. Additional Buttons, for instance.
| > |
| > | Dennis
| > |
| > |
| > | "Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
| > | news:ej**************@TK2MSFTNGP09.phx.gbl...
| > | > Hi Dennis,
| > | >
| > | > The MessageBox class that's built into the Framework supports that
| > | already.
| > | >
| > | > MessageBox.Show("Hello, World", "My Message Box",
| MessageBoxButtons.OK,
| > | > MessageBoxIcon.Exclamation);
| > | >
| > | > --
| > | > Rob Windsor
| > | > G6 Consulting
| > | > Toronto, Canada
| > | >
| > | >
| > | > "Dennis C. Drumm" <de*******@primacode.com> wrote in message
| > | > news:e$**************@TK2MSFTNGP09.phx.gbl...
| > | > > I have ordered the book .NET Framework Solutions, In Search of the | > Lost
| > | > > Win32
| > | > > API by John Paul Meuller which I think will help answer some of my | > | > questions
| > | > > I have regarding making custom MessageBoxes, but that isn't going to
| > be
| > | > here
| > | > > for a few days. So, I thought I would ask you guys how to put one of
| > hte
| > | > > standard MessageBox icons, such as MessageBoxIcon.Exclamation,
into
| my
| > | > > custom MessageBox.
| > | > >
| > | > > Thanks,
| > | > >
| > | > > Dennis
| > | > >
| > | > >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #8

Hi Dennis,

I use VS.net resource editor to open the user32.dll and set the icon's
image type to
48X48 and export it as an .ico file.
But after I import this ico file into button's image property, I found that
the ico was displayed
in 16X16 type and just as you said its properties was black and readonly.
I used ACDSee to open the ico file and found that its still had 9 image
types associated with it.

I do not know how you deleted the other 8 image types.

As a workaround, I found that if you use ExtractAssociatedIconEx to load
the icon and convert it
into Icon class then you can adjust its size as you like.
Sample code like this:

FileStream fs=new FileStream(@"C:\ico101.ico",FileMode.Open );
fs.Position=0;
Icon newicon=new Icon(fs,48,48);
Button1.Image=(Image)newicon.ToBitmap();

I think the reason that at design time the image property only display
16X16 icon is that
the VS.net IDE default use Icon class's default constructor(16X16 size) to
load the icon.

Hope this helps
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| From: "Dennis C. Drumm" <de*******@primacode.com>
| References: <e$**************@TK2MSFTNGP09.phx.gbl>
<ej**************@TK2MSFTNGP09.phx.gbl>
<u0**************@TK2MSFTNGP09.phx.gbl>
<Ls**************@cpmsftngxa06.phx.gbl>
<OI**************@TK2MSFTNGP11.phx.gbl>
<4T**************@cpmsftngxa06.phx.gbl>
| Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| Date: Mon, 8 Sep 2003 08:35:19 -0400
| Lines: 185
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#0**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: ppp-com63.net-resource.com 216.204.2.63
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:183172
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Jeffrey:
|
| .NET also support Windows Forms applications, which are not web based. I
| think .NET supports a number of other platforms besides web applications.
|
| Dennis
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:4T**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Dennis,
| >
| > I am glad what I provided helps you.
| > I think the system sound and icons are platform related, so you need use
| > windows API to retrieve it.
| > Also, the .net is focus on the web application and it is platform
| > unrelated, so
| > net provided no class for getting these system information.
| >
| > Hope this helps.
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| > | From: "Dennis C. Drumm" <de*******@primacode.com>
| > | References: <e$**************@TK2MSFTNGP09.phx.gbl>
| > <ej**************@TK2MSFTNGP09.phx.gbl>
| > <u0**************@TK2MSFTNGP09.phx.gbl>
| > <Ls**************@cpmsftngxa06.phx.gbl>
| > | Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| > | Date: Mon, 8 Sep 2003 06:27:27 -0400
| > | Lines: 122
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <OI**************@TK2MSFTNGP11.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: ppp-com63.net-resource.com 216.204.2.63
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:183145
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | Thanks Jeffrey:
| > |
| > | That is what I was looking for. I wonder why system sounds and icons
| > weren't
| > | made easier to access from .NET? That's pretty basic stuff for
building
| > user
| > | interface stuff, don't you think?
| > |
| > | Thanks,
| > |
| > | Dennis
| > |
| > | "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| > | news:Ls**************@cpmsftngxa06.phx.gbl...
| > | >
| > | > Hi Dennis,
| > | >
| > | > You can find this icon in the "C:\WINDOWS\system32\user32.dll".
| > | > As a small trick, you can view the icon in a dll or exe file through
| the
| > | > "change icon"
| > | > window of short cut file.
| > | >
| > | > To get specified icon in a file, using ExtractAssociatedIconEx API.
| > | >
| > | > Sample like this:(I set the form's icon to this icon)
| > | > try
| > | > {
| > | > IntPtr iconindex=(IntPtr)1 ;
| > | > IntPtr iconid;
| > | > IntPtr icon=ExtractAssociatedIconEx(this.Handle
| > | > ,@"C:\WINDOWS\system32\user32.dll",ref (IntPtr)iconindex,out
| > | > (IntPtr)iconid);
| > | > this.Icon=Icon.FromHandle(icon);
| > | > }
| > | > catch(Exception ex)
| > | > {
| > | > MessageBox.Show(ex.Message );
| > | > }
| > | > Because this icon is the second icon in user32.dll, you should set
the
| > | > index to 1.(start from 0)
| > | >
| > | > Hope this helps you.
| > | >
| > | > Best regards,
| > | > Jeffrey Tan
| > | > Microsoft Online Partner Support
| > | > Get Secure! - www.microsoft.com/security
| > | > This posting is provided "as is" with no warranties and confers no
| > rights.
| > | >
| > | > --------------------
| > | > | Reply-To: "Dennis C. Drumm" <de*******@primacode.com>
| > | > | From: "Dennis C. Drumm" <de*******@primacode.com>
| > | > | References: <e$**************@TK2MSFTNGP09.phx.gbl>
| > | > <ej**************@TK2MSFTNGP09.phx.gbl>
| > | > | Subject: Re: using MessageBox MessageBoxIcon.Exclamation
| > | > | Date: Fri, 5 Sep 2003 16:29:23 -0400
| > | > | Lines: 45
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <u0**************@TK2MSFTNGP09.phx.gbl>
| > | > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | > | NNTP-Posting-Host: ipn36372-d67485.net-resource.net 216.204.76.29
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl
| > | microsoft.public.dotnet.languages.csharp:182723
| > | > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > | > |
| > | > | Rob,
| > | > |
| > | > | I'm creating a CUSTOM MessageBox that has some featues that the
| > | standard
| > | > | one doesn't. Additional Buttons, for instance.
| > | > |
| > | > | Dennis
| > | > |
| > | > |
| > | > | "Rob Windsor" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
| > | > | news:ej**************@TK2MSFTNGP09.phx.gbl...
| > | > | > Hi Dennis,
| > | > | >
| > | > | > The MessageBox class that's built into the Framework supports
that
| > | > | already.
| > | > | >
| > | > | > MessageBox.Show("Hello, World", "My Message Box",
| > | MessageBoxButtons.OK,
| > | > | > MessageBoxIcon.Exclamation);
| > | > | >
| > | > | > --
| > | > | > Rob Windsor
| > | > | > G6 Consulting
| > | > | > Toronto, Canada
| > | > | >
| > | > | >
| > | > | > "Dennis C. Drumm" <de*******@primacode.com> wrote in message
| > | > | > news:e$**************@TK2MSFTNGP09.phx.gbl...
| > | > | > > I have ordered the book .NET Framework Solutions, In Search of
| the
| > | > Lost
| > | > | > > Win32
| > | > | > > API by John Paul Meuller which I think will help answer some
of
| my
| > | > | > questions
| > | > | > > I have regarding making custom MessageBoxes, but that isn't
| going
| > to
| > | > be
| > | > | > here
| > | > | > > for a few days. So, I thought I would ask you guys how to put
| one
| > of
| > | > hte
| > | > | > > standard MessageBox icons, such as MessageBoxIcon.Exclamation,
| > into
| > | my
| > | > | > > custom MessageBox.
| > | > | > >
| > | > | > > Thanks,
| > | > | > >
| > | > | > > Dennis
| > | > | > >
| > | > | > >
| > | > | >
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
1
by: Kevin R | last post by:
I'm running the HelloWorldForm example from Microsoft to learn how to use ..net. I'm using Microsoft Visual Studio .NET 2003, 1.1 framework. I run the HelloWorldForm example. The example runs...
2
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.)...
8
by: Saso Zagoranski | last post by:
Hi! I'm trying to make my own MessageBox... What I would like to know is, how the MessageBox class is implemented? I could have something like: new MyMessageBox().ShowDialog(); but I would...
2
by: Pirmin G. | last post by:
Hi, My C# application (form based, winexe) displays MessageBoxes at certain times. At the moment it centres them on the screen; I want them centered on the application. This version (below)...
2
by: Jim King | last post by:
Hi all, I have just started using VB.NET and have already encountered a puzzling bit of behavior. When I put the following line of code into the click event of a command button: ...
3
by: Lee | last post by:
Hi, I am displaying a messagebox using;- MessageBox.Show("blurb", "more blurb", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) it works ok, and when it shows there is a ding sound, how...
3
by: Amanda | last post by:
Can anyone help me to display the output in MessageBox for the following program result?...
2
by: eclat | last post by:
I am just getting into the .net programming. I know i need to include namespace to make use of MessageBox. Is there any other reason for not getting this option? Can anyone tell me how do i...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.