diff --git a/Chemistry.vbp b/Chemistry.vbp index dfd0b9a..4d2076a 100644 --- a/Chemistry.vbp +++ b/Chemistry.vbp @@ -21,20 +21,21 @@ Form=frmGas.frm IconForm="frmMain" Startup="Sub Main" HelpFile="" -Title="Chemistry" +Title="化学e+" ExeName32="Chemistry.exe" Command32="" Name="ChemicalTools" HelpContextID="0" -Description="Chemical Tools" +Description="化学e+" CompatibleMode="0" -MajorVer=2 -MinorVer=1 -RevisionVer=21 +MajorVer=3 +MinorVer=0 +RevisionVer=2 AutoIncrementVer=1 ServerSupportFiles=0 -VersionCompanyName="华东师范大学团队一号" +VersionCompanyName="华东师范大学团队二号" VersionFileDescription="Chemical Tools" +VersionLegalCopyright="曾晋哲" VersionProductName="化学e+" CompilationType=0 OptimizationType=0 diff --git a/Chemistry.vbw b/Chemistry.vbw index 3aea41e..135479d 100644 --- a/Chemistry.vbw +++ b/Chemistry.vbw @@ -1,17 +1,16 @@ -frmMain = 148, 112, 676, 548, C, 94, 130, 686, 568, C -modCalculate = -19, 51, 1005, 475, -modData = 146, 96, 1009, 580, -frmElement = 34, 92, 920, 532, C, 69, 118, 565, 558, C -frmMass = -72, 226, 818, 668, C, 58, 90, 671, 584, C +frmMain = 414, 58, 942, 492, C, 186, 3, 859, 522, C +modCalculate = -66, 54, 958, 472, C +modData = 24, 0, 888, 481, C +frmElement = 103, 93, 989, 533, C, 69, 118, 565, 558, C +frmMass = 125, 79, 1015, 521, C, 58, 90, 671, 584, C modUI = -322, 150, 564, 586, C -modMain = -347, 267, 539, 726, C -modExam = 40, 26, 926, 466, -frmExam = 145, 179, 1031, 527, C, -289, 192, 594, 663, C -frmAbout = 104, 104, 989, 544, C, -196, 205, 690, 603, C -frmOptions = 186, 137, 1072, 577, I, 108, 6, 994, 564, C -frmLogin = 92, 121, 922, 538, C, 74, 117, 600, 541, C -frmSignUp = 466, 23, 993, 447, , 186, 45, 713, 469, C -FrmChangePassword = 167, 159, 1051, 599, C, -150, 206, 735, 646, C -frmpH = -12, 79, 872, 519, C, 88, 105, 637, 557, C +modMain = 55, 60, 941, 519, C +modExam = 40, 26, 926, 466, C +frmExam = 145, 179, 1031, 527, C, 144, 56, 1027, 527, C +frmAbout = 12, 39, 897, 479, C, 59, 94, 945, 492, C +frmOptions = 291, 32, 1177, 472, , 108, 6, 994, 564, C +frmLogin = 203, 54, 1033, 470, C, 74, 117, 600, 541, C +frmSignUp = 466, 23, 993, 447, C, 186, 45, 713, 469, C +frmpH = 158, 73, 1042, 513, C, 88, 105, 637, 557, C frmThermodynamics = -240, 126, 645, 566, C, 191, 102, 1075, 612, C frmGas = 14, 159, 898, 598, C, 126, 141, 734, 721, C diff --git a/frmAbout.frm b/frmAbout.frm index c63b9b1..64befaf 100644 --- a/frmAbout.frm +++ b/frmAbout.frm @@ -86,7 +86,7 @@ Begin VB.Form frmAbout End Begin VB.Label lblTitle BackStyle = 0 'Transparent - Caption = "Chemical Tools" + Caption = "化学e+" BeginProperty Font Name = "微软雅黑" Size = 14.25 diff --git a/frmAbout.frx b/frmAbout.frx index f63c0cb..84efad3 100644 Binary files a/frmAbout.frx and b/frmAbout.frx differ diff --git a/frmElement.frm b/frmElement.frm index e0d8d38..b5ef65d 100644 --- a/frmElement.frm +++ b/frmElement.frm @@ -34,6 +34,7 @@ Begin VB.Form frmElement Left = 2400 Locked = -1 'True MultiLine = -1 'True + ScrollBars = 2 'Vertical TabIndex = 6 Text = "frmElement.frx":1B692 Top = 2880 @@ -178,7 +179,7 @@ Private Sub cmdCopy_Click() End Sub Private Sub cmdElement_Click() - Dim n As Integer + Dim n As Integer, ElementOutput As String, ElementOutputHtml As String n = calElementChoose(texElementIn.texT) If n > 0 Then lblElementNumber = n @@ -188,9 +189,18 @@ Private Sub cmdElement_Click() HisElement = texElementIn.texT Call dataBaseWrite(DataUsername, "Element", HisElement) End If - texElementOut.texT = calElementStr(n) - If Not DataUsername = "访客" Then - Call dataHtmlChange("historyElement", CStr(HisElement)) + ElementOutput = calElementStr(n) + texElementOut = CutHtml(ElementOutput) + If n > 0 Then + ElementOutputHtml = ElementOutput & Chr(10) & "访问维基百科" + HisElementOutput = texElementOut + Call dataBaseWrite(DataUsername, "ElementOutput", HisElementOutput) + If Not DataUsername = "访客" And n > 0 Then + Call dataHtmlChange("historyElementOutputHtml", CStr(ElementOutputHtml)) + Call dataHtmlChange("historyElementOutput", CStr(ElementOutput)) + Call dataHtmlChange("historyElementNumber", CStr(n)) + Call dataHtmlChange("historyElement", CStr(HisElement)) + End If End If End Sub @@ -204,7 +214,9 @@ Private Sub Form_Load() lblElementName = ElementName(n) lblElementAbbr = ElementAbbr(n) lblElementMass = ElementMass(n) - texElementOut.texT = calElementStr(n) + End If + If HisElementOutput <> "" Then + texElementOut = HisElementOutput End If End Sub @@ -235,3 +247,4 @@ Private Sub texElementIn_KeyPress(KeyAscii As Integer) texElementIn.ForeColor = RGB(0, 0, 0) End If End Sub + diff --git a/frmExam.frm b/frmExam.frm index b9f11cc..6386ffa 100644 --- a/frmExam.frm +++ b/frmExam.frm @@ -308,8 +308,6 @@ Private Sub imgTitle_MouseDown(Button As Integer, Shift As Integer, x As Single, SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& End Sub - - Private Sub texExam_Click() If texExam.texT = InTip Then texExam.texT = "" diff --git a/frmMass.frm b/frmMass.frm index ffa7607..acedd96 100644 --- a/frmMass.frm +++ b/frmMass.frm @@ -96,10 +96,15 @@ Private Sub cmdCopy_Click() End Sub Private Sub cmdMass_Click() - texMassOut = calMassPerStr(texMassIn.texT) + Dim MassOutHtml As String + MassOutHtml = calMassPerStr(texMassIn.texT) + texMassOut = CutHtml(MassOutHtml) HisMass = texMassIn.texT + HisMassOutput = texMassOut Call dataBaseWrite(DataUsername, "Mass", HisMass) + Call dataBaseWrite(DataUsername, "MassOutput", HisMassOutput) If Not DataUsername = "访客" Then + Call dataHtmlChange("historyMassOutput", CStr(MassOutHtml)) Call dataHtmlChange("historyMass", CStr(HisMass)) End If End Sub @@ -107,7 +112,8 @@ End Sub Private Sub Form_Load() InTip = "请在此处输入物质化学式,例如:K4[Fe(CN)6]" texMassIn.texT = InTip - If HisMass <> "" Then texMassOut = calMassPerStr(HisMass) + 'If HisMass <> "" Then texMassOut = calMassPerStr(HisMass) + If HisMassOutput <> "" Then texMassOut = HisMassOutput End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single) @@ -124,7 +130,6 @@ Private Sub imgTitle_MouseDown(Button As Integer, Shift As Integer, x As Single, SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& End Sub - Private Sub texMassIn_Click() If texMassIn.texT = InTip Then texMassIn.texT = "" diff --git a/frmOptions.frm b/frmOptions.frm index 5c26ead..5dbd5f5 100644 --- a/frmOptions.frm +++ b/frmOptions.frm @@ -317,6 +317,9 @@ Private Function WriteOptions() As Boolean ExamTimeMax = TimeMax If chkTimeIf.Value = 1 Then ExamTimeIf = True Else ExamTimeIf = False Call dataSettingSave(DataUsername) + If Not DataUsername = "访客" Then + Call dataHtmlChange("elementnumber_limit", CStr(ExamNumberMax)) + End If Else MsgBox ErrorInfo End If diff --git a/frmpH.frm b/frmpH.frm index d34d7ff..2ab30bd 100644 --- a/frmpH.frm +++ b/frmpH.frm @@ -205,19 +205,23 @@ Private Sub cmdCopy_Click() End Sub Private Sub cmdpH_Click() - Dim AorB As Boolean + Dim AorB As Boolean, pHOutHtml As String If comboAB = "酸" Then AorB = True Else AorB = False - texpHOut = calpHOut(texpKa, texc, texpKw, AorB) + pHOutHtml = calpHOut(texpKa, texc, texpKw, AorB) + texpHOut = CutHtml(pHOutHtml) Hisc = texc HispKa = texpKa HispKw = texpKw HisAB = AorB + HisAcidOutput = CStr(texpHOut) Call dataBaseWrite(DataUsername, "c", Hisc) Call dataBaseWrite(DataUsername, "pKa", HispKa) Call dataBaseWrite(DataUsername, "pKw", HispKw) + Call dataBaseWrite(DataUsername, "AcidOutput", texpHOut) If HisAB Then Call dataBaseWrite(DataUsername, "AB", "A") Else Call dataBaseWrite(DataUsername, "AB", "B") If Not DataUsername = "访客" Then Call dataHtmlChange("pKw", CStr(HispKw)) + Call dataHtmlChange("historyAcidOutput", CStr(pHOutHtml)) End If End Sub @@ -240,8 +244,9 @@ Private Sub Form_Load() texpKa.texT = InTip texc.texT = InTipb comboAB.ListIndex = 0 - If Hisc <> "" And HispKa <> "" Then - texpHOut = calpHOut(HispKa, Hisc, HispKw, HisAB) + texpKw = HispKw + If HisAcidOutput <> "" Then + texpHOut = HisAcidOutput End If End Sub diff --git a/mdb/Data.mdb b/mdb/Data.mdb index ae02447..1f5c991 100644 Binary files a/mdb/Data.mdb and b/mdb/Data.mdb differ diff --git a/mdb/User.mdb b/mdb/User.mdb index ab08ab3..b88993b 100644 Binary files a/mdb/User.mdb and b/mdb/User.mdb differ diff --git a/modCalculate.bas b/modCalculate.bas index e8adc70..64cb47f 100644 --- a/modCalculate.bas +++ b/modCalculate.bas @@ -8,22 +8,22 @@ Public Type MaterialAtom End Type Function calElementChoose(x As String) As Integer - Dim i As Integer, T As Boolean + Dim i As Integer, t As Boolean i = 0 - T = False - While i < 118 And T = False + t = False + While i < 118 And t = False i = i + 1 If i = Int(Val(x)) Then calElementChoose = i - T = True + t = True ElseIf ElementName(i) = x Then calElementChoose = i - T = True + t = True ElseIf UCase(ElementAbbr(i)) = UCase(x) Then calElementChoose = i - T = True + t = True Else - T = False + t = False End If Wend If IsNull(calElementChoose) = True Then calElementChoose = 0 @@ -57,7 +57,7 @@ End Function Function calAtom(x As String) As MaterialAtom ReDim calAtom.AtomNumber(118) As Integer Dim AtomNumber(118) As Integer - Dim i As Integer, l As Integer, y1 As String, y2 As String, y3 As String, y4 As String, T As String, n As Integer, s As Integer, i2 As Integer + Dim i As Integer, l As Integer, y1 As String, y2 As String, y3 As String, y4 As String, t As String, n As Integer, s As Integer, i2 As Integer calAtom.Material = x l = Len(x) If l = 0 Then calAtom.AtomNumber(0) = 1 Else calAtom.AtomNumber(0) = 0 @@ -120,8 +120,8 @@ Function calAtom(x As String) As MaterialAtom If calAsc(y1) = 1 Then '首位为大写字母 If i >= l Then y2 = "1" Else y2 = Mid(x, i + 1, 1) If calAsc(y2) = 2 Then '第2位为小写 - T = y1 & y2 - n = calElementChoose(T) + t = y1 & y2 + n = calElementChoose(t) If n = 0 Then calAtom.AtomNumber(0) = 1 Else @@ -214,22 +214,32 @@ End Function Function calMassPer(x As MaterialAtom) As String Dim i As Integer If x.TotalMass = -1 Then - calMassPer = "您的输入有误,请重新输入!" & Chr(13) & Chr(10) & "请检查:" & Chr(13) & Chr(10) & "1.元素符号是否正确(区分大小写);" & Chr(13) & Chr(10) & "2.括号是否缺少。" + calMassPer = "您的输入有误,请重新输入!" & Chr(10) & "请检查:" & Chr(10) & "1.元素符号是否正确(区分大小写);" & Chr(10) & "2.括号是否缺少。" Else - calMassPer = x.Material & "的" & "分子量为" & x.TotalMass & ",其中:" & Chr(13) & Chr(10) + Dim MaterialHtml As String, t As String + For i = 1 To Len(x.Material) + t = Mid(x.Material, i, 1) + If IsNumeric(t) Then + MaterialHtml = MaterialHtml & "" & t & "" + Else + MaterialHtml = MaterialHtml & t + End If + Next i + calMassPer = MaterialHtml & Chr(10) & "相对分子质量=" & Format(x.TotalMass, "0.00") & Chr(10) For i = 1 To 118 If x.AtomNumber(i) > 0 Then - calMassPer = calMassPer & ElementName(i) & "(符号:" & ElementAbbr(i) & ")," & x.AtomNumber(i) & "个原子,原子量为" & Format(ElementMass(i), "0.00") & ",质量分数为" & Format(x.AtomMassPer(i), "0.00%") & ";" & Chr(13) & Chr(10) + calMassPer = calMassPer & ElementName(i) & "(符号:" & ElementAbbr(i) & ")," & x.AtomNumber(i) & "个原子,原子量为" & Format(ElementMass(i), "0.00") & ",质量分数为" & Format(x.AtomMassPer(i), "0.00%") & ";" & Chr(10) End If Next i + calMassPer = Mid(calMassPer, 1, Len(calMassPer) - 2) & "。" End If End Function Function calElementStr(n As Integer) As String If n > 0 Then - calElementStr = ElementName(n) & Chr(13) & Chr(10) & "原子序数:" & n & Chr(13) & Chr(10) & "元素符号:" & ElementAbbr(n) & Chr(13) & Chr(10) & "相对原子质量:" & ElementMass(n) + calElementStr = "元素名称:" & ElementName(n) & Chr(10) & "元素符号:" & ElementAbbr(n) & Chr(10) & "IUPAC名:" & ElementIUPAC(n) & Chr(10) & "原子序数:" & n & Chr(10) & "相对原子质量:" & ElementMass(n) & Chr(10) & "元素名称含义:" & ElementOrigin(n) Else - calElementStr = "输入错误!" & Chr(13) & Chr(10) & "请检查您的输入是否有误!" + calElementStr = "输入错误!" & Chr(10) & "请检查您的输入是否有误!" End If End Function @@ -278,49 +288,64 @@ Function calpHOut(pKa As String, c As String, pKw As String, AorB As Boolean) As Dim i As Integer, j As Integer Dim error As Boolean Dim n As Integer + Dim liquidpKa As Double, ABname As String + liquidpKa = -1.74 error = False If Val(c) = 0 Or Not IsNumeric(pKw) Then error = True - calpHOut = "c=" & c & ", " + If AorB Then + ABname = "HA" + pKsub = "a" + Else + ABname = "BOH" + pKsub = "b" + End If + calpHOut = ABname & ",c=" & c & ", " If pKa = "" Then pKa = "error" strpKa() = Split(pKa) ReDim valpKa(UBound(strpKa)) For i = LBound(strpKa) To UBound(strpKa) If Not IsNumeric(strpKa(i)) Then error = True valpKa(i) = Val(strpKa(i)) - If AorB Then calpHOut = calpHOut & "pKa" Else calpHOut = calpHOut & "pKb" - calpHOut = calpHOut & i + 1 & "=" & strpKa(i) & ", " + If (valpKa(i) < liquidpKa) Then valpKa(i) = liquidpKa + If AorB Then calpHOut = calpHOut & "pKa" Else calpHOut = calpHOut & "pKb" + If LBound(strpKa) = UBound(strpKa) Then calpHOut = calpHOut & "=" & strpKa(i) & ", " Else calpHOut = calpHOut & "" & i + 1 & "=" & strpKa(i) & ", " Next i - calpHOut = calpHOut & Chr(13) & Chr(10) + calpHOut = calpHOut & Chr(10) pH = calpH(valpKa(), Val(c), Val(pKw)) cAB = calpHtoc(valpKa(), Val(c), Val(pH)) If Not AorB Then pH = pKw - pH H = 10 ^ (-pH) - calpHOut = calpHOut & "溶液的pH为" & Format(pH, "0.00") & Chr(13) & Chr(10) & "c(H+)=" & Format(H, "Scientific") & Chr(13) & Chr(10) + calpHOut = calpHOut & "溶液的pH为" & Format(pH, "0.00") & "." & Chr(10) & "c(H+)=" & Format(H, "Scientific") & "mol/L," & Chr(10) For i = LBound(cAB) To UBound(cAB) calpHOut = calpHOut & "c(" If AorB Then If i < UBound(cAB) Then calpHOut = calpHOut & "H" - If UBound(cAB) - i > 1 Then calpHOut = calpHOut & UBound(cAB) - i + If UBound(cAB) - i > 1 Then calpHOut = calpHOut & "" & UBound(cAB) - i & "" End If calpHOut = calpHOut & "A" If i > 0 Then - If i > 1 Then calpHOut = calpHOut & i - calpHOut = calpHOut & "-" + If i > 1 Then calpHOut = calpHOut & "" & i & "" + calpHOut = calpHOut & "-" End If Else calpHOut = calpHOut & "B" If UBound(cAB) - i > 1 Then - calpHOut = calpHOut & "(OH)" & UBound(cAB) - i + calpHOut = calpHOut & "(OH)" & "" & UBound(cAB) - i & "" ElseIf UBound(cAB) - i = 1 Then calpHOut = calpHOut & "OH" End If If i > 0 Then - If i > 1 Then calpHOut = calpHOut & i - calpHOut = calpHOut & "+" + If i > 1 Then calpHOut = calpHOut & "" & i & "" + calpHOut = calpHOut & "+" End If End If - calpHOut = calpHOut & ")=" & Format(cAB(i), "Scientific") & Chr(13) & Chr(10) + calpHOut = calpHOut & ")=" & Format(cAB(i), "Scientific") & "mol/L" + If i = UBound(cAB) Then + calpHOut = calpHOut & "." + Else + calpHOut = calpHOut & "," & Chr(10) + End If Next i If error = True Then calpHOut = "输入错误,请重新输入!" End Function @@ -329,7 +354,7 @@ Function calRelixue(H1 As String, H2 As String, S1 As String, S2 As String) As S Dim strH1() As String, strH2() As String, strS1() As String, strS2() As String Dim sumH1 As Double, sumH2 As Double, sumS1 As Double, sumS2 As Double Dim s As Double - Dim detH As Double, detS As Double, detG As Double, T As Double, K As Double + Dim detH As Double, detS As Double, detG As Double, t As Double, K As Double If H1 = "" Then H1 = "0" If H2 = "" Then H2 = "0" If S1 = "" Then S1 = "0" @@ -358,16 +383,16 @@ Function calRelixue(H1 As String, H2 As String, S1 As String, S2 As String) As S s = s + Val(strS2(i)) Next i sumS2 = s - calRelixue = "反应物的总生成焓为" & Format(sumH1, "0.0") & "kJ/mol,生成物的总生成焓为" & Format(sumH2, "0.0") & "kJ/mol,反应物的总标准熵为" & Format(sumS1, "0.0") & "J/mol,生成物的总标准熵为" & Format(sumS2, "0.0") & "J/mol。" & Chr(13) & Chr(10) + calRelixue = "反应物的总生成焓为" & Format(sumH1, "0.0") & "kJ/mol,生成物的总生成焓为" & Format(sumH2, "0.0") & "kJ/mol,反应物的总标准熵为" & Format(sumS1, "0.0") & "J/mol,生成物的总标准熵为" & Format(sumS2, "0.0") & "J/mol。" & Chr(10) detH = sumH2 - sumH1 detS = sumS2 - sumS1 detG = detH - 298.15 * detS / 1000 K = Exp(-detG * 1000 / R / 298.15) - calRelixue = calRelixue & "反应的标准摩尔焓变为" & Format(detH, "0.0") & "kJ/mol," & "标准摩尔熵变为" & Format(detS, "0.0") & "J/mol" & ",标准摩尔吉布斯自由能为" & Format(detG, "0.0") & "kJ/mol,标准平衡常数为" & Format(K, "Scientific") & "。" & Chr(13) & Chr(10) + calRelixue = calRelixue & "反应的标准摩尔焓变为" & Format(detH, "0.0") & "kJ/mol," & "标准摩尔熵变为" & Format(detS, "0.0") & "J/mol" & ",标准摩尔吉布斯自由能为" & Format(detG, "0.0") & "kJ/mol,标准平衡常数为" & Format(K, "Scientific") & "。" & Chr(10) If detH >= 0 Then If detS >= 0 Then - T = detH / detS * 1000 - calRelixue = calRelixue & "温度T<" & Format(T, "0.0") & "K时,该反应能自发进行," & "温度T>" & Format(T, "0.0") & "K时,该反应不能自发进行。" + t = detH / detS * 1000 + calRelixue = calRelixue & "温度T<" & Format(t, "0.0") & "K时,该反应能自发进行," & "温度T>" & Format(t, "0.0") & "K时,该反应不能自发进行。" Else calRelixue = calRelixue & "在任何温度下,该反应均不能自发进行。" End If @@ -375,22 +400,22 @@ Function calRelixue(H1 As String, H2 As String, S1 As String, S2 As String) As S If detS >= 0 Then calRelixue = calRelixue & "在任何温度下,该反应均能自发进行。" Else - T = detH / detS * 1000 - calRelixue = calRelixue & "温度T>" & Format(T, "0.0") & "K时,该反应能自发进行," & "温度T<" & Format(T, "0.0") & "K时,该反应不能自发进行。" + t = detH / detS * 1000 + calRelixue = calRelixue & "温度T>" & Format(t, "0.0") & "K时,该反应能自发进行," & "温度T<" & Format(t, "0.0") & "K时,该反应不能自发进行。" End If End If End Function -Function calGasp(v As Double, n As Double, T As Double) - calGasp = n * R * T / v +Function calGasp(v As Double, n As Double, t As Double) + calGasp = n * R * t / v End Function -Function calGasV(p As Double, n As Double, T As Double) - calGasV = n * R * T / p +Function calGasV(p As Double, n As Double, t As Double) + calGasV = n * R * t / p End Function -Function calGasn(p As Double, v As Double, T As Double) - calGasn = p * v / R / T +Function calGasn(p As Double, v As Double, t As Double) + calGasn = p * v / R / t End Function Function calGasT(p As Double, v As Double, n As Double) diff --git a/modData.bas b/modData.bas index 7c481ef..70e99b8 100644 --- a/modData.bas +++ b/modData.bas @@ -14,6 +14,7 @@ Public LoginUsername As String Public LoginPassword As String Public LoginSavingPassword As Integer Public LoginAutoLogin As Integer +Public objectID As String '配置 Public ExamTimeMax As Integer Public ExamNumberMax As Integer @@ -34,11 +35,15 @@ Public Hisc As String Public HispKa As String Public HispKw As String Public HisAB As Boolean +Public HisElementOutput As String +Public HisMassOutput As String +Public HisAcidOutput As String '元素 Public ElementName(118) As String Public ElementAbbr(118) As String Public ElementMass(118) As Double - +Public ElementIUPAC(118) As String +Public ElementOrigin(118) As String Public xmlhttp As Object Public htmlStr As String @@ -93,6 +98,8 @@ Public Function dataElement() If Not IsNull(DataAdodbRs!ElementName) Then ElementName(n) = CStr(DataAdodbRs!ElementName) If Not IsNull(DataAdodbRs!ElementAbbr) Then ElementAbbr(n) = CStr(DataAdodbRs!ElementAbbr) If Not IsNull(DataAdodbRs!ElementMass) Then ElementMass(n) = CStr(DataAdodbRs!ElementMass) + If Not IsNull(DataAdodbRs!Origin) Then ElementOrigin(n) = CStr(DataAdodbRs!Origin) + If Not IsNull(DataAdodbRs!iupac) Then ElementIUPAC(n) = CStr(DataAdodbRs!iupac) DataAdodbRs.MoveNext Wend Call dataClose @@ -222,6 +229,7 @@ Public Function dataLogin(Username As String, Password As String, SavingPassword 'json = dataHtmlLogin(Username, Password, SavingPassword, AutoLogin) If JSONParse("sessionToken", json) <> "0" Then token = JSONParse("sessionToken", json) + objectID = JSONParse("objectId", json) Call dataOpen(2) DataAdodbRs.Open "select * from [User]" While Not DataAdodbRs.EOF And dataLogin = False @@ -258,7 +266,7 @@ Public Function dataLogin(Username As String, Password As String, SavingPassword DataAdodbRs("NumberMax") = Val(JSONParse("elementnumber_limit", json)) End If If Not (JSONParse("historyElement", json) = "") Then - DataAdodbRs("Element") = Val(JSONParse("historyElement", json)) + DataAdodbRs("Element") = Val(JSONParse("historyElementNumber", json)) End If If Not ((JSONParse("historyMass", json) = "")) Then DataAdodbRs("Mass") = JSONParse("historyMass", json) @@ -275,6 +283,15 @@ Public Function dataLogin(Username As String, Password As String, SavingPassword If Not ((JSONParse("examIncorrectnumber", json) = "")) Then DataAdodbRs("Incorrectnumber") = Val(JSONParse("examIncorrectnumber", json)) End If + If Not ((JSONParse("historyElementOutput", json) = "")) Then + DataAdodbRs("ElementOutput") = CutHtml(JSONParse("historyElementOutput", json)) + End If + If Not ((JSONParse("historyMassOutput", json) = "")) Then + DataAdodbRs("MassOutput") = CutHtml(JSONParse("historyMassOutput", json)) + End If + If Not ((JSONParse("historyAcidOutput", json) = "")) Then + DataAdodbRs("AcidOutput") = CutHtml(JSONParse("historyAcidOutput", json)) + End If DataUseNumber = CStr(DataAdodbRs!UseNumber) DataUseNumber = DataUseNumber + 1 DataAdodbRs("UseNumber") = DataUseNumber @@ -311,6 +328,9 @@ Public Function dataLogin(Username As String, Password As String, SavingPassword HispKw = CStr(DataAdodbRs!pKw) HispKa = CStr(DataAdodbRs!pKa) DataQQname = CStr(DataAdodbRs!qqname) + HisElementOutput = CStr(DataAdodbRs!ElementOutput) + HisMassOutput = CStr(DataAdodbRs!massoutput) + HisAcidOutput = CStr(DataAdodbRs!AcidOutput) If CStr(DataAdodbRs!AB) = "A" Then HisAB = True Else HisAB = False If CStr(DataAdodbRs!TimeIf) = "True" Then ExamTimeIf = True Else ExamTimeIf = False Call dataClose @@ -452,10 +472,31 @@ End Function Public Function dataHtmlChange(Name As String, Value As String) Randomize - strUrl = "https://chemapp.njzjz.win/winchange.php?token=" & token & "&name=" & Name & "&value=" & Value & "&t=" & Rnd - Set xmlhttp = CreateObject("Microsoft.XMLHTTP") + Value = Replace(Value, Chr(10), "\n") + 'strUrl = "https://chemapp.njzjz.win/winchange.php?token=" & token & "&name=" & Name & "&value=" & Value & "&t=" & Rnd + 'Set xmlhttp = CreateObject("Microsoft.XMLHTTP") 'If JSONParse("errorcode", strData) = "0" Then dataHtmlChange = True Else dataHtmlChange = False - xmlhttp.Open "GET", strUrl, True - xmlhttp.send + strUrl = "https://api.leancloud.cn/1.1/users/" & objectID & "?t=" & Rnd + Set xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1") + xmlhttp.Open "PUT", strUrl, True + xmlhttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300 + xmlhttp.SetRequestHeader "X-LC-Id", "wUzGKF5dp34OqCeaI0VwVG8E-gzGzoHsz" + xmlhttp.SetRequestHeader "X-LC-Key", "QiyXtJjBHFJCIVYQRbrKFiB7" + xmlhttp.SetRequestHeader "X-LC-Session", token + xmlhttp.SetRequestHeader "Content-Type", "application/json" + xmlhttp.send "{""" & Name & """:""" & Value & """}" + xmlhttp.waitforresponse End Function +Public Function CutHtml(all As String) As String + ok = "" + S1 = InStr(1, all, "<") + While S1 > 0 And S2 < Len(all) + ok = ok & Mid(all, S2 + 1, S1 - S2 - 1) + S2 = InStr(S1 + 1, all, ">") + S1 = InStr(S2 + 1, all, "<") + Wend + ok = ok & Mid(all, S2 + 1, Len(all) - S2) + ok = Replace(ok, Chr(10), Chr(13) & Chr(10)) + CutHtml = ok +End Function