Hi all
Any Idea if it's possible to extract a resource of a running program (not from the exe file)
TIA
Any Idea if it's possible to extract a resource of a running program (not from the exe file)
TIA
#Compile Dll "a.DLL" #Register None Global i As Long Sub SetValue Alias "SetValue" (aa As Long) Export i = aa End Sub Function GetValue Alias "GetValue" Export As Long Function = i End Function
#Compile Exe #Register None #Dim All #Include "WIN32API.INC" Declare Sub SetValue Lib "a.DLL" Alias "SetValue" (v As Long) Declare Function GetValue Lib "a.Dll" Alias "GetValue" As Long CallBack Function DlgProc Local a$ If CbMsg = %WM_COMMAND Then If CbCtl = 101 Then Control Get Text CbHndl, 103 To a$ SetValue Val(a$) ElseIf CbCtl = 102 Then SetWindowText CbHndl, Time$ + Str$(GetValue) End If End If End Function Function PbMain As Long Dim hDlg As Local Long Dialog New 0, "Test Dll",,, 150, 45, %WS_SYSMENU Or %WS_CAPTION To hDlg Control Add TextBox, hDlg, 103, "", 5, 5, 140, 12 Control Add Button, hDlg, 101, "Set", 5, 25, 50, 14 Control Add Button, hDlg, 102, "Get", 95, 25, 50, 14 Dialog Show Modal hDlg, Call DlgProc End Function
#Compile Dll "a2.DLL" #Register None Global i As Long Sub SetValue Alias "SetValue" (aa As Long) Export i = aa End Sub Function GetValue Alias "GetValue" Export As Long Function = i * 2 End Function
#Compile Exe #Register None #Dim All #Include "WIN32API.INC" Declare Sub SetValue Lib "a.DLL" Alias "SetValue" (v As Long) Declare Function GetValue Lib "a.Dll" Alias "GetValue" As Long CallBack Function DlgProc Local a$, v As Long v = GetParent(CbHndl) ' To be sure that a.exe use User32.Dll If CbMsg = %WM_COMMAND Then If CbCtl = 101 Then Control Get Text CbHndl, 103 To a$ SetValue Val(a$) Open "G:\Winnt\System32\User32.dll" For Binary Lock Read Write As #1 MsgBox "User32 is Busy" Close #1 ElseIf CbCtl = 102 Then SetWindowText CbHndl, Time$ + Str$(GetValue) Open "A.dll" For Binary Lock Read Write As #1 MsgBox "A.Dll is Busy" Close #1 End If End If End Function Function PbMain As Long Dim hDlg As Local Long Dialog New 0, "Test Dll",,, 150, 45, %WS_SYSMENU Or %WS_CAPTION To hDlg Control Add TextBox, hDlg, 103, "", 5, 5, 140, 12 Control Add Button, hDlg, 101, "Set", 5, 25, 50, 14 Control Add Button, hDlg, 102, "Get", 95, 25, 50, 14 Dialog Show Modal hDlg, Call DlgProc End Function
#COMPILE DLL "INSTANCE.DLL" #DIM ALL #REGISTER NONE FUNCTION LibMain(BYVAL hInstance AS LONG, _ BYVAL Reason AS LONG, _ BYVAL Reserved AS LONG) EXPORT AS LONG DIM ghInstance AS GLOBAL LONG ghInstance = hInstance FUNCTION = 1 END FUNCTION FUNCTION DLLInstance ALIAS "DLLInstance" EXPORT AS LONG DIM ghInstance AS GLOBAL LONG FUNCTION = ghInstance END FUNCTION
#COMPILE EXE "TESTINST.EXE" #DIM ALL #REGISTER NONE DECLARE FUNCTION DLLInstance LIB "INSTANCE.DLL" ALIAS "DLLInstance" AS LONG FUNCTION PBMain AS LONG MSGBOX FORMAT$(DLLInstance) 'use PRINT and WAITKEY$ if using PB/CC. END FUNCTION
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment