Im not new to PB and i already tried to fix this problem. And posted it in the german forum - without any result.
This code is part of a dll. It will be injected into a process.
What is should do:
Showing a messagerequester.
waiting for pushing the HOME-Key.
OPening a window.
Code: Select all
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Text_0
#val
#Button_1
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Courier New", 10)
Procedure.l HexDec(h$)
h$=UCase(h$)
For r=1 To Len(h$)
d<<4 : a$=Mid(h$,r,1)
If Asc(a$)>60
d+Asc(a$)-55
Else
d+Asc(a$)-48
EndIf
Next
ProcedureReturn d
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 289, 142, 188, 98, "IngameMenu - TEST", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_WindowCentered )
If CreateGadgetList(WindowID(#Window_0))
TextGadget(#Text_0, 10, 10, 90, 30, "Value at 0x004e8154:")
SetGadgetFont(#Text_0, FontID1)
StringGadget(#val, 100, 20, 80, 20, "", #PB_String_ReadOnly)
SetGadgetFont(#val, FontID1)
ButtonGadget(#Button_1, 10, 60, 170, 30, "Injection-Test")
EndIf
EndIf
EndProcedure
Procedure main(dummy)
Repeat
Delay(100)
Until GetAsyncKeyState_(VK_INSERT) <> 0
Open_Window_0()
SetGadgetText(#val, Str(PeekL(HexDec("004e8154"))))
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #Button_1
MessageRequester("dont klick", ">_<")
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
EndProcedure
MessageRequester("hackdll", "I have been injected!")
CreateThread(@main(), dummy)
Showing a messagerequester.
Quitting.
By debugging i found out that the code keeps crashing, when it reaches the "delay".
Is this a bug? Thanks in advice.
greetings, reijin