Attribute VB_Name = "CHRO" '**************************************************************************************** ' ' File: CHRO.BAS ' ' Author: Roberto Raso ' Date: 15th July 1994 ' '**************************************************************************************** ' ' Purpose: Provide MassLynx Chromatogram functions. ' '**************************************************************************************** '**************************************************************************************** ' ' Constant/Global declarations. ' '**************************************************************************************** Global Const DM_RAW_MAXMASSES = 32 'Maximum number of mass chromatograms+1 Global Const DM_MASSEND = 0 Global Const DM_SUMMASS = 64000 Global Const DM_MASSADD = -1 Global Const DM_MASSSUB = -2 Global Const DM_MASSRANGE = 32000 '*** Chromatogram menu and dialogue IDs *** Const ID_PROCESS_CHROMATOGRAM = 32774 Const IDM_CHR = 300 Const IDM_CHR_RAW = 301 Const IDM_CHR_MASS = 310 Const IDM_CHR_TIC = 311 Const IDM_CHR_RANGE = 314 Const IDM_CHR_DEFAULT = 315 Const IDM_CHR_INTEGRATE = 324 Const IDM_CHR_COM = 354 Const IDM_CHR_TOOLBAR = 359 Const IDM_CHR_REALTIME = 345 Const IDM_CHR_ANALOGUE = 346 Const IDM_CHR_TOOL_PORTRAIT = 391 Const IDM_CHR_TOOL_LANDSCAPE = 392 Const IDM_CHRO_NEWTRACE = 103 Const IDM_CHRO_REMOVE = 312 Const IDM_CHRO_ALIGN = 342 Const COMB_AVE = 308 Const COMB_SUB = 310 Const COMB_SEP = 369 Const COMB_FAC = 176 '*** Chromatogram types *** Global Const DM_RAW_CHRO_TIC = 0 Global Const DM_RAW_CHRO_MASS = 1 Global Const DM_RAW_CHRO_SUM = 2 Global Const DM_RAW_CHRO_ANALOG = 3 Global Const DM_RAW_CHRO_BPI = 4 'Window/dialogue captions. Const CAPTION_TRACE_REMOVE = "Remove Chromatogram" Const CAPTION_TRACE_NEW = "New Chromatogram" 'ChroPeakList type constants. Global Const CPL_TOPSCAN = 1 Global Const CPL_HEIGHT = 2 Global Const CPL_AREA = 3 Global Const CPL_START = 4 Global Const CPL_END = 5 Global Const CPL_STARTHEIGHT = 6 Global Const CPL_ENDHEIGHT = 7 'ChroPeakList default array. Global Const CPLA_START = -32768 'X-Axis labelling constants. 'Used to set format to copy scan/time to clipboard. Global Const CX_SCAN = 0 Global Const CX_TIME = 1 'Peak purity constants Global Const PURE_SIMPLE = 0 Global Const PURE_BAYES = 1 Global Const CHR_PEAKPURE_PARA = "ChrPeakPurity" '**************************************************************************************** ' ' Data type declarations. ' '**************************************************************************************** '*** '*** DMRAWCHRTYPE *** '*** Describes the type of chromatogram *** '*** Type DMRAWCHRTYPE nChroType As Long 'Chromatogram type afMasses(DM_RAW_MAXMASSES) As Single wChan As Long 'Analog channel number nPack1 As Long 'Structure packing variable, not used lfWindow As Double 'Mass window bAbsWindow As Long 'TRUE if mass window is absolute ( Da ), 'FALSE if mass window is PPM nPack2 As Long 'Structure packing variable, not used End Type '*** '*** CHRO_STATS '*** Chromatogram statistics *** '*** used for VC++ function interfacing '*** Type CHRO_STATS fPeakWidth As Single 'Peak width ( mins ) fNoiseLevel As Single 'Peak-to-peak amplitude bAutoNoise As Long 'Automatically detect noise End Type '**** ChroList **** 'ChroList data type definition. Type ChroList ScanTime As Single 'Scan or RT, depends on X-axis. Intensity As Single 'Intensity at scan/RT. End Type Type CHROMATOGRAM Scan As Long time As Single Intensity As Single End Type 'CHROMATOGRAM type constants. Global Const CL_SCANTIME = 1 Global Const CL_INTENSITY = 2 'CHROMATOGRAM default array. Global Const CLA_START = -32768 'Global Chromatogram() As ChroList '**** ChroPeakList **** 'ChroPeakList type definition. Type ChroPeakList TopScan As Single Height As Single Area As Single Start As Single End As Single StartHeight As Single EndHeight As Single End Type '*** '*** ChroStats *** '*** Collection of statistics calculated from '*** ChroStats() function. '*** Type ChroStats Num As Integer Min As Single Max As Single Ave As Single SD As Single NoiseMin As Single NoiseMax As Single NoiseAve As Single NoiseSD As Single End Type 'Peak purity parameters Type PURITY_PARAMS nPurityMethod As Long 'PURE_SIMPLE or PURE_BAYES nMaxMasses As Long 'Max no of masses to examine (Bayes only) nMaxMoments As Long 'Max no of moments (1-4) (Bayes only) End Type 'Information for peak purity calculation Type PURITY_INFO hWnd As Long 'Parent window handle sInfo As VGRAWFILE 'Raw file sType As DMRAWCHRTYPE 'Chromatogram type hPeaks As Long 'Peak list nNumPeaks As Long 'Number of peaks hDm As Long 'Returns chromatogram handle sParams As PURITY_PARAMS 'Peak purity parameters End Type '**************************************************************************************** ' ' Function declarations. ' '**************************************************************************************** Declare Function DmRawStrToMass Lib "dm32.dll" Alias "_DmRawStrToMass@16" (ByVal lpMassStr As String, afMassList As Single, ByVal nMaxLength As Integer, lpStrNext As Any) As Integer Declare Function DmRawReadChromatogramVB Lib "dm32.dll" Alias "_DmRawReadChromatogramVB@32" (lpRawFile As VGRAWFILE, ByVal szChromatogram As String, ByVal wCalibrate As Integer, ByVal dwStartScan As Long, ByVal dwNumScans As Long, lpScan As Single, lpTime As Single, lpIntensity As Single) As Long Declare Function CalculatePeakPurity Lib "PeakPure.dll" Alias "_CalculatePeakPurity@4" _ (sPurityInfo As PURITY_INFO) As Long Declare Function PureGetIniFile Lib "PeakPure.dll" Alias "_PureGetIniFile@8" _ (ByVal szParagraph As String, lpsParam As PURITY_PARAMS) As Long Declare Function PureSetIniFile Lib "PeakPure.dll" Alias "_PureSetIniFile@8" _ (ByVal szParagraph As String, lpsParam As PURITY_PARAMS) As Long '**************************************************************************************** ' ' Purpose: Start Chromatogram. MassLynx must be running ' '**************************************************************************************** Function CHROM() As Long Dim hWnd As Long Dim dwMsgRtn As Long hWnd = MassLynxhWnd() If hWnd Then 'Open chromatogram window hWnd = MassLynxCommand("app.launch[default:Chro]()", OPEN_WIN_TIMEOUT) hWnd = WaitForProcessStart(ChroCaption(True), 5) If hWnd = 0 Then hWnd = WaitForProcessStart(ChroCaption(False), 5) End If End If 'Return the window handle CHROM = hWnd End Function '________________________________________________________________________________________ ' ' Process: ChroAnalogue ' ' Author: Roberto Raso ' Date: 16th October 1995 ' ' Purpose: Display an analogue channel. ' ' Parameters: nChannel is the channel to be displayed, by its position ' in the list box, starting at 1. ' nMode has one of three values ADD, REPLACE or NEW_WINDOW. ' ' Return: Void. '________________________________________________________________________________________ Sub ChroAnalogue(nChannelReq As Integer, nMode As Integer) Const CHAN = "Channel" Dim hDlg As Long Dim hCBox As Long Dim nChannel As Integer Dim nChannels As Integer Dim nIDMode As Integer Dim lMsgRtn As Long Dim szText As String * 80 hDlg = ChroDlg(IDM_CHR_ANALOGUE, "Analog Chromatogram", True) If hDlg = 0 Then Exit Sub End If hCBox = DlgItemValidate(hDlg, &H147) If hCBox = 0 Then Exit Sub End If lMsgRtn = SendMessage(hCBox, CB_SETCURSEL, nChannelReq - 1, 0) If lMsgRtn = CB_ERR Then If DlgBoxClose(hDlg, IDCANCEL, CDbl(CVDate("00:00:10"))) = 0 Then MsgBox "Unable to close Analog Chromatogram", 0, App.Title End If Exit Sub End If Select Case nMode Case ADD nIDMode = &H140 Case REPLACE nIDMode = &H141 Case NEW_WINDOW nIDMode = &H142 End Select Call CheckRadioButton(hDlg, &H140, &H142, nIDMode) If DlgBoxClose(hDlg, IDOK, CDbl(CVDate("00:00:10"))) = 0 Then MsgBox "Unable to close Analog Chromatogram", 0, App.Title End If End Sub '**************************************************************************************** ' ' Purpose: Generate the BPI TIC for the current RAW file. ' '**************************************************************************************** Sub ChroBPI(wMode As Integer) Dim lpModeCom As String Select Case wMode Case ADD lpModeCom = "%A" Case REPLACE lpModeCom = "%R" Case NEW_WINDOW lpModeCom = "%N" End Select CHROM Call AppActivate("Chromatogram - ") SendKeys "%DI", True DoEvents SendKeys lpModeCom, True SendKeys "%P{+}", True SendKeys "{ENTER}", True DoEvents End Sub '**************************************************************************************** ' ' Purpose: Returns the current caption for the ' Chromatogram window. ' There are 2 possible windows; ' 1. Maximised Chromatogram (wFull=True). ' Process name and current raw file. ' 2. Other (wFull=False) ' Process name only. ' '**************************************************************************************** Function ChroCaption(wFull As Integer) As String Dim lpFile As String Dim lpProcess As String lpProcess = "Chromatogram" If wFull Then lpFile = GetMLFileName("RAW") ChroCaption = lpProcess + " - [" + lpFile + "]" Else ChroCaption = lpProcess End If End Function '**************************************************************************************** ' ' Purpose: Centre current chromatogram on selected scan with window. ' '**************************************************************************************** Sub ChroCentreAt(fCentre As Single, fWindow As Single) CHROM SendKeys "%D", True DoEvents SendKeys "N", True DoEvents SendKeys "C", True DoEvents SendKeys "O", True DoEvents SendKeys "%C", True SendKeys CStr(fCentre), True SendKeys "%W", True SendKeys CStr(fWindow), True SendKeys "{ENTER}", True DoEvents End Sub '**************************************************************************************** ' ' Purpose: Closes down chromatogram. ' '**************************************************************************************** Sub ChroClose() Dim hWnd As Long Dim dwMsgRtn As Long hWnd = ChrohWnd() If hWnd Then dwMsgRtn = PostMessage(hWnd, WM_CLOSE, 0, 0) Do While ChrohWnd() DoEvents Loop End If End Sub '**************************************************************************************** ' ' Purpose: Combine scans. ' '**************************************************************************************** Sub ChroCombineScans(dwAveS As Long, dwAveE As Long, dwSub1S As Long, dwSub1E As Long, dwSub2S As Long, dwSub2E As Long, fMassWin As Single, fSubMult As Single) Dim hWnd As Long Dim hDlg As Long Dim hCtrl As Long Dim dwMsgRtn As Long Dim lpAveScans As String Dim lpSubScans1 As String Dim lpSubScans2 As String Dim lpMassWin As String Dim lpSubMult As String If dwAveS < 1 Then Exit Sub ElseIf dwAveE < 1 Then lpAveScans = CStr(dwAveS) Else lpAveScans = CStr(dwAveS) + ":" + CStr(dwAveE) End If If dwSub1S < 1 Then lpSubScans1 = "" ElseIf dwSub1E < 1 Then lpSubScans1 = CStr(dwSub1S) Else lpSubScans1 = CStr(dwSub1S) + ":" + CStr(dwSub1E) End If If dwSub2S < 1 Then lpSubScans2 = "" ElseIf dwSub2E < 1 Then lpSubScans2 = CStr(dwSub2S) Else lpSubScans2 = CStr(dwSub2S) + ":" + CStr(dwSub2E) End If If Len(lpSubScans1) > 0 And Len(lpSubScans2) > 0 Then lpSubScans = lpSubScans1 + "," + lpSubScans2 Else lpSubScans = lpSubScans1 + lpSubScans2 End If 'Open the chromatogram window hWnd = CHROM If hWnd Then hDlg = MnuDlg_Disp(hWnd, IDM_CHR_COM, "Combine Spectrum", 5, False) If hDlg = 0 Then Call ThrowError(USER_ERR, "Unable to find Combine Spectrum dialogue box") End If hCtrl = GetDlgItem32(hDlg, COMB_AVE) dwMsgRtn = SendMessageText(hCtrl, Trim$(lpAveScans)) hCtrl = GetDlgItem32(hDlg, COMB_SUB) dwMsgRtn = SendMessageText(hCtrl, Trim$(lpSubScans)) hCtrl = GetDlgItem32(hDlg, COMB_SEP) wMsgRtn = SendMessageText(hCtrl, CStr(fMassWin)) hCtrl = GetDlgItem32(hDlg, COMB_FAC) dwMsgRtn = SendMessageText(hCtrl, CStr(fSubMult)) dwMsgRtn = SendMessage(hDlg, WM_COMMAND, IDOK, 0) DoEvents WaitForProcessEnd "Spectrum Combine" End If End Sub Sub ChroDisplayRange(StartPoint As Single, EndPoint As Single) 'StartPoint is scan/RT for start of display. 'EndPoint is scan/RT for end of display. 'ScanNumber selects X-Axis format ie. Scan or Time. CHROM SendKeys "%DNF", True DoEvents SendKeys "%F", True SendKeys CStr(StartPoint), True SendKeys "%T", True SendKeys CStr(EndPoint), True SendKeys "{ENTER}", True DoEvents End Sub '________________________________________________________________________________________ ' ' Process: ChroDlg ' ' Author: Roberto Raso ' Date: 18th October 1995 ' ' Purpose: Displays a dialogue box from chr0matogram. ' ' Parameters: nChroMenuID is the menu ID used to display the required box. ' strCaption is the caption of the required dialogue box. ' bChild is true if the dialogue box is to be a child ' window of chromatogram. ' ' Return: The window handle of the required dialogue box, ' or 0 if it was not found. '________________________________________________________________________________________ Function ChroDlg(nChroMenuID As Long, strCaption As String, bChild As Integer) As Long Const Timeout = 10 Dim hChro As Long hChro = ChrohWnd() If hChro = 0 Then ChroDlg = 0 Exit Function End If ChroDlg = MnuDlg_Disp(hChro, nChroMenuID, strCaption, Timeout, bChild) End Function '**************************************************************************************** ' ' Purpose: Closes/Exits Chromatogram. ' '**************************************************************************************** Function ChroExit() As Integer Dim lpCaption As String Dim lpCaptionFull As String lpCaption = ChroCaption(False) lpCaptionFull = ChroCaption(True) If ProcessActive(lpCaption) Then ChroExit = StopProcess(lpCaption) ElseIf ProcessActive(lpCaptionFull) Then ChroExit = StopProcess(lpCaptionFull) Else ChroExit = True End If End Function '**************************************************************************************** ' Process: ChroFileOpen ' Purpose: Opens a raw file from the chromatogram window. The chromatogram window ' must already be open. ' Parameters: strvFileName - the data file to be opened. ' nrMode - ADD, REPLACE or NEW_WINDOW. ' Return: True if successful. '**************************************************************************************** Function ChroFileOpen(ByVal strvFileName As String, nrMode As Integer) As Integer Dim hChro As Long Dim hChroOpen As Long Dim hCtrl As Long Dim wMode As Integer Dim dwMsgRtn As Long Dim strCaption As String ChroFileOpen = False strCaption = "Chromatogram Data Browser" hChro = ChrohWnd() 'Chro window must already be open If hChro Then hChroOpen = ProcessActive(strCaption) If hChroOpen = 0 Then dwMsgRtn = PostMessage(hChro, WM_COMMAND, IDM_CHR_RAW, 0) hChroOpen = WaitForProcessStart(strCaption, 5) End If If hChroOpen Then 'Send file name to data browser, add data extension if necessary If UCase(Right(strvFileName, Len(DATA_EXT))) <> UCase(DATA_EXT) Then strvFileName = strvFileName & DATA_EXT End If hCtrl = GetDlgItem32(hChroOpen, ID_BRO_FILENAME) dwMsgRtn = SendMessageText(hCtrl, strvFileName) 'Determine how chromatogram is to be displayed Select Case nrMode Case ADD wMode = ID_BRO_ADD Case REPLACE wMode = ID_BRO_REPLACE Case NEW_WINDOW wMode = ID_BRO_NEW_WIND Case Else Exit Function End Select Call CheckRadioButton(hChroOpen, ID_BRO_ADD, ID_BRO_NEW_WIND, wMode) dwMsgRtn = PostMessage(hChroOpen, WM_COMMAND, IDOK, 0) Call WaitForProcessEnd(strCaption) ChroFileOpen = True End If End If End Function '**************************************************************************************** ' ' Purpose: Returns the current window handle ' for Chromatogram. ' '**************************************************************************************** Function ChrohWnd() As Long ChrohWnd = MLAppActive(APP_CHRO) End Function Sub ChroIntegrate() Dim hChro As Long Dim hIntPar As Long Dim hIntPro As Long Dim dwMsgRtn As Long Dim lpIntPar As String Dim lpIntPro As String lpIntPar = "Integrate Chromatogram" lpIntPro = "Peak Integration" hChro = ChrohWnd() If hChro Then hIntPar = ProcessActive(lpIntPar) If hIntPar = 0 Then dwMsgRtn = PostMessage(hChro, WM_COMMAND, IDM_CHR_INTEGRATE, 0) hIntPar = WaitForProcessStart(lpIntPar, 5) End If If hIntPar Then dwMsgRtn = PostMessage(hIntPar, WM_COMMAND, IDOK, 0) Call WaitForProcessEnd(lpIntPar) hIntPro = WaitForProcessStart(lpIntPro, 5) Call WaitForProcessEnd(lpIntPro) End If End If End Sub Function ChroList(ChroListFile As String) As Long Dim FileNum As Integer Dim Reclen As Integer Dim CharInClip As Long Dim TraceEntry As Long Dim Trace As String Dim NewRec As String Dim Sep As String Dim Chars As String Dim CurField As String Dim clData As CHROMATOGRAM Screen.MousePointer = 11 'Pointer becomes hour glass. NewRec = Chr$(13) + Chr$(10) Sep = Chr$(9) Reclen = Len(clData) CHROM SendKeys "%EL", True 'Copy current trace to ClipBoard. DoEvents Trace = Clipboard.GetText() If FileExists(ChroListFile) = True Then Kill ChroListFile End If 'Open ChroListFile to write to. FileNum = FreeFile Open ChroListFile For Random Access Write As FileNum Len = Reclen CurField = "" TraceEntry = 0 'Look at every character in the ClipBoard. For CharInClip = 1 To Len(Trace) 'Select 2 characters. Chars = Mid$(Trace, CharInClip, 2) 'If a Seperator has been found. 'Write data to ScanTime field. If Left$(Chars, 1) = Sep Then clData.Scan = Str2Sng(CurField) CurField = "" ElseIf Chars = NewRec Then 'Last field for record. clData.Intensity = Str2Sng(CurField) TraceEntry = TraceEntry + 1 Put FileNum, TraceEntry, clData CurField = "" Else 'Normal character. CurField = CurField + Left$(Chars, 1) End If Next CharInClip Close FileNum Screen.MousePointer = 0 'Default pointer for application. ChroList = TraceEntry End Function '**************************************************************************************** ' ' Purpose: Creates a list of ChroList entries for the ' current chromatogram. ' Return value is number of entries created. ' '**************************************************************************************** Function ChroListArray(CHROMATOGRAM() As CHROMATOGRAM) As Long Dim EndFunc As Integer Dim TotalPoints As Long Dim LastTotalPoints As Long Dim ApproxNumPoints As Long Dim LenPartChro As Long Dim CharInClip As Long Dim SASize As Long Dim CurScanTime As Single Dim LastScanTime As Single Dim PartChro As String Dim NewRec As String Dim Sep As String Dim Chars As String Dim LChar As String Dim CurField As String Dim ChroData As CHROMATOGRAM 'Assign any default/start values to variables. CHROM MousePointer = 11 NewRec = Chr$(13) + Chr$(10) Sep = Chr$(9) EndFunc = False TotalPoints = 0 LastTotalPoints = TotalPoints CurScanTime = 0 LastScanTime = 0 ReDim CHROMATOGRAM(CLA_START To CLA_START) 'ChroDisplayDefault 'MousePointer = 11 TotalPoints = 0 'Repeat until end of chromatogram. While EndFunc = False DoEvents ChroToClip MousePointer = 11 PartChro = "" PartChro = Clipboard.GetText() LenPartChro = Len(PartChro) CurField = "" 'Look at every character in the ClipBoard. For CharInClip = 1 To LenPartChro DoEvents 'Select 2 characters. Chars = Mid$(PartChro, CharInClip, 2) LChar = Left$(Chars, 1) 'If a Seperator has been found. 'Write data to ScanTime field. If LChar = Sep Then ChroData.Scan = Str2Sng(CurField) CurField = "" ElseIf Chars = NewRec Then 'Last field for record. ChroData.Intensity = Str2Sng(CurField) 'Only put ChroData into array if greater than last 'array entry. Prevents duplicates of ChroData in array. If ChroData.Scan > LastScanTime Then ReDim Preserve CHROMATOGRAM(CLA_START To CLA_START + TotalPoints) CHROMATOGRAM(CLA_START + TotalPoints) = ChroData TotalPoints = TotalPoints + 1 End If CurField = "" Else 'Normal character. CurField = CurField + LChar End If Next CharInClip 'No change of TotalPoints means end of chromatogram. 'Display next segment. If ChroData.Scan > LastScanTime Then LastTotalPoints = TotalPoints LastScanTime = CHROMATOGRAM(CLA_START + TotalPoints - 2).Scan ChroDisplayFrom LastScanTime LastScanTime = ChroData.Scan Else EndFunc = True End If Wend ChroListArray = TotalPoints End Function '**************************************************************************************** ' ' Purpose: Finds the maximum intensity scan/RT from List(). ' Sets value in MaxIntAtScan. ' Returns number of entries checked. ' '**************************************************************************************** Function ChroListArrayMaxInt(List() As CHROMATOGRAM, MaxIntAtScan As CHROMATOGRAM) As Integer Dim StartEntry As Integer Dim EndEntry As Integer Dim CurEntry As Integer Dim wMaxEntry As Integer Dim MaxInt As Single StartEntry = LBound(List) EndEntry = UBound(List) MaxIntAtScan.Intensity = 0 MaxIntAtScan.Scan = 0 For CurEntry = StartEntry To EndEntry If List(CurEntry).Intensity > MaxIntAtScan.Intensity Then MaxIntAtScan.Intensity = List(CurEntry).Intensity MaxIntAtScan.Scan = List(CurEntry).Scan MaxIntAtScan.time = List(CurEntry).time wMaxEntry = CurEntry End If Next CurEntry ChroListArrayMaxInt = wMaxEntry End Function '**************************************************************************************** ' ' Purpose: Create the desired mass chromatogram. ' '**************************************************************************************** Sub ChroMassChro(strMasses As String, wMode As Integer, nFunc As Integer) Const ID_FUNC_COMBO = 112 Const L_MENU_TEXT = "&Wavelength..." Const M_MENU_TEXT = "&Mass..." Const L_CAPTION = "DAD Chromatogram" Const M_CAPTION = "Mass Chromatogram" Dim hChro As Long Dim hMass As Long Dim hMassDesc As Long Dim wIDMode As Integer Dim dwMsgRtn As Long Dim strMassCaption As String hChro = ChrohWnd() If hChro = 0 Then Exit Sub End If If GetMenuText(hChro, IDM_CHR_MASS) = L_MENU_TEXT Then strMassCaption = L_CAPTION Else strMassCaption = M_CAPTION End If hMass = MnuDlg_Disp(hChro, IDM_CHR_MASS, strMassCaption, 5, True) If hMass = 0 Then Exit Sub End If hMassDesc = GetDlgItem32(hMass, 120) 'Description text box. dwMsgRtn = SendMessageText(hMassDesc, strMasses) Select Case wMode Case ADD wIDMode = 320 Case REPLACE wIDMode = 321 Case NEW_WINDOW wIDMode = 322 End Select Call CheckRadioButton(hMass, 320, 322, wIDMode) dwMsgRtn = SendDlgItemMessage(hMass, ID_FUNC_COMBO, CB_SETCURSEL, ByVal (nFunc - 1), 0) If DlgBoxClose(hMass, IDOK, CDbl(CVDate("00:00:10"))) = False Then MsgBox "Unable to close " + strCaption, 0, App.Title End If End Sub '---------------------------------------------------------------------------------------- ' ' Process: ChroMoveFirst ' ' Author: Roberto Raso ' Date: 20th November 1995 ' ' Purpose: Moves the current chromatogram to the bottom/first. ' ' Parameters: None. ' ' Return: Void. ' '---------------------------------------------------------------------------------------- Sub ChroMoveFirst() Dim hChro As Long Dim lMsgRtn As Long hChro = ChrohWnd() If hChro <> 0 Then lMsgRtn = SendMessage(hChro, WM_COMMAND, &H166, 0) End If End Sub '---------------------------------------------------------------------------------------- ' ' Process: ChroMoveLast ' ' Author: Roberto Raso ' Date: 20th November 1995 ' ' Purpose: Moves the current chromatogram to the top/last. ' ' Parameters: None. ' ' Return: Void. ' '---------------------------------------------------------------------------------------- Sub ChroMoveLast() Dim hChro As Long Dim lMsgRtn As Long hChro = ChrohWnd() If hChro <> 0 Then lMsgRtn = SendMessage(hChro, WM_COMMAND, &H165, 0) End If End Sub '________________________________________________________________________________________ ' ' Process: ChroNewTrace ' ' Author: Roberto Raso ' Date: 25th May 1995 ' ' Purpose: Sets how chromatograms are added, replaced or new windowed ' when the results of a process need to be displayed. ' ' Parameters: nMode has one of three values ADD, REPLACE or NEW. ' ' Return: Void. '________________________________________________________________________________________ Sub ChroNewTrace(nMode As Integer) Dim hDlg As Long Dim nOption As Integer Dim dwMsgRtn As Long hDlg = MnuDlg_Disp(ChrohWnd(), IDM_CHRO_NEWTRACE, CAPTION_TRACE_NEW, 5, True) If hDlg Then nOption = 0 Select Case nMode Case ADD nOption = 1015 Case REPLACE nOption = 1016 Case NEW_WINDOW nOption = 1017 End Select If nOption Then Call CheckRadioButton(hDlg, 1015, 1017, nOption) End If dwMsgRtn = SendMessage(hDlg, WM_COMMAND, IDOK, 0) Do While IsWindow(hDlg) DoEvents Loop End If End Sub Function ChroPeakList(ChroPeakListFile As String) As Integer Dim FileNum As Integer Dim Reclen As Integer Dim CharInClip As Long Dim PeakListEntry As Long Dim PeakListField As Integer Dim PeakList As String Dim NewRec As String Dim Sep As String Dim Chars As String Dim CurField As String Dim cplData As ChroPeakList NewRec = Chr$(13) + Chr$(10) Sep = Chr$(9) Reclen = Len(cplData) CHROM SendKeys "%ED", True 'Copy peak list to clipboard. DoEvents PeakList = Clipboard.GetText() If FileExists(ChroPeakListFile) = True Then Kill ChroPeakListFile End If 'Open ChroPeakListFile to write to. FileNum = FreeFile Open ChroPeakListFile For Random Access Write As FileNum Len = Reclen CurField = "" PeakEntry = 0 PeakListField = CPL_TOPSCAN 'Look at every character in the ClipBoard. For CharInClip = 1 To Len(PeakList) 'Select 2 characters. Chars = Mid$(PeakList, CharInClip, 2) 'If a Seperator has been found. 'Write data to correct field. If Left$(Chars, 1) = Sep Then Select Case PeakListField Case CPL_TOPSCAN cplData.TopScan = Str2Sng(CurField) 'Convert text to numeric. PeakListField = CPL_HEIGHT Case CPL_HEIGHT cplData.Height = Str2Sng(CurField) PeakListField = CPL_AREA Case CPL_AREA cplData.Area = Str2Sng(CurField) PeakListField = CPL_START Case CPL_START cplData.Start = Str2Sng(CurField) PeakListField = CPL_END Case CPL_END cplData.End = Str2Sng(CurField) PeakListField = CPL_STARTHEIGHT Case CPL_STARTHEIGHT cplData.StartHeight = Str2Sng(CurField) PeakListField = CPL_ENDHEIGHT End Select CurField = "" ElseIf Chars = NewRec Then 'Last field for record. cplData.EndHeight = Str2Sng(CurField) PeakEntry = PeakEntry + 1 Put FileNum, PeakEntry, cplData CurField = "" PeakListField = CPL_TOPSCAN Else 'Normal character. CurField = CurField + Left$(Chars, 1) End If Next CharInClip Close FileNum Screen.MousePointer = 0 'Default pointer for application. ChroPeakList = PeakEntry End Function Function ChroPeakListArray(ChromatogramPeaks() As ChroPeakList) As Integer 'This function will copy the detected peaks 'into an array called CHROMATOGRAMPEAKS. 'Each entry has a ChroPeakList data format. 'The return value is the number of entries created. Dim PeakListField As Integer Dim CharInClip As Long Dim PeakListEntry As Long Dim PeakList As String Dim NewRec As String Dim Sep As String Dim Chars As String Dim CurField As String Dim cplData As ChroPeakList NewRec = Chr$(13) + Chr$(10) Sep = Chr$(9) CHROM SendKeys "%ED", True 'Copy peak list to clipboard. DoEvents PeakList = Clipboard.GetText() CurField = "" PeakEntry = 0 PeakListField = CPL_TOPSCAN 'Look at every character in the ClipBoard. For CharInClip = 1 To Len(PeakList) 'Select 2 characters. Chars = Mid$(PeakList, CharInClip, 2) 'If a Separator has been found. 'Write data to correct field. If Left$(Chars, 1) = Sep Then Select Case PeakListField Case CPL_TOPSCAN cplData.TopScan = Str2Sng(CurField) 'Convert text to numeric. PeakListField = CPL_HEIGHT Case CPL_HEIGHT cplData.Height = Str2Sng(CurField) PeakListField = CPL_AREA Case CPL_AREA cplData.Area = Str2Sng(CurField) PeakListField = CPL_START Case CPL_START cplData.Start = Str2Sng(CurField) PeakListField = CPL_END Case CPL_END cplData.End = Str2Sng(CurField) PeakListField = CPL_STARTHEIGHT Case CPL_STARTHEIGHT cplData.StartHeight = Str2Sng(CurField) PeakListField = CPL_ENDHEIGHT End Select CurField = "" ElseIf Chars = NewRec Then 'Last field for record. cplData.EndHeight = Str2Sng(CurField) ReDim Preserve ChromatogramPeaks(CPLA_START To CPLA_START + PeakEntry) ChromatogramPeaks(CPLA_START + PeakEntry) = cplData PeakEntry = PeakEntry + 1 CurField = "" PeakListField = CPL_TOPSCAN Else 'Normal character. CurField = CurField + Left$(Chars, 1) End If Next CharInClip ChroPeakListArray = PeakEntry End Function Function ChroPeakListArrayBP(ChroToCheck() As ChroPeakList) As Integer Dim CurEntry As Integer Dim StartPnt As Integer Dim EndPnt As Integer Dim BPEntry As Integer Dim BPIntensity As Single Dim PeakData As ChroPeakList BPIntensity = 0 StartPnt = LBound(ChroToCheck) EndPnt = UBound(ChroToCheck) For CurEntry = StartPnt To EndPnt If ChroToCheck(CurEntry).Area > BPIntensity Then BPIntensity = ChroToCheck(CurEntry).Area BPEntry = CurEntry End If Next CurEntry ChroPeakListArrayBP = BPEntry End Function Function ChroPeakListBP(cplFileNum As Integer) As Long Dim EndLoop As Integer Dim RecNum As Long Dim BPRecord As Long Dim BPInensity As Single Dim PeakData As ChroPeakList BPIntensity = 0 RecNum = 1 EndLoop = False Do While EndLoop = False Get cplFileNum, RecNum, PeakData If EOF(cplFileNum) = False Then If PeakData.Area > BPIntensity Then BPIntensity = PeakData.Area BPRecord = RecNum End If RecNum = RecNum + 1 Else EndLoop = True End If Loop ChroPeakListBP = BPRecord End Function Function ChroPeakListField(cplFileNum As Integer, cplRecNum As Long, cplField As Integer) As Single Dim cplPeakData As ChroPeakList Get cplFileNum, cplRecNum, cplPeakData Select Case cplField Case CPL_TOPSCAN ChroPeakListField = cplPeakData.TopScan Case CPL_HEIGHT ChroPeakListField = cplPeakData.Height Case CPL_AREA ChroPeakListField = cplPeakData.Area Case CPL_START ChroPeakListField = cplPeakData.Start Case CPL_END ChroPeakListField = cplPeakData.End Case CPL_STARTHEIGHT ChroPeakListField = cplPeakData.StartHeight Case CPL_ENDHEIGHT ChroPeakListField = cplPeakData.EndHeight End Select End Function Sub ChroPrint(bLandScape As Integer) Dim hChro As Long Dim hPMgr As Long Dim hMsgBox As Long Dim wPMode As Long Dim dwMsgRtn As Long Dim lpCaptionMsgBox As String lpCaptionMsgBox = "Printing..." hChro = ChrohWnd() If bLandScape Then wPMode = IDM_CHR_TOOL_LANDSCAPE Else wPMode = IDM_CHR_TOOL_PORTRAIT End If If hChro Then dwMsgRtn = PostMessage(hChro, WM_COMMAND, wPMode, 0) WaitForMLPrint End If End Sub '**************************************************************************************** ' ' Purpose: Reads data to create a chromatogram array. ' Note: wScans is TRUE if SCAN numbers are used for range. ' '**************************************************************************************** Function ChroReadChromatogram(lpFile As String, lpChroDesc As String, wFunc As Integer, fStart As Single, fEnd As Single, wScans As Integer, lpChro() As CHROMATOGRAM) As Long Dim wEntry As Integer Dim wEndEntry As Integer Dim dwStartScan As Long Dim dwEndScan As Long Dim dwNumScans As Long Dim lpzChroDesc As String Dim lpRawFile As VGRAWFILE Dim lpScan() As Single Dim lpTime() As Single Dim lpIntensity() As Single If DMVerifyFunction(lpFile, wFunc, lpRawFile) Then If wScans Then dwStartScan = DMVerifyScan(lpFile, wFunc, CLng(fStart), lpRawFile) dwEndScan = DMVerifyScan(lpFile, wFunc, CLng(fEnd), lpRawFile) Else dwStartScan = DMVerifyRT(lpFile, wFunc, fStart, lpRawFile) dwEndScan = DMVerifyRT(lpFile, wFunc, fEnd, lpRawFile) End If If dwStartScan = False Or fStart = 0 Then dwStartScan = 1 End If If dwEndScan = False Or fEnd = 0 Then dwEndScan = DmRawScansInFunction(lpRawFile) End If If dwEndScan < dwStartScan Then dwNumScans = dwEndScan dwEndScan = dwStartScan dwStartScan = dwNumScans End If dwNumScans = dwEndScan - dwStartScan + 1 lpzChroDesc = Trim$(lpChroDesc) '+ Chr$(0) ReDim lpScan(CLA_START To CLA_START + dwNumScans - 1) ReDim lpTime(CLA_START To CLA_START + dwNumScans - 1) ReDim lpIntensity(CLA_START To CLA_START + dwNumScans - 1) ReDim lpChro(CLA_START To CLA_START + dwNumScans - 1) wEndEntry = CInt(CLA_START + dwNumScans - 1) DmRawClose ChroReadChromatogram = DmRawReadChromatogramVB(lpRawFile, lpzChroDesc, True, dwStartScan, dwNumScans, lpScan(CLA_START), lpTime(CLA_START), lpIntensity(CLA_START)) For wEntry = CLA_START To wEndEntry lpChro(wEntry).Scan = lpScan(wEntry) lpChro(wEntry).time = lpTime(wEntry) lpChro(wEntry).Intensity = lpIntensity(wEntry) DoEvents Next wEntry Else ChroReadChromatogram = False End If End Function '**************************************************************************************** ' ' Purpose: Reads data to create a chromatogram array. ' Uses Process number to access required array ' Note: wScans is TRUE if SCAN numbers are used for range. ' '**************************************************************************************** Function ChroReadChromatogramProcess(lpFile As String, lpChroDesc As String, wFunc As Integer, wProc As Integer, fStart As Single, fEnd As Single, wScans As Integer, lpChro() As CHROMATOGRAM) As Long Dim wEntry As Integer Dim wEndEntry As Integer Dim dwStartScan As Long Dim dwEndScan As Long Dim dwNumScans As Long Dim dwScansRead As Long Dim lpzChroDesc As String Dim lpRawFile As VGRAWFILE Dim lpScan() As Single Dim lpTime() As Single Dim lpIntensity() As Single If DMVerifyFunction(lpFile, wFunc, lpRawFile) Then If wScans Then dwStartScan = DMVerifyScan(lpFile, wFunc, CLng(fStart), lpRawFile) dwEndScan = DMVerifyScan(lpFile, wFunc, CLng(fEnd), lpRawFile) Else dwStartScan = DMVerifyRT(lpFile, wFunc, fStart, lpRawFile) dwEndScan = DMVerifyRT(lpFile, wFunc, fEnd, lpRawFile) End If If dwStartScan = False Then dwStartScan = 1 End If If dwEndScan = False Then dwEndScan = DmRawScansInFunction(lpRawFile) End If If dwEndScan < dwStartScan Then dwNumScans = dwEndScan dwEndScan = dwStartScan dwStartScan = dwNumScans End If dwNumScans = dwEndScan - dwStartScan + 1 lpzChroDesc = Trim$(lpChroDesc) '+ Chr$(0) ReDim lpScan(CLA_START To CLA_START + dwNumScans - 1) ReDim lpTime(CLA_START To CLA_START + dwNumScans - 1) ReDim lpIntensity(CLA_START To CLA_START + dwNumScans - 1) ReDim lpChro(CLA_START To CLA_START + dwNumScans - 1) wEndEntry = CInt(CLA_START + dwNumScans - 1) DmRawClose lpRawFile.wProc = wProc dwScansRead = DmRawReadChromatogramVB(lpRawFile, lpzChroDesc, 1, dwStartScan, dwNumScans, lpScan(CLA_START), lpTime(CLA_START), lpIntensity(CLA_START)) ChroReadChromatogramProcess = dwScansRead For wEntry = CLA_START To wEndEntry lpChro(wEntry).Scan = lpScan(wEntry) lpChro(wEntry).time = lpTime(wEntry) lpChro(wEntry).Intensity = lpIntensity(wEntry) DoEvents Next wEntry Else ChroReadChromatogramProcess = False End If End Function '**************************************************************************************** ' ' Purpose: Display currently acquiring data file in real time. ' wRealTime=True sets real time mode. ' wRealTime=False turns off real time mode. ' Only active during an acquisition, not during solvent delay ' and waiting for inlet start. ' '**************************************************************************************** Sub ChroRealTime(wRealTime As Integer) Dim hWnd As Long Dim wMsgRtn As Integer Dim wScanStatus As Integer Dim wCheckState As Integer Dim sVGFile As VGFILE hWnd = ChrohWnd() If hWnd Then wScanStatus = AiScanStatus() If (wScanStatus = AI_SCANNING) Or (wScanStatus = AI_INLET_RUNNING) Then Do If GetMLFileInfo("ACQUISITION", sVGFile) = 0 Then MsgBox "Acquisition File Name Error", 0, App.Title End If Loop Until FileExists(SZToVB(sVGFile.szDirectory) + SZToVB(sVGFile.szName) + "." + SZToVB(sVGFile.szExtension) + "\*.dat") Call MLRawFileOpen(GetMLFileName("ACQUISITION"), CHRO_OPEN) ChroDisplayAcquRange wMsgRtn = CheckMenuItem(hWnd, IDM_CHR_REALTIME, wRealTime) End If End If End Sub '**************************************************************************************** ' ' Purpose: Display currently acquiring data file in real time. ' Waits until the acquisition has completed before ' exiting from function. ' '**************************************************************************************** Sub ChroRealTimeAcqu() Dim hAcquStatus As Long Dim wAcquStatus As Integer Dim lpAcquStatus As String lpAcquStatus = "Acquisition Status" hAcquStatus = WaitForProcessStart(lpAcquStatus, 10) wAcquStatus = AiScanStatus() If hAcquStatus Then Do Until AcquDataActive() DoEvents Loop CHROM Call ChroRealTime(True) Do While AcquDataActive() DoEvents Loop Call ChroRealTime(False) End If End Sub '**************************************************************************************** ' ' Purpose: Remove one chromatogram from the current active spectrum window. ' '**************************************************************************************** Sub ChroRemove(wGraph As Integer) Dim hChro As Long Dim hRem As Long Dim hCtrl As Long Dim dwMsgRtn As Long Dim lpCaption As String lpCaption = "Remove Chromatogram" hChro = ChrohWnd() If hChro Then hRem = ProcessActive(lpCaption) If hRem = 0 Then dwMsgRtn = PostMessage(hChro, WM_COMMAND, 312, 0) hRem = WaitForProcessStart(lpCaption, 5) End If If hRem Then dwMsgRtn = LBoxSelString(hRem, 131, CStr(wGraph)) dwMsgRtn = PostMessage(hRem, WM_COMMAND, IDOK, 0) Call WaitForProcessEnd(lpCaption) End If End If DoEvents End Sub '________________________________________________________________________________________ ' ' Process: ChroRemoveAll ' ' Author: Roberto Raso ' Date: 25th May 1995 ' ' Purpose: Removes all the traces from the current chromatogram window. ' ' Parameters: None. ' ' Return: Void. '________________________________________________________________________________________ Sub ChroRemoveAll() Dim hDlg As Long Dim lMsgRtn As Long hDlg = MnuDlg_Disp(ChrohWnd(), IDM_CHRO_REMOVE, CAPTION_TRACE_REMOVE, 5, True) If hDlg Then lMsgRtn = SendMessage(hDlg, WM_COMMAND, 130, 0) lMsgRtn = SendMessage(hDlg, WM_COMMAND, IDOK, 0) Do While IsWindow(hDlg) DoEvents Loop End If End Sub '**************************************************************************************** ' ' Purpose: Calculate some special noise statistics about the chromatogram. ' '**************************************************************************************** Sub ChroStats(lpChroList() As CHROMATOGRAM, lpChroStats As ChroStats) Dim wEntry As Single Dim wFirstEntry As Single Dim wLastEntry As Single Dim fSum As Single Dim fSumSqr As Single Dim fNoiseSum As Single Dim fNoiseSumSqr As Single Dim fNoise As Single wFirstEntry = LBound(lpChroList) wLastEntry = UBound(lpChroList) lpChroStats.Min = 3.4E+38 lpChroStats.Max = 3.4E-38 fSum = 0 fSumSqr = 0 lpChroStats.NoiseMin = lpChroStats.Min lpChroStats.NoiseMax = lpChroStats.Max fNoiseSum = fSum fNoiseSumSqr = fSumSqr For wEntry = wFirstEntry To wLastEntry fSum = fSum + lpChroList(wEntry).Intensity fSumSqr = fSumSqr + lpChroList(wEntry).Intensity ^ 2 If lpChroList(wEntry).Intensity < lpChroStats.Min Then lpChroStats.Min = lpChroList(wEntry).Intensity End If If lpChroList(wEntry).Intensity > lpChroStats.Max Then lpChroStats.Max = lpChroList(wEntry).Intensity End If If wEntry > wFirstEntry And wEntry < wLastEntry Then fNoise = lpChroList(wEntry).Intensity - (lpChroList(wEntry - 1).Intensity + lpChroList(wEntry + 1).Intensity) / 2 fNoiseSum = fNoiseSum + fNoise fNoiseSumSqr = fNoiseSumSqr + fNoise ^ 2 If fNoise < lpChroStats.NoiseMin Then lpChroStats.NoiseMin = fNoise End If If fNoise > lpChroStats.NoiseMax Then lpChroStats.NoiseMax = fNoise End If End If Next wEntry lpChroStats.Num = wLastEntry - wFirstEntry + 1 lpChroStats.Ave = fSum / lpChroStats.Num lpChroStats.SD = Sqr(fSumSqr / lpChroStats.Num - lpChroStats.Ave ^ 2) lpChroStats.NoiseAve = fNoiseSum / (lpChroStats.Num - 2) lpChroStats.NoiseSD = Sqr(fNoiseSumSqr / (lpChroStats.Num - 2) - lpChroStats.NoiseAve ^ 2) End Sub Sub ChroTIC(bBPI As Long, wMode As Integer, nFunc As Integer) Const ID_FUNC_LIST = 1001 Dim hChro As Long Dim hTIC As Long Dim lIDMode As Long 'TGR 77 - Changed from integer 5/12/00 (CMS) Dim dwMsgRtn As Long Dim lpTICCaption As String lpTICCaption = "TIC Chromatogram" hChro = ChrohWnd() If hChro Then hTIC = MnuDlg_Disp(hChro, IDM_CHR_TIC, lpTICCaption, 5, True) If hTIC Then lIDMode = DlgItemValidate(hTIC, 320) Select Case wMode Case ADD lIDMode = 320 Case REPLACE lIDMode = 321 Case NEW_WINDOW lIDMode = 322 End Select Call CheckRadioButton(hTIC, 320, 322, lIDMode) Call CheckDlgButton32(hTIC, 301, bBPI) 'BPI check box dwMsgRtn = SendDlgItemMessage(hTIC, ID_FUNC_LIST, LB_SETSEL, False, ByVal CLng(-1)) dwMsgRtn = SendDlgItemMessage(hTIC, ID_FUNC_LIST, LB_SETSEL, True, ByVal CLng(nFunc - 1)) dwMsgRtn = PostMessage(hTIC, WM_COMMAND, IDOK, 0) Call WaitForProcessEnd(lpTICCaption) End If End If End Sub Sub ChroToClip() 'Copies the current chromatograms's 1st 64KByte displayed. CHROM SendKeys "%EL", True 'Copy current display to ClipBoard. DoEvents End Sub '**************************************************************************************** ' ' Purpose: Turn the Tool Bar ON or OFF. ' True is Tool Bar on. ' '**************************************************************************************** Sub ChroToolBar(wBarOn As Integer) Dim hWnd As Long Dim hMenu As Long Dim wState As Integer CHROM hWnd = ChrohWnd() wState = CheckMenuItem(hWnd, IDM_CHR_TOOLBAR, wBarOn) End Sub '________________________________________________________________________________________ ' ' Process: ChroTraceDisp ' ' Author: Roberto Raso ' Date: 25th May 1995 ' ' Purpose: Display a valid MassLynx chromatogram. ' ' Parameters: strTrace is the chromatogram descriptor. ' Note: strTrace can have the following values; ' TIC = Total Ion Current ' BPI = Base Peak Intensity ' ANn = Analogue Channel 'n' is the channel number. ' Any valid MassLynx mass chromatogram descriptor ' nMode has one of three values ADD, REPLACE or NEW_WINDOW. ' nFunc is the MS function number to use. ' ' Return: Void. '________________________________________________________________________________________ Sub ChroTraceDisp(strTrace As String, nMode As Integer, nFunc As Integer) Dim strTraceCopy As String strTraceCopy = UCase$(strTrace) If strTraceCopy = "TIC" Then Call ChroTIC(False, nMode, nFunc) ElseIf strTraceCopy = "BPI" Then Call ChroTIC(True, nMode, nFunc) ElseIf InStr(strTraceCopy, "AN") = 1 Then Call ChroAnalogue(CInt(Val(Right$(strTraceCopy, Len(strTraceCopy) - Len("AN")))), nMode) Else Call ChroMassChro(strTrace, nMode, nFunc) End If End Sub '---------------------------------------------------------------------------------------- ' ' Process: ChroTraceSet ' ' Author: Roberto Raso ' Date: 20th November 1995 ' ' Purpose: Sets the current trace. ' ' Parameters: nTrace is the trace to set. ' ' Return: nTrace if successful. ' '---------------------------------------------------------------------------------------- Function ChroTraceSet(nTrace As Integer) As Integer Const TRACE_START = &H1A3 Dim hChro As Long Dim lMsgRtn As Long hChro = ChrohWnd() If hChro = 0 Then ChroTraceSet = 0 Exit Function End If If InStr(GetMenuText(hChro, TRACE_START + nTrace), Chr$(0)) <> 1 Then lMsgRtn = SendMessage(hChro, WM_COMMAND, TRACE_START + nTrace, 0) ChroTraceSet = nTrace Else ChroTraceSet = 0 End If End Function Sub ChroXAxisLabel(ScanOrTime As Integer) 'This subroutine sets the X-Axis to 'either SCAN or TIME. 'Use for Time: ' ChroXAxisLabel CX_TIME 'Use for Scan number: ' ChroXAxisLabel CX_SCAN Dim AxisLabel As String If ScanOrTime = CX_TIME Then AxisLabel = "%XT" Else AxisLabel = "%XS" End If CHROM Call AppActivate("Chromatogram - ") SendKeys "%D", True DoEvents SendKeys "V", True DoEvents SendKeys AxisLabel, True SendKeys "{ENTER}", True DoEvents End Sub '---------------------------------------------------------------------------------------- ' ' Process: ChroAlign ' ' Author: Roberto Raso ' Date: 20th November 1995 ' ' Purpose: Gets the alignment value, for a trace for a function. ' ' Parameters: nTrace is the trace to set the align time on ' fAlignTime is the time to use to align the data. ' ' Return: Void. ' '---------------------------------------------------------------------------------------- Sub ChroAlign(nTrace As Integer, fAlignTime As Single) Dim hChro As Long Dim hAlign As Long Dim hText As Long Dim lMsgRtn As Long Dim strCaption As String strCaption = "Align Chromatogram Time" hChro = ChrohWnd() If hChro = 0 Then Exit Sub End If If ChroTraceSet(nTrace) <> nTrace Then Exit Sub End If hAlign = MnuDlg_Disp(hChro, IDM_CHRO_ALIGN, "Align Chromatogram Time", 5, True) hText = GetDlgItem32(hAlign, 314) lMsgRtn = SendMessageText(hText, CStr(fAlignTime)) If DlgBoxClose(hAlign, IDOK, CDbl(CVDate("00:00:10"))) = False Then MsgBox "Unable to close " + strCaption, 0, App.Title End If End Sub '**************************************************************************************** ' ' Purpose: Convert chromatogram descriptor to MassLynx ' DMRAWCHRTYPE format type strucrure. ' Returns TRUE if successful. ' '**************************************************************************************** Function ChroDescToChroType(lpChroDesc As String, lpChroType As DMRAWCHRTYPE) As Integer Dim wDmRet As Integer Dim wTICBPI As Integer Dim lpChroDescClean As String wTICBPI = False lpChroDescClean = UCase$(Trim$(lpChroDesc)) If lpChroDescClean = "TIC" Then lpChroType.nChroType = DM_RAW_CHRO_TIC wTICBPI = True ChroDescToChroType = True ElseIf lpChroDescClean = "BPI" Then lpChroType.nChroType = DM_RAW_CHRO_BPI wTICBPI = True ChroDescToChroType = True ElseIf DmRawIsAnalogTraceDesc(lpChroDescClean) Then lpChroType.nChroType = DM_RAW_CHRO_ANALOG wTICBPI = True ChroDescToChroType = True End If If Not wTICBPI Then wDmRet = DmRawStrToMass(lpChroDescClean, lpChroType.afMasses(0), DM_RAW_MAXMASSES + 1, 0&) If wDmRet > 0 Then If InStr(1, lpChroDescClean, "+") Or InStr(1, lpChroDescClean, "_") Then lpChroType.nChroType = DM_RAW_CHRO_SUM ChroDescToChroType = True Else lpChroType.nChroType = DM_RAW_CHRO_MASS ChroDescToChroType = True End If Else ChroDescToChroType = False End If End If End Function '**************************************************************************************** ' ' Purpose: Display chromatogram over acquired scan/RT range. ' '**************************************************************************************** Sub ChroDisplayAcquRange() ChroDisplayDefault ChroDisplayDefault End Sub '**************************************************************************************** ' ' Purpose: Display chromatogram default scan/RT range. ' '**************************************************************************************** Sub ChroDisplayDefault() Call ProcDialog_OK(ChrohWnd(), IDM_CHR_DEFAULT, "Default Chromatogram Range", Chr$(0)) End Sub Sub ChroDisplayFrom(LoScanTime As Single) 'Sets current chromatogram lower display point. Dim LoScanTimeInput As String LoScanTimeInput = "%F" + CStr(LoScanTime) CHROM SendKeys "%D", True DoEvents SendKeys "N", True DoEvents SendKeys "F", True DoEvents SendKeys LoScanTimeInput, True SendKeys "{ENTER}", True DoEvents End Sub