Main process:
Code: Select all
CompilerIf #PB_Compiler_IsMainFile
EnableExplicit
CompilerEndIf
;- Enumerations
Enumeration Window
#Window_0
EndEnumeration
Enumeration Gadgets
#Btn_1
#Edit_1
EndEnumeration
Global Quit
;- Declare
Declare Open_Window_0(X = 0, Y = 0, Width = 320, Height = 180)
Procedure Mia_AddGadgetItem(gadget, Posizione, Stringa.s, acapo = 1)
AddGadgetItem(gadget, posizione, Stringa)
SendMessage_(GadgetID(gadget), #EM_SETSEL, $fffffff, $fffffff)
EndProcedure
Procedure Mia_TESTO(TESTO.S)
Mia_AddGadgetItem(#Edit_1, - 1, TESTO, 1)
EndProcedure
Procedure Open_Window_0(X = 0, Y = 0, Width = 320, Height = 180)
If OpenWindow(#Window_0, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
ButtonGadget(#Btn_1, 100, 20, 100, 24, "Button_1")
EditorGadget(#Edit_1, 0, 60, 320, 120)
ProcedureReturn #True
EndIf
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
;- Main Program
If Open_Window_0()
;- Event Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = #True
;-> Event Gadget
Case #PB_Event_Gadget
Select EventGadget()
Case #Btn_1
Mia_TESTO("TESTO ORIGINALE")
EndSelect
EndSelect
Until Quit
EndIf
CompilerEndIf
Code: Select all
ProcedureDLL AttachProcess(Instance)
; MessageRequester("AttachProcess()", Str(GetModuleHandle_("test.exe")))
Delay(1000)
testo.s = "testo modificato"
lun.l = Len(testo)
*TESTo = AllocateMemory(lun)
PokeS(*testo, testo, lun)
*funzione = GetModuleHandle_("test.exe") + $11B2
; CallCFunctionFast(*FUNZIONE, *testo)
CallFunctionFast(*FUNZIONE, *testo)
FreeMemory(*testo)
EndProcedure
ProcedureDLL DetachProcess(Instance)
; printN("2")
EndProcedure
ProcedureDLL AttachThread(Instance)
; printN("3")
EndProcedure
ProcedureDLL DetachThread(Instance)
; printN("4")
EndProcedure