Source file: /~heha/hsn/maus32.zip/PnP/PnpEvent.c

#include <windows.h>
//#include <dbt.h>
// Rüstet unter Win2000 die XP-typischen USB-Ansteck- und Abzieh-Geräusche nach
// Hier nur PC-Speaker-Ausgabe für lautsprecherlose Rechner

// Compiler-Option /GZ entfernen für NoDefaultLib!
#pragma comment(linker,"/NODEFAULTLIB /OPT:nowin98")
#pragma comment(linker,"/LARGEADDRESSAWARE /RELEASE")
#define elemof(x) (sizeof(x)/sizeof((x)[0]))
#define T(x) TEXT(x)

LRESULT CALLBACK WindowProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
 switch (Msg) {
  case WM_DEVICECHANGE: {
   Beep(400+((wParam&0x0F)<<4),100);
  }return TRUE;

  case WM_DESTROY: {
   PostQuitMessage(0);
  }break;
 }
 return DefWindowProc(Wnd,Msg,wParam,lParam);
}

int _stdcall WinMainCRTStartup(void) {
 static WNDCLASS wc={
  CS_HREDRAW|CS_VREDRAW,
  WindowProc,
  0,0,0,0,0,
  (HBRUSH)(COLOR_WINDOW+1),
  NULL,T("PnpEvent")};
 MSG msg;

 wc.hInstance=GetModuleHandle(NULL);
 wc.hCursor=LoadCursor(0,IDC_ARROW);
 RegisterClass(&wc);

 CreateWindow(wc.lpszClassName,T("PnpEvent"),
  /*WS_VISIBLE|*/WS_OVERLAPPEDWINDOW,
  CW_USEDEFAULT,CW_USEDEFAULT,100,100,
  0,0,wc.hInstance,NULL);

 while (GetMessage(&msg,0,0,0))	{
  DispatchMessage(&msg);
 }
 return msg.wParam;
}
Detected encoding: ANSI (CP1252)4
Wrong umlauts? - Assume file is ANSI (CP1252) encoded