Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h	(revision 236)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h	(revision 237)
@@ -150,4 +150,5 @@
         EnumerateMediaEventType = QEvent::User + 100,
         ActivateMenuEventType = QEvent::User + 101,
+        RuntimeErrorEventType = QEvent::User + 102,
     };
 };
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h	(revision 236)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h	(revision 237)
@@ -192,4 +192,8 @@
                                      const QString &hostKey);
 
+    void showRuntimeError (const CConsole &console, bool fatal,
+                           const QString &errorID,
+                           const QString &errorMsg);
+
     static QString highlight (const QString &str);
     static QString formatErrorInfo (const COMErrorInfo &info,
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 236)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 237)
@@ -123,11 +123,11 @@
         if (data) delete[] data;
     }
-    bool isVisible() { return vis; }
-    bool hasAlpha() { return alph; }
-    uint xHot() { return xh; }
-    uint yHot() { return yh; }
-    uint width() { return w; }
-    uint height() { return h; }
-    const uchar *shapeData() { return data; }
+    bool isVisible() const { return vis; }
+    bool hasAlpha() const { return alph; }
+    uint xHot() const { return xh; }
+    uint yHot() const { return yh; }
+    uint width() const { return w; }
+    uint height() const { return h; }
+    const uchar *shapeData() const { return data; }
 private:
     bool vis, alph;
@@ -144,6 +144,6 @@
         can_abs (supportsAbsolute),
         needs_host_cursor (needsHostCursor) {}
-    bool supportsAbsolute() { return can_abs; }
-    bool needsHostCursor() { return needs_host_cursor; }
+    bool supportsAbsolute() const { return can_abs; }
+    bool needsHostCursor() const { return needs_host_cursor; }
 private:
     bool can_abs;
@@ -158,5 +158,5 @@
         QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType),
         s (state) {}
-    CEnums::MachineState machineState() { return s; }
+    CEnums::MachineState machineState() const { return s; }
 private:
     CEnums::MachineState s;
@@ -170,9 +170,26 @@
         QEvent ((QEvent::Type) VBoxDefs::ActivateMenuEventType),
         md (menuData), i (index) {}
-    QMenuData *menuData() { return md; }
-    uint index() { return i; }
+    QMenuData *menuData() const { return md; }
+    uint index() const { return i; }
 private:
     QMenuData *md;
     uint i;
+};
+
+/** VM Runtime error event */
+class RuntimeErrorEvent : public QEvent
+{
+public:
+    RuntimeErrorEvent (bool aFatal, const QString &aErrorID,
+                       const QString &aMessage) :
+        QEvent ((QEvent::Type) VBoxDefs::RuntimeErrorEventType),
+        mFatal (aFatal), mErrorID (aErrorID), mMessage (aMessage) {}
+    bool fatal() const { return mFatal; }
+    QString errorID() const { return mErrorID; }
+    QString message() const { return mMessage; }
+private:
+    bool mFatal;
+    QString mErrorID;
+    QString mMessage;
 };
 
@@ -264,12 +281,15 @@
     {
         /** @todo */
-        Q_UNUSED( fNumLock );
-        Q_UNUSED( fScrollLock );
-        Q_UNUSED( fCapsLock );
+        Q_UNUSED (fNumLock);
+        Q_UNUSED (fScrollLock);
+        Q_UNUSED (fCapsLock);
         return S_OK;
     }
 
-    STDMETHOD(OnRuntimeError)(BOOL /*fatal*/, IN_BSTRPARAM /*id*/, IN_BSTRPARAM /*message*/)
-    {
+    STDMETHOD(OnRuntimeError)(BOOL fatal, IN_BSTRPARAM id, IN_BSTRPARAM message)
+    {
+        QApplication::postEvent (
+            view, new RuntimeErrorEvent (!!fatal, QString::fromUcs2 (id), 
+                                         QString::fromUcs2 (message)));
         return S_OK;
     }
@@ -286,6 +306,6 @@
 
 #if !defined (Q_WS_WIN)
-NS_DECL_CLASSINFO( VBoxConsoleCallback )
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI( VBoxConsoleCallback, IConsoleCallback )
+NS_DECL_CLASSINFO (VBoxConsoleCallback)
+NS_IMPL_THREADSAFE_ISUPPORTS1_CI (VBoxConsoleCallback, IConsoleCallback)
 #endif
 
@@ -774,4 +794,12 @@
                     mainwnd->statusBar()->clear();
 
+                return true;
+            }
+
+            case VBoxDefs::RuntimeErrorEventType:
+            {
+                RuntimeErrorEvent *ee = (RuntimeErrorEvent *) e;
+                vboxProblem().showRuntimeError (cconsole, ee->fatal(),
+                                                ee->errorID(), ee->message());
                 return true;
             }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp	(revision 236)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp	(revision 237)
@@ -1265,13 +1265,109 @@
 }
 
-// static
+void VBoxProblemReporter::showRuntimeError (const CConsole &aConsole, bool fatal,
+                                            const QString &errorID,
+                                            const QString &errorMsg)
+{
+    /// @todo (r=dmik) it's just a preliminary box. We need to:
+    //  - for fatal errors and non-fatal with-retry errors, listen for a
+    //    VM state signal to automatically close the message if the VM
+    //    (externally) leaves the Paused state while it is shown.
+    //  - make warning messages modeless
+    //  - add common buttons like Retry/Save/PowerOff/whatever
+
+    CConsole console = aConsole;
+    CEnums::MachineState state = console.GetState();
+    Type type;
+    QString severity;
+
+    if (fatal)
+    {
+        /* the machine must be paused on fatal errors */
+        Assert (state == CEnums::Paused);
+        if (state != CEnums::Paused)
+            console.Pause();
+        type = Critical;
+        severity = tr ("Fatal Error", "runtime error info");
+    }
+    else if (state == CEnums::Paused)
+    {
+        type = Error;
+        severity = tr ("Non-Fatal Error", "runtime error info");
+    }
+    else
+    {
+        type = Warning;
+        severity = tr ("Warning", "runtime error info");
+    }
+    
+    QString formatted;
+
+    if (!errorMsg.isEmpty())
+        formatted += QString ("<table bgcolor=#FFFFFF border=0 cellspacing=0 "
+                              "cellpadding=0 width=100%>"
+                              "<tr><td><p>%1.</p></td></tr>"
+                              "</table><p></p>")
+                              .arg (highlight (errorMsg));
+
+    if (!errorID.isEmpty())
+        formatted += QString ("<table bgcolor=#EEEEEE border=0 cellspacing=0 "
+                              "cellpadding=0 width=100%>"
+                              "<tr><td>%1</td><td>%2</td></tr>"
+                              "<tr><td>%3</td><td>%4</td></tr>"
+                              "</table>")
+                              .arg (tr ("Error ID: ", "runtime error info"),
+                                    errorID)
+                              .arg (tr ("Error Severity: ", "runtime error info"),
+                                    severity);
+    
+    if (!formatted.isEmpty())
+        formatted = "<qt>" + formatted + "</qt>";
+ 
+    int rc = 0;
+
+    if (type == Critical)
+    {
+        rc = message (&vboxGlobal().consoleWnd(), type,
+            tr ("<p>A fatal error has occured during virtual machine execution! "
+                "The virtual machine will be powered off. It is suggested to "
+                "use the clipboard to copy the following error message for "
+                "further examination:</p>"),
+            formatted);
+        
+        /* always power down after a fatal error */
+        console.PowerDown();
+    }
+    else if (type == Error)
+    {
+        rc = message (&vboxGlobal().consoleWnd(), type,
+            tr ("<p>An error has occured during virtual machine execution! "
+                "The error details are shown below. You can try to correct "
+                "the described error and resume the virtual machine "
+                "execution.</p>"),
+            formatted);
+    }
+    else
+    {
+        rc = message (&vboxGlobal().consoleWnd(), type,
+            tr ("<p>The virtual machine execution may run into an error "
+                "condition as described below. "
+                "You may ignore this message, but it is suggested to perform "
+                "an appropriate action to make sure the described error will "
+                "not happen.</p>"),
+            formatted);
+    }
+
+    NOREF(rc);
+}
+
+/* static */
 QString VBoxProblemReporter::highlight (const QString &str)
 {
     QString text = str;
-    // mark strings in single quotes with color
+    /* mark strings in single quotes with color */
     QRegExp rx = QRegExp ("((?:^|\\s)[(]?)'([^']*)'(?=[:.-!);]?(?:\\s|$))");
     rx.setMinimal (true);
     text.replace (rx, "\\1'<font color=#0000CC>\\2</font>'");
-    // mark UUIDs with color
+    /* mark UUIDs with color */
     text.replace (QRegExp (
         "((?:^|\\s)[(]?)"
@@ -1279,10 +1375,10 @@
         "(?=[:.-!);]?(?:\\s|$))"),
         "\\1<font color=#008000>\\2</font>");
-    // split to paragraphs at \n chars
+    /* split to paragraphs at \n chars */
     text.replace ('\n', "</p><p>");
     return text;
 }
 
-// static
+/* static */
 QString VBoxProblemReporter::formatErrorInfo (const COMErrorInfo &info,
                                               HRESULT wrapperRC)
@@ -1377,5 +1473,5 @@
 #endif
     }
-    formatted += "</table></font></qt>";
+    formatted += "</table></qt>";
 
     return formatted;
