Advertisement
Advertisement
| 08.08.2008 at 05:15PM PDT, ID: 23634404 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: |
///////////////////////////////////////////////////////////////////
// These two procedures process WM_Debug, & WM_Thread messages //
///////////////////////////////////////////////////////////////////
procedure TMainForm.DebugMessages(var M: TMessage);
var ErrMsg: array[0..255] of char;
StrSize: word;
begin;
StrSize := GlobalGetAtomName(M.LParam, ErrMsg, 256);
GlobalDeleteAtom(M.LParam);
if StrSize > 0 then
begin;
case M.WParam of
MC_ErrMsg: LogInfo(nil, string(ErrMsg));
MC_DebugMsg : LogInfo(nil, string(ErrMsg));
MC_MutexMsg : LogInfo(nil, string(ErrMsg));
end;
else
TimedMessageDlg('Error message not found !', mtError,[mbOk], 0, 10, mrOk);
end;
procedure TMainForm.ThreadMessages(var M: TMessage);
begin;
case M.WParam of
MC_MotorStart : LogInfo(nil, Format('%s stepper motor started', [FeedbackChannelNames[M.LParam - md_ref+countAO]]));
MC_MotorStop : LogInfo(nil, Format('%s stepper motor stopped', [FeedbackChannelNames[M.LParam - md_ref+countAO]]));
MC_ThreadCreate: LogInfo(nil, Format('%s. New Thread started', [GetAtomMsg]));
MC_ThreadQuit : LogInfo(nil, Format('%s. Thread Quit Request', [GetAtomMsg]));
MC_ThreadProc : LogInfo(nil, Format('%s. ThreadProc activated', [GetAtomMsg]));
MC_ThreadInfo : LogInfo(nil, Format('%s', [GetAtomMsg]));
MC_ThreadEnd:
begin;
LogInfo(nil, Format('%s. Thread Ended', [GetAtomMsg]));
dec(ThreadCount);
IsMultiThread := (ThreadCount > 1);
CloseHandle(hEPTThread);
hEPTThread := 0;
end;
end;
Caption := Format('HCT DAQ [%d threads active]', [ThreadCount]);
if (M.WParam = MC_MotorStop) then DAQModule.SetCWButtonState(M.LParam, false);
if (M.WParam = MC_MotorStart) then DAQModule.SetCWButtonState(M.LParam, true);
end;
/////////////////////////////////////////////////////////////////
// Messages are sent from a separate thread. Example below //
////////////////////////////////////////////////////////////////
<part of the Thread function>
loop := 0; steps := 10;
while (not TEPTTargets(Ptr^).QuitThread) and (loop < steps) do
begin;
updateVariables(steps - loop);//Update if EPTs active
for EPTransducer := ep_Vert to ep_IntP do ApplyOutput(EPTransducer);
PostMessage(hMainform, WM_Debug, MC_EPTMsg, AddGlobalAtomFmt('%s <- Calling Sleep', [getPCTAsString]));
//Break the Sleep command into 4 individual sleeps to avoid a long hang-up
if not TEPTTargets(Ptr^).QuitThread then sleep(TEPTTargets(Ptr^).TimeDelay div 4);
if not TEPTTargets(Ptr^).QuitThread then sleep(TEPTTargets(Ptr^).TimeDelay div 4);
if not TEPTTargets(Ptr^).QuitThread then sleep(TEPTTargets(Ptr^).TimeDelay div 4);
if not TEPTTargets(Ptr^).QuitThread then sleep(TEPTTargets(Ptr^).TimeDelay - (3 * TEPTTargets(Ptr^).TimeDelay div 4));
PostMessage(hMainform, WM_Debug, MC_EPTMsg, AddGlobalAtomFmt('%s -> Done Sleep', [getPCTAsString]));
inc(loop);
end;
except on e:exception do
PostMessage(hMainform, WM_Debug, MC_ErrMsg, GlobalAddAtom(pchar(E.Message)));
end;
if TEPTTargets(Ptr^).QuitThread then
PostMessage(hMainform, WM_Thread, MC_ThreadQuit, AddGlobalAtomFmt('%s <EPT>', [getPCTAsString]));
PostMessage(hMainform, WM_Thread, MC_ThreadEnd, AddGlobalAtomFmt('%s', [getPCTAsString]));
|