home *** CD-ROM | disk | FTP | other *** search
- // Progress.cpp : Defines the initialization routines for the DLL.
-
-
- #include "stdafx.h"
- #include "Progress.h"
- #include "dialogthread.h"
- #include "progressdlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- //
- // Note!
- //
- // If this DLL is dynamically linked against the MFC
- // DLLs, any functions exported from this DLL which
- // call into MFC must have the AFX_MANAGE_STATE macro
- // added at the very beginning of the function.
- //
- // For example:
- //
- // extern "C" BOOL PASCAL EXPORT ExportedFunction()
- // {
- // AFX_MANAGE_STATE(AfxGetStaticModuleState());
- // // normal function body here
- // }
- //
- // It is very important that this macro appear in each
- // function, prior to any calls into MFC. This means that
- // it must appear as the first statement within the
- // function, even before any object variable declarations
- // as their constructors may generate calls into the MFC
- // DLL.
- //
- // Please see MFC Technical Notes 33 and 58 for additional
- // details.
- //
-
- /////////////////////////////////////////////////////////////////////////////
- // CProgressApp
-
- BEGIN_MESSAGE_MAP(CProgressApp, CWinApp)
- //{{AFX_MSG_MAP(CProgressApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CProgressApp construction
-
- CProgressApp::CProgressApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CProgressApp object
-
- CProgressApp theApp;
-
-
- //***********************************************************************************
- // global variables used to hold user input until accessed by new thread
-
- CString g_text1;
- CString g_text2;
- long g_xpos;
- long g_ypos;
- long g_width;
- long g_height;
- long g_begin;
- long g_end;
- long * g_pBasicVar;
- ProgressDlg * g_pProgBar;
-
-
- // end global variables
- //************************************************************************************
- // begin exported functions
-
-
- // Progbar -- Save user input and create new thread for progress bar
-
- void Progbar(char* text1,char* text2,long xpos,long ypos,long width,long height,long begin,long end,long* pBasicVar)
- { if (g_pProgBar == NULL)
- { g_text1 = text1;
- g_text2 = text2;
- g_xpos = xpos;
- g_ypos = ypos;
- g_width = width;
- g_height = height;
- g_begin = begin;
- g_end = end;
- g_pBasicVar = pBasicVar;
-
- AfxBeginThread(RUNTIME_CLASS (DialogThread)); // create thread to execute dialog
- }
- }
-
-
- // Closebar -- close progress bar dialog box in other thread.
-
- void Closebar()
- { if (g_pProgBar != NULL)
- { g_pProgBar->KillTimer(1); // stop timer from updating dialog
- g_pProgBar->EndDialog(1); // tell dialog to end
- g_pProgBar = NULL; // set pointer to NULL to show no dialog running (dialog is still shutting down)
- //Sleep(0); // This line should help allow the thread to shut down before Basic
- // regains control. An error could result if a dll us unloaded right after a
- // call to closeslider. the basic program should allow time for the thread to
- // shut down before unloading the DLL. If desired this line can be un-commented
- // to provide some help in getting the thread to shutdown faster.
- }
- }
-
-
- // Settext -- set static text while progbar is running
-
- void Settext(char* text1, char* text2)
- { g_text1 = text1;
- g_text2 = text2;
- }
-
-
- // Setfocus -- used to bring the button dialog box to the foreground and activate.
-
- void Setfocus()
- { if (g_pProgBar != NULL)
- { SetForegroundWindow(g_pProgBar->m_hWnd); // bring window to foreground and activate
- }
- }
-
-
- // end exported functions
- //************************************************************************************