Main Page   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

tst_static.cpp

00001 // this file is to make a static build of the appli and debug it in the debugger
00002 
00003 #if !defined(STRICT)
00004 #define STRICT
00005 #endif // !defined(STRICT)
00006 
00007 #include <windows.h>
00008 #include <windowsx.h>
00009 
00010 #include "out.h"
00011 
00012 #include "tststatic.h"
00013 
00015 
00016 static Out_Module * module = NULL;
00017 extern "C" {
00018   Out_Module * winampGetOutModule();
00019 }
00020 
00021 static INT CALLBACK DialogProc(
00022   HWND hwndDlg,  // handle to dialog box
00023   UINT uMsg,     // message
00024   WPARAM wParam, // first message parameter
00025   LPARAM lParam  // second message parameter
00026   )
00027 {
00028   INT bResult = FALSE;
00029 
00030   switch (uMsg) {
00031 
00032     case WM_INITDIALOG:
00033       if (module != NULL)
00034       {
00035         module->hMainWindow = hwndDlg;
00036         if (module->Init != NULL)
00037           module->Init();
00038       }
00039       break;
00040 
00041 
00042     case WM_COMMAND:
00043       UINT command;
00044       command = GET_WM_COMMAND_ID(wParam, lParam);
00045       if ((IDOK == command) || (IDCANCEL == command))
00046       {
00047         ::EndDialog(hwndDlg, 1);
00048       }
00049       else if (IDC_BUTTON_ABOUT == command)
00050       {
00051         if (module != NULL)
00052           module->About(hwndDlg);
00053       }
00054       else if (IDC_BUTTON_CONFIG == command)
00055       {
00056         if (module != NULL)
00057           module->Config(hwndDlg);
00058       }
00059       else if (IDC_BUTTON_ENCODE == command)
00060       {
00061         if (module->Open != NULL)
00062           // start the encoding
00063           if (module->Open( 44100, 2, 16, 0, 0 ) != -1)
00064           {
00065             // encode some data
00066             char * fake_buf = (char *) module; // (oh !)
00067             if (module->Write != NULL)
00068               for (int i=0;i<20;i++)
00069                 module->Write( fake_buf, 1000);
00070             // close the encoding
00071             if (module->Close != NULL)
00072               module->Close( );
00073           }
00074       }
00075       bResult = FALSE;
00076       break;
00077 
00078     case WM_CLOSE:
00079       if (module != NULL && module->Quit != NULL)
00080         module->Quit();
00081       break;
00082 
00083     case WM_USER:
00084       if (lParam == 211)
00085       {
00086         SetWindowLong( hwndDlg, DWL_MSGRESULT ,(LPARAM) "c:\\10.mp3");
00087         bResult = TRUE;
00088       }
00089       else if (lParam == 212)
00090       {
00091         SetWindowLong( hwndDlg, DWL_MSGRESULT ,(LPARAM) "10.mp3");
00092         bResult = TRUE;
00093       }
00094       break;
00095 
00096   }
00097 
00098   return bResult;
00099 }
00100 
00101 int WINAPI WinMain(
00102   HINSTANCE hInstance,      // handle to current instance
00103   HINSTANCE hPrevInstance,  // handle to previous instance
00104   LPSTR lpCmdLine,          // command line
00105   int nCmdShow              // show state
00106 )
00107 {
00108   module = winampGetOutModule();
00109 
00110   if (module == NULL)
00111     return -1;
00112 
00113   module->hDllInstance = ::LoadLibrary("out_lame.dll");
00114   if (module->hDllInstance == NULL)
00115     return -2;
00116 
00117   ::DialogBox( hInstance, MAKEINTRESOURCE(IDD_DIALOG_TST) , NULL, ::DialogProc);
00118   ::FreeLibrary(module->hDllInstance);
00119 
00120   return 0;
00121 }

Generated at Tue Sep 4 20:59:07 2001 for out_lame by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001