{"id":1130,"date":"2022-09-01T03:13:41","date_gmt":"2022-09-01T03:13:41","guid":{"rendered":"https:\/\/262235.xyz\/?p=1130"},"modified":"2022-09-01T03:13:41","modified_gmt":"2022-09-01T03:13:41","slug":"1130","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2022\/09\/01\/1130\/","title":{"rendered":"CorelVBA \u4f7f\u7528\u591a\u7ebf\u7a0b CreateThread  \u89e3\u51b3\u4eba\u5de5\u8bed\u97f3\u5bfc\u81f4\u811a\u672c\u5361\u4f4f\uff0c\u8fd8\u6ca1\u6709\u89e3\u51b3"},"content":{"rendered":"<h2>CorelVBA \u4f7f\u7528\u591a\u7ebf\u7a0b CreateThread  \u89e3\u51b3\u4eba\u5de5\u8bed\u97f3\u5bfc\u81f4\u811a\u672c\u5361\u4f4f\uff0c\u8fd8\u6ca1\u6709\u89e3\u51b3<\/h2>\n<pre><code>#If VBA7 Then\n  Private Declare PtrSafe Function CreateThread Lib \"kernel32\" (ByVal Fkfpnhh As Long, ByVal Xref As Long, ByVal Jxnj As Long, Mlgstptp As Long, ByVal Bydro As Long, Rny As Long) As Long\n  Private Declare PtrSafe Function TerminateThread Lib \"kernel32\" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long\n#Else\n  Private Declare Function CreateThread Lib \"kernel32\" (ByVal Fkfpnhh As Long, ByVal Xref As Long, ByVal Jxnj As Long, Mlgstptp As Long, ByVal Bydro As Long, Rny As Long) As Long\n  Private Declare Function TerminateThread Lib \"kernel32\" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long\n#End If\nPublic id As Long\n\nPrivate Function Speech_Speak(message As String)\n  Dim sapi\n  Set sapi = CreateObject(\"sapi.spvoice\")\n  sapi.Rate = 0\n  sapi.Speak message\nEnd Function\n\n\nPublic Function Speak_Msg(message As String)\nSpeak_Help = Val(GetSetting(\"lyvba.com\", \"Settings\", \"SpeakHelp\", \"1\"))\nIf Val(Speak_Help) = 8 Then\n  id = CreateThread(0, 0, Speech_Speak(message), 0, 0, 0)\n\n  Call TerminateThread(id, ByVal 0&amp;)\nElse\n  ' \u4e0d\u8bf4\u8bdd\nEnd If\n\nEnd Function<\/code><\/pre>\n<h2>VBA \u4eba\u5de5\u8bed\u97f3\u793a\u4f8b\u4ee3\u7801<\/h2>\n<pre><code>Sub Speech_Speak()\n\nDim objSV\nSet objSV = CreateObject(\"SAPI.SpVoice\")\nobjSV.Speak (\"\u5927\u5bb6\u597d,\u6211\u662f\" &amp; objSV.Voice.GetDescription &amp; \",\u4e0b\u9762\u6211\u7ed9\u5927\u5bb6\u8bf4\u4e00\u6bb5\u7ed5\u53e3\u4ee4.\")\nobjSV.Rate = 5\nobjSV.Speak (\"\u5df4\u8001\u7237\u6709\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811 \u6765\u4e86\u516b\u5341\u516b\u4e2a\u628a\u5f0f\u8981\u5728\u5df4\u8001\u7237\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811\u4e0b\u4f4f \u5df4\u8001\u7237\u62d4\u4e86\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811 \u4e0d\u8ba9\u516b\u5341\u516b\u4e2a\u628a\u5f0f\u5728\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811\u4e0b\u4f4f \u516b\u5341\u516b\u4e2a\u628a\u5f0f\u70e7\u4e86\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811 \u5df4\u8001\u7237\u5728\u516b\u5341\u516b\u68f5\u6811\u8fb9\u54ed\")\nobjSV.Rate = 0\nobjSV.Speak (\"\u592a\u5feb\u4e86\u5c4c\u7206\u4e86\u6709\u6728\u6709,\u6211\u6162\u4e00\u70b9\u518d\u8bf4\u4e00\u6b21\u5427.\")\nobjSV.Rate = 3\nobjSV.Speak (\"\u5df4\u8001\u7237\u6709\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811 \u6765\u4e86\u516b\u5341\u516b\u4e2a\u628a\u5f0f\u8981\u5728\u5df4\u8001\u7237\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811\u4e0b\u4f4f \u5df4\u8001\u7237\u62d4\u4e86\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811 \u4e0d\u8ba9\u516b\u5341\u516b\u4e2a\u628a\u5f0f\u5728\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811\u4e0b\u4f4f \u516b\u5341\u516b\u4e2a\u628a\u5f0f\u70e7\u4e86\u516b\u5341\u516b\u68f5\u82ad\u8549\u6811 \u5df4\u8001\u7237\u5728\u516b\u5341\u516b\u68f5\u6811\u8fb9\u54ed\")\nobjSV.Rate = 0\nobjSV.Speak (\"\u672c\u671f\u8282\u76ee\u5230\u6b64\u7ed3\u675f.\u8c22\u8c22\u6536\u542c!\")\n\nEnd Sub<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CorelVBA \u4f7f\u7528\u591a\u7ebf\u7a0b CreateThread \u89e3\u51b3\u4eba\u5de5\u8bed\u97f3\u5bfc\u81f4\u811a\u672c\u5361\u4f4f\uff0c\u8fd8\u6ca1\u6709\u89e3\u51b3 #If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[67],"class_list":["post-1130","post","type-post","status-publish","format-standard","hentry","category-learn","tag-vba"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1130"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1130\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}