本帖最后由 小白龙 于 2023-4-2 20:09 编辑
我自己编译了新版本也不行, 看来是包装代码的问题了
52-58行的代码, 好像这里要设置
(wParam && !(wParam+0) && !isObject(wParam)) ? (VarSetCapacity(wParamA, StrPut(wParam, "CP0"))
,StrPut(wParam, &wParamA, "CP0")
,wParam:=&wParamA) : null
(lParam && !(lParam+0) && !isObject(lParam)) ? (VarSetCapacity(lParamA, StrPut(lParam, "CP0"))
,StrPut(lParam, &lParamA, "CP0")
,lParam:=&lParamA) : null
第85行的代码,也得设置
buf ? (lParam := StrGet((msg = "GetTextRange") ? blParam : &lParam, "CP0"), buf:=false) : null ; convert the text from ANSI- ; Title: Scintilla Wrapper for AHK
-
- class scintilla {
- hwnd := 0 ; Component Handle
- notify := "" ; Name of the function that will handle the window messages sent by the control
-
- ; Messages which set this variables.
- ; ---------------------------------------------------------------------------------------------------------------
- idFrom := 0 ; The handle from which the notification was sent
- scnCode := 0 ; The SCN_* notification code
- position := 0 ; SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK
- ; SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK
- ; SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK
- ; SCN_INDICATORCLICK, SCN_INDICATORRELEASE
- ; SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
-
- ch := 0 ; SCN_CHARADDED, SCN_KEY
- modifiers := 0 ; SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK
- ; SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE
-
- modType := 0 ; SCN_MODIFIED
- text := 0 ; SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED
- length := 0 ; SCN_MODIFIED
- linesAdded := 0 ; SCN_MODIFIED
- macMessage := 0 ; SCN_MACRORECORD
- macwParam := 0 ; SCN_MACRORECORD
- maclParam := 0 ; SCN_MACRORECORD
- line := 0 ; SCN_MODIFIED
- foldLevelNow := 0 ; SCN_MODIFIED
- foldLevelPrev := 0 ; SCN_MODIFIED
- margin := 0 ; SCN_MARGINCLICK
- listType := 0 ; SCN_USERLISTSELECTION
- x := 0 ; SCN_DWELLSTART, SCN_DWELLEND
- y := 0 ; SCN_DWELLSTART, SCN_DWELLEND
- token := 0 ; SCN_MODIFIED with SC_MOD_CONTAINER
- annotLinesAdded := 0 ; SCN_MODIFIED with SC_MOD_CHANGEANNOTATION
- updated := false ; SCN_UPDATEUI
-
- __new(params*){
- if (params.MaxIndex())
- __SCI(this.hwnd := __Add(params*), this)
- else
- return this
- }
-
- __call(msg, ByRef wParam:=0, ByRef lParam:=0, params*){
-
- if (msg = "Add")
- __SCI(this.hwnd := __Add(wParam, lParam, params*), this)
- else
- {
- (wParam && !(wParam+0) && !isObject(wParam)) ? (VarSetCapacity(wParamA, StrPut(wParam, "CP0"))
- ,StrPut(wParam, &wParamA, "CP0")
- ,wParam:=&wParamA) : null
-
- (lParam && !(lParam+0) && !isObject(lParam)) ? (VarSetCapacity(lParamA, StrPut(lParam, "CP0"))
- ,StrPut(lParam, &lParamA, "CP0")
- ,lParam:=&lParamA) : null
-
- /*
- Special Operations
- Due to the fact that some functions require the user to manually prepare bufferst to store text
- I decided to make most of those operations internally to have cleaner code later on.
- */
-
- (msg = "GetText") ? (VarSetCapacity(lParam, wParam * (a_isunicode ? 2 : 1)+8), lParam := &lParam, buf:=true) : null
- (msg = "GetLine") ? (VarSetCapacity(lParam, this.linelength(wParam)+1 * (a_isunicode ? 2 : 1)),lParam := &lParam, buf:=true) : null
- (msg = "GetCurLine") ? (VarSetCapacity(lParam, this.linelength(wParam)+1 * (a_isunicode ? 2 : 1)), lParam := &lParam, buf:=true) : null
- (msg = "GetTextRange") ? (range:=abs(wParam.1 - wParam.2)+1, dSize := __sendEditor(this.hwnd, "GetLength")
- ,VarSetCapacity(lParam, range > dSize ? (dSize, wParam.2 := dSize) : range)
- ,VarSetCapacity(textRange, 12, 0)
- ,NumPut(wParam.1,textRange,0,"UInt")
- ,NumPut(wParam.2,textRange,4,"UInt")
- ,NumPut(&lParam,textRange,8,"UInt")
- ,blParam := &lParam, wParam := false,lParam := &textRange, buf:=true) : null
-
- __isHexColor(lParam, msg) ? lParam := (lParam & 0xFF) <<16 | (lParam & 0xFF00) | (lParam >>16) : null
- __isHexColor(wParam, msg) ? wParam := (wParam & 0xFF) <<16 | (wParam & 0xFF00) | (wParam >>16) : null
-
- res := __sendEditor(this.hwnd, msg, wParam, lParam)
-
- ; Retrieve Text from buffer
- ; I must switch lParam to another variable when using GetTextRange because lParam cant be overwriten
- ; It has the pointer to the TextRange Structure
- buf ? (lParam := StrGet((msg = "GetTextRange") ? blParam : &lParam, "CP0"), buf:=false) : null ; convert the text from ANSI
- return res
- }
- }
- }
复制代码
|