You can access functions in the Win32 API by importing the function from
the specified DLL. For example, the following code would allow you to use
the MessageBeep function.
Note that for each prototype you declare, it must be preceded by
[DllImport("<DLL Name>")]
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
class ErrorMessage : Form
{
[DllImport("user32.Dll")]
public static extern int MessageBeep(uint n);
public static void Main()
{
MessageBeep(1000);
}
}
--------------------
From: "pnp" <pnp.at.softlab.ece.ntua.gr>
Subject: Windows Error Notification Sounds
Date: Thu, 29 Apr 2004 23:41:22 +0300
Lines: 8
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: <
[email protected]>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: ppp-230-192.dialup.ntua.gr 147.102.230.192
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.csharp:240912
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
Hi all,
How can I call the functions that play the error messages from the
User32.dll?
Thanks in advance,
Peter.