Der Requester wird trotzdem nicht angezeigt....
Gruß
Scarabol
Code: Alles auswählen
Procedure GetPID(ProcessName.s)
hSnapShot = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,#Null)
If hSnapShot
iResult = -1
pInfo.PROCESSENTRY32
pInfo\dwsize = SizeOf(PROCESSENTRY32)
bProcAvailable = Process32First_(hSnapShot, @pInfo)
While(bProcAvailable) And (Not iResult = 0)
bProcAvailable = Process32Next_(hSnapShot, @pInfo)
iResult = CompareMemoryString(@pInfo\szExeFile,@ProcessName,1)
Wend
CloseHandle_(hSnapShot)
ProcedureReturn pInfo\th32ProcessID
EndIf
EndProcedure
Procedure InjectDll(hProcess)
If Not hProcess
ProcedureReturn 0
EndIf
hKernel32 = GetModuleHandle_("Kernel32")
szLibPath.s = GetCurrentDirectory() + "popmenu.dll"
bLen = Len(szLibPath)+1
pLibRemote = VirtualAllocEx_(hProcess,#Null,bLen,#MEM_COMMIT,#PAGE_READWRITE )
If pLibRemote = #Null
ProcedureReturn #False
EndIf
WriteProcessMemory_(hProcess,pLibRemote,@szLibPath,bLen,#Null)
hThread = CreateRemoteThread_(hProcess,#Null,0,GetProcAddress_(hKernel32,"LoadLibraryA"),pLibRemote,0,#Null)
If (hThread = #Null)
Goto Jump2
EndIf
WaitForSingleObject_(hThread,#INFINITE)
CloseHandle_(hThread)
VirtualFreeEx_(hProcess,pLibRemote,bLen,#MEM_RELEASE)
ProcedureReturn 1
Jump2:
VirtualFreeEx_(hProcess,pLibRemote,bLen,#MEM_RELEASE)
ProcedureReturn 0
EndProcedure
pid = GetPID("purebasic.exe")
If pid
hProcess = OpenProcess_(#PROCESS_CREATE_THREAD | #PROCESS_QUERY_INFORMATION | #PROCESS_VM_OPERATION | #PROCESS_VM_WRITE | #PROCESS_VM_READ,#False, pid)
InjectDll(hProcess)
EndIf
Code: Alles auswählen
Procedure _subclass_cb_(hWnd,uMsg,wParam,lParam)
If uMsg = #WM_INITMENUPOPUP
; menu bearbeiten ...
EndIf
ProcedureReturn CallFunctionFast(oldproc,hWnd,uMsg,wParam,lParam)
EndProcedure
ProcedureDLL AttachProcess(Instanz)
; find window handle
; subclass window
; bla bla
MessageRequester("Info", "Dies ist ein test")
EndProcedure