mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
improved error handling
svn path=/trunk/; revision=18134
This commit is contained in:
parent
afb1aa2562
commit
e8285addc9
4 changed files with 68 additions and 69 deletions
|
@ -15,8 +15,6 @@
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
|
||||||
* VMware is a registered trademark of VMware, Inc.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$
|
/* $Id$
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
|
||||||
* VMware is a registered trademark of VMware, Inc.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$
|
/* $Id$
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
|
||||||
* VMware is a registered trademark of VMware, Inc.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$
|
/* $Id$
|
||||||
*
|
*
|
||||||
|
@ -115,8 +113,6 @@ PrefDlgAddLine(PSND_MIXER Mixer,
|
||||||
{
|
{
|
||||||
PrefContext->SelectedLine = Line->dwLineID;
|
PrefContext->SelectedLine = Line->dwLineID;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto AddToOthersLines;
|
goto AddToOthersLines;
|
||||||
|
@ -132,7 +128,6 @@ PrefDlgAddLine(PSND_MIXER Mixer,
|
||||||
{
|
{
|
||||||
PrefContext->SelectedLine = Line->dwLineID;
|
PrefContext->SelectedLine = Line->dwLineID;
|
||||||
}
|
}
|
||||||
DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto AddToOthersLines;
|
goto AddToOthersLines;
|
||||||
|
@ -550,7 +545,7 @@ DeleteMixerWindowControls(PMIXER_WINDOW MixerWindow)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
static BOOL
|
||||||
RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow)
|
RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow)
|
||||||
{
|
{
|
||||||
DeleteMixerWindowControls(MixerWindow);
|
DeleteMixerWindowControls(MixerWindow);
|
||||||
|
@ -558,7 +553,7 @@ RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
MainWindowProc(HWND hwnd,
|
MainWindowProc(HWND hwnd,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
|
@ -658,6 +653,7 @@ MainWindowProc(HWND hwnd,
|
||||||
{
|
{
|
||||||
DPRINT("Rebuilding mixer window controls failed!\n");
|
DPRINT("Rebuilding mixer window controls failed!\n");
|
||||||
SndMixerDestroy(MixerWindow->Mixer);
|
SndMixerDestroy(MixerWindow->Mixer);
|
||||||
|
MixerWindow->Mixer = NULL;
|
||||||
Result = -1;
|
Result = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -770,15 +766,17 @@ CreateApplicationWindow(VOID)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hWnd = NULL;
|
hWnd = NULL;
|
||||||
AllocAndLoadString(&lpErrMessage,
|
if (AllocAndLoadString(&lpErrMessage,
|
||||||
hAppInstance,
|
hAppInstance,
|
||||||
IDS_NOMIXERDEVICES);
|
IDS_NOMIXERDEVICES))
|
||||||
|
{
|
||||||
MessageBox(NULL,
|
MessageBox(NULL,
|
||||||
lpErrMessage,
|
lpErrMessage,
|
||||||
lpAppTitle,
|
lpAppTitle,
|
||||||
MB_ICONINFORMATION);
|
MB_ICONINFORMATION);
|
||||||
LocalFree(lpErrMessage);
|
LocalFree(lpErrMessage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd == NULL)
|
||||||
{
|
{
|
||||||
|
@ -797,51 +795,55 @@ WinMain(HINSTANCE hInstance,
|
||||||
int nCmdShow)
|
int nCmdShow)
|
||||||
{
|
{
|
||||||
MSG Msg;
|
MSG Msg;
|
||||||
|
int Ret = 1;
|
||||||
|
|
||||||
hAppInstance = hInstance;
|
hAppInstance = hInstance;
|
||||||
hAppHeap = GetProcessHeap();
|
hAppHeap = GetProcessHeap();
|
||||||
|
|
||||||
if (!InitAppConfig())
|
if (InitAppConfig())
|
||||||
{
|
{
|
||||||
DPRINT("Unable to open the Volume Control registry key!\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load the application title */
|
/* load the application title */
|
||||||
if (AllocAndLoadString(&lpAppTitle,
|
if (!AllocAndLoadString(&lpAppTitle,
|
||||||
hAppInstance,
|
hAppInstance,
|
||||||
IDS_SNDVOL32) == 0)
|
IDS_SNDVOL32))
|
||||||
{
|
{
|
||||||
lpAppTitle = NULL;
|
lpAppTitle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
if (!RegisterApplicationClasses())
|
if (RegisterApplicationClasses())
|
||||||
{
|
{
|
||||||
DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
hMainWnd = CreateApplicationWindow();
|
hMainWnd = CreateApplicationWindow();
|
||||||
if (hMainWnd == NULL)
|
if (hMainWnd != NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Failed to creat application window (LastError: %d)!\n", GetLastError());
|
BOOL bRet;
|
||||||
return 1;
|
while ((bRet =GetMessage(&Msg,
|
||||||
}
|
|
||||||
|
|
||||||
while (GetMessage(&Msg,
|
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
0))
|
0)) != 0)
|
||||||
|
{
|
||||||
|
if (bRet != -1)
|
||||||
{
|
{
|
||||||
TranslateMessage(&Msg);
|
TranslateMessage(&Msg);
|
||||||
DispatchMessage(&Msg);
|
DispatchMessage(&Msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DestroyWindow(hMainWnd);
|
DestroyWindow(hMainWnd);
|
||||||
|
Ret = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("Failed to creat application window (LastError: %d)!\n", GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
UnregisterApplicationClasses();
|
UnregisterApplicationClasses();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
if (lpAppTitle != NULL)
|
if (lpAppTitle != NULL)
|
||||||
{
|
{
|
||||||
|
@ -849,7 +851,12 @@ WinMain(HINSTANCE hInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseAppConfig();
|
CloseAppConfig();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("Unable to open the Volume Control registry key!\n");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,6 @@ typedef struct _MIXER_WINDOW
|
||||||
UINT SelectedLine;
|
UINT SelectedLine;
|
||||||
} MIXER_WINDOW, *PMIXER_WINDOW;
|
} MIXER_WINDOW, *PMIXER_WINDOW;
|
||||||
|
|
||||||
LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
||||||
|
|
||||||
BOOL RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow);
|
|
||||||
|
|
||||||
extern HINSTANCE hAppInstance;
|
extern HINSTANCE hAppInstance;
|
||||||
extern ATOM MainWindowClass;
|
extern ATOM MainWindowClass;
|
||||||
extern HWND hMainWnd;
|
extern HWND hMainWnd;
|
||||||
|
|
Loading…
Reference in a new issue