Yeeees !!!!
Thanks to BISONTE, SPARKIE, AXOLOTL so..... a real army of programmers for just one KCC
I have found exactely what i want
In fact the code of AXOLOTL not return the handle of Scintilla...i don't know why
Then i have use the SPARKIE code for enumerate all the windows named PureBasic, and search the Scintilla classe, take his handle for give it to Axolotl code
I put my cowpat here, if she can be usefull for someone (Like say a certain KCC a day of full moon
)
Again thanks for all try to help me, and have a good day
Code: Select all
Global hwndPb.i
Global hSciWnd.i
Procedure.s Scintilla_GetText()
Protected Result$, ProcessID, PID
Protected *MemoryID, *Buffer, Format, Length, BytesRead
If hSciWnd And GetWindowThreadProcessId_(hSciWnd, @PID)
ProcessID = OpenProcess_(#PROCESS_ALL_ACCESS, #False, PID)
EndIf
If ProcessID
Select SendMessage_(hSciWnd, #SCI_GETCODEPAGE, #Null, #Null)
Case 0 : Format = #PB_Ascii
Case 65001 : Format = #PB_UTF8
EndSelect
Length = SendMessage_(hSciWnd, #SCI_GETTEXTLENGTH, 0, 0)
Length * StringByteLength("A", Format)
*Buffer = AllocateMemory(Length+SizeOf(Character))
If *Buffer
*MemoryID = VirtualAllocEx_(ProcessID, #Null, Length, #MEM_RESERVE|#MEM_COMMIT, #PAGE_EXECUTE_READWRITE)
If *MemoryID
SendMessage_(hSciWnd, #SCI_GETTEXT, Length, *MemoryID)
ReadProcessMemory_(ProcessID, *MemoryID, *Buffer, Length, @BytesRead)
Result$ = PeekS(*Buffer, BytesRead)
VirtualFreeEx_(ProcessID, *MemoryID, Length, #MEM_RELEASE)
EndIf
FreeMemory(*Buffer)
EndIf
CloseHandle_(ProcessID)
EndIf
ProcedureReturn Result$
EndProcedure
Procedure.l enumChildren(hwnd.l, lParam.l)
If hwnd
classText.s = Space(256)
GetClassName_(hwnd, @classText, 256)
If classText = "Scintilla"
hSciWnd = hwnd
ProcedureReturn #False
EndIf
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
Procedure.l enumWins(hwnd.l, lParam.l)
If hwnd
If IsWindowVisible_(hwnd)
pText.s = Space(256)
SendMessage_(hwnd, #WM_GETTEXT, 256, @pText)
If FindString(pText, "PureBasic", 1, #PB_String_NoCase) And FindString(pText, ".")
hwndPb = hwnd
ProcedureReturn #False
EndIf
EndIf
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
EnumWindows_(@enumWins(), 0)
EnumChildWindows_(hwndPb, @enumChildren(), 0)
MessageRequester("", Scintilla_GetText())