user-0 提问: 有什么方法能让A程序查看B程序中某一个变量的值

回复:
user: user-1
content: 哪有那么好搞。

user: user-2
content: 如果是两个独立的程序，就是两个进程，可以进行进程间通信，比如共享内存，socket，管道等

user: user-3
content: 引用 3 楼 lm_whales 的回复:Windows 可以用Debug Api。 ++

user: user-4
content: Private Sub CommandButton2_Click()   'MsgBox "ﾄ耡ｪﾍﾋｳｿ", vbInformation     Unload Me   'VarPtr,ｱ菽ｿｵﾄﾄﾚｴ豬ﾘﾖｷ '  Dim hMine As Long  'ﾉｨﾀﾗｴｰﾌ蠏ﾄｾ莖 '  Dim lPos As Long ' '  hMine = FindWindow(vbNullString, "ﾉｨﾀﾗ")    'ﾕﾒ ﾉｨﾀﾗ ｴｰｿﾚ '  mP.X = 20 + 16 * 3    '68 '  mP.Y = 60 + 16 * 3    '108 '  'ﾕ篋ｻﾖﾃﾊﾇｵﾚ4ﾐﾐｵﾚ4ｸ '  'ﾕ篋ｻﾖﾃﾊﾇｵﾚ1ﾅﾅｵﾚ7ｸ '  lPos = mP.X + mP.Y * 65536    '7077956 ' '  Call SendMessage(hMine, WM_LBUTTONDOWN, 0, lPos) '  Call SendMessage(hMine, WM_LBUTTONUP, 0, lPos)  '  Call SendMessage(hMine, WM_LBUTTONDOWN, 0, MakeDWord(20 + 16 * 3, 60 + 16 * 3)) '  Call SendMessage(hMine, WM_LBUTTONUP, 0, MakeDWord(20 + 16 * 3, 60 + 16 * 3))     End Sub    Private Sub RunMine()   Dim Ret As Long   Ret = MsgBox("ﾏﾖﾔﾚﾒｪﾔﾋﾐﾐﾉｨﾀﾗｳﾌﾐｿ", vbExclamation + vbYesNo, "ﾊﾇｷﾖﾔﾚﾔﾋﾐﾐﾉｨﾀﾗ")   If Ret = vbYes Then     'ｻﾃWindowsﾋﾚｵﾄﾄｿﾂｼ｣ｬﾈｻｺ・鯔ｨﾀﾗｳﾌﾐﾇｷ贇ﾚ｣ｬｲ｢ｸ獗ｦﾌ睫ｾ     'Debug.Print GetSystemDir     If Dir$(GetSystemDir & "\winmine.exe") <> "" Then       Shell GetSystemDir & "\winmine.exe", vbNormalFocus       MsgBox "ﾇ・ﾙｴﾎｵ羹ｨﾃ隹ｴﾅ･｣｡", 64     Else       MsgBox "ﾃｻﾓﾐﾕﾒｵｽﾉｨﾀﾗｳﾌﾐ｡ｿﾉﾄﾜﾊﾇﾃｻﾓﾐｰｲﾗｰ｣ｬﾔﾚｿﾘﾖﾆﾃ豌蠏ﾄ｡ｰﾌ晴ﾓ/ﾉｾｳｳﾌﾐｱﾀ・｡ﾔｰﾌ晴ﾓ/ﾉｾｳWindowsﾗ鮠(&A)｡ｱﾖﾐｰﾑｸｽｼﾖﾐｵﾄﾓﾎﾏｷﾑ｡ﾉﾏ｣ｬﾈｷｶｨｾﾍｿﾉﾒﾔｰｲﾗｰｺﾃﾁﾋ｡｣", vbInformation     End If        Else      End If End Sub     Private Sub OptAuto_Click()   chkSleep.Value = 1    End Sub  Private Sub txtSleep_Change() '  Dim Ss As Integer, mTime As Long '  'ｼﾆﾋ翹ｨﾀﾗﾋ襍ﾄﾊｱｼ菘・,ﾈ｡ｵﾃｸﾟｶﾈｺﾍｿ昮ﾈ｣ｬｵﾃｵｽｹｲﾓﾐｶ猖ﾙｸｴﾅ･｣ｬﾈｻｺﾙｼ･ﾀﾗﾊ '  If txtSleep.Text = "" Then Exit Sub '  Ss = CInt(txtSleep.Text) '  mTime = (CLng(30 * 16) - 99) * Ss \ 1000 '  mTime = mTime + 1    'ﾎ鋗ﾅﾊﾇﾐ｡1 '  lblInfo.Caption = "ｴﾅ " & mTime & " ﾃ・ﾉﾒﾔﾍ・ﾉﾉｨﾀﾗﾈﾎﾎ｣" End Sub     Private Sub txtSleep_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)   'If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0   If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then KeyAscii = 0   'If KeyAscii = 8 Then KeyAscii = 8  End Sub  Private Sub UserForm_Initialize()   'ﾅﾐｶﾏｲﾙﾗｵﾍｳｰ豎ｾ     Dim OSInfo As OSVERSIONINFO, PId As String     Dim Ret As Long     Dim OS As String, OSVersion As Single     Dim Str1 As String     OSVersion = CSng(GetOSVersion.osvOSVerMajor & "." & GetOSVersion.osvOSVerMinor)          Select Case GetOSVersion.osvOSName     Case 0    'Windows 32s       OS = "Win32"     Case 1    'Windows 95/98       Select Case OSVersion       Case 4: OS = "Win 95"       Case 4.1: OS = "Win 98"       Case 4.9: OS = "Wim Me"       End Select      Case 2    'Windows NT       Select Case OSVersion       Case 4: OS = "Win NT"       Case 5#: OS = "Win 2000"       Case 5.1: OS = "Win XP"        End Select     End Select          If OS = "Win 2000" Then       Opt2000.Value = True     ElseIf OS = "Win XP" Then       OptXP.Value = True     Else    'ｷﾇ2000/XPﾏｵﾍｳ       MsgBox "ｶﾔｲｻﾆ｡ｱｾｳﾌﾐｻﾄﾜﾔﾋﾐﾐﾔﾚWindows 2000/XPﾏｵﾍｳﾉﾏﾃ譯｣", vbInformation, "I'm Sorry!"     End If     OptAuto.Value = True End Sub  Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) auto_close End Sub

user: user-4
content: '***********************Excelﾉｨﾀﾗﾍ篁ﾒ************************* '***********************EH-yuanhongly************************* '***********************2008ﾄ・1ﾔﾂ11ﾈﾕ************************  Option Explicit  Dim mP As POINTAPI    'ｴ豢｢ﾊ・ｻﾖﾃ '0..8ｱ桄ｾﾊﾗﾖ｣ｬ9ｱ桄ｾﾃｻﾓﾐｴｪ｣ｬ*ｱ桄ｾﾀﾗ｣ｬFｱ桄ｾｱ・ﾇ  Private Sub CommandButton1_Click()   Dim hMine As Long  'ﾉｨﾀﾗｴｰﾌ蠏ﾄｾ莖   Dim pMine As Long  'ﾉｨﾀﾗｴｰﾌ蠏ﾄｽﾌｱ   Dim MineID As Long  'ﾉｨﾀﾗｴｰﾌ蠏ﾄｽﾌID   Dim lpBuffer As Byte  'ﾓﾃﾓﾚｶﾁﾈ｡ﾄﾚｴ贍ﾐｵﾄﾄﾚﾈﾝ   Dim nSize As Long  'ｶﾁﾈ｡ｵﾄｴ｡   Dim lpNumberOfBytesRead As Long  'ﾒﾑｶﾁﾈ｡ｵﾄﾗﾖｽﾚﾊ   Dim S As String   Dim Row, Col As Integer   'ﾐﾐﾊ｡｢ﾁﾐﾊ   Dim mWidth, mHeight, mPlayType As Integer  'ﾀﾗｵﾄﾁﾐﾊ｡｢ﾐﾐﾊ｡｢ﾍ豬ﾄﾄ｣ﾊｽ   Dim MineNum As Integer, mTime As Long   'ﾀﾗﾊ   'ﾉｨﾀﾗｴｰﾌ衙ﾏｵﾚﾒｻﾐﾐｵﾚﾒｻﾁﾐﾏ犖ﾔﾓﾚﾕ篋ｰﾌ蠏ﾄﾆｫﾒﾆﾁｿ｣ｬﾓﾃﾓﾚﾒﾔｺﾄﾊ・ﾔｶｯｵ羹   Dim xOffset As Integer, yOffset As Integer   Dim miBegin As Long, miHeight As Long, miWidth As Long, miStart As Long, miPlayType As Long      '&H010052C0  ﾍ豬ﾄﾄ｣ﾊｽ   '&H010052C4  2Kﾏﾂﾊﾇﾀﾗﾊﾆｼｵﾘﾖｷ   '&H010052C8  2Kﾏﾂﾊﾇﾀﾗﾇﾟｶﾈﾆｼｵﾘﾖｷ   '&H010052CC  2Kﾏﾂﾊﾇﾀﾗﾇ昮ﾈﾆｼｵﾘﾖｷ   '&H01005721  2Kﾏﾂﾊﾇﾀﾗﾇﾚﾈﾝﾆｼｵﾘﾖｷ｣ｬﾒﾀｴﾎﾊﾇ&H01005721+ｸﾟ*32+ｿ   '&H01005A60  2Kﾏﾂﾊﾇﾀﾗﾊ｣ﾓ犧    '&H010056A0  ﾍ豬ﾄﾄ｣ﾊｽ   '&H01005330/56A4  XPﾏﾂﾊﾇﾀﾗﾊﾆｼｵﾘﾖｷ   '&H01005338/56A8  XPﾏﾂﾊﾇﾀﾗﾇﾟｶﾈﾆｼｵﾘﾖｷ   '&H01005334/56AC  XPﾏﾂﾊﾇﾀﾗﾇ昮ﾈﾆｼｵﾘﾖｷ   '&H01005361  XPﾏﾂﾊﾇﾀﾗﾇﾚﾈﾝﾆｼｵﾘﾖｷ｣ｬﾒﾀｴﾎﾊﾇ&H01005361+ｸﾟ*32+ｿ   '&H01005194  XPﾏﾂﾊﾇﾀﾗﾊ｣ﾓ犧    If Opt2000.Value Then     miBegin = &H10052C4     miHeight = &H10052C8     miWidth = &H10052CC     miStart = &H1005721     miPlayType = &H10052C0   Else     miBegin = &H1005330     miHeight = &H1005338     miWidth = &H1005334     miStart = &H1005361     miPlayType = &H10056A0      End If   hMine = FindWindow(vbNullString, "ﾉｨﾀﾗ")    'ﾕﾒ ﾉｨﾀﾗ ｴｰｿﾚ   Call GetWindowThreadProcessId(hMine, MineID)    'ｷｵｻﾘ ﾉｨﾀﾗ ｽﾌｵﾄID｣ｬﾎｪmineId   yOffset = 60   xOffset = 20   pMine = OpenProcess(PROCESS_VM_READ, True, MineID)             'ｴｪ ﾉｨﾀﾗ ｽﾌ   If pMine = 0 Then     Call MsgBox("ﾄ羹ｹﾃｻﾓﾐｴｪﾉｨﾀﾗｰﾉ｣ｺ｣ｩ", vbInformation, "ﾕﾒｲｻｵｽﾅｶ")     RunMine     Exit Sub   End If   nSize = 1   'ReDim lpBuffer(nSize - 1)      If ReadProcessMemory(pMine, miBegin, lpBuffer, nSize, lpNumberOfBytesRead) Then       'ｽﾌｾ莖・ﾄﾚｴ貮ｷ,ﾊｾﾝｻｺｳ衂・ﾒｪｶﾁｵﾄﾗﾖｽﾚﾊ,ﾒﾑｶﾁﾗﾖｽﾚﾊ     Me.Caption = "ｹｲﾓﾐﾀﾗﾊ " + CStr(lpBuffer) + " ｸ・"     MineNum = lpBuffer   End If   If ReadProcessMemory(pMine, miWidth, lpBuffer, nSize, lpNumberOfBytesRead) Then     mWidth = lpBuffer     'ﾀﾗﾇ昮ﾈ｣ｬｼｴ ﾉｨﾀﾗ ｵﾄﾁﾐﾊ   End If   If ReadProcessMemory(pMine, miHeight, lpBuffer, nSize, lpNumberOfBytesRead) Then     mHeight = lpBuffer     'ﾀﾗﾇﾟｶﾈ｣ｬｼｴ ﾉｨﾀﾗ ｵﾄﾐﾐﾊ   End If     If ReadProcessMemory(pMine, miPlayType, lpBuffer, nSize, lpNumberOfBytesRead) Then     mPlayType = lpBuffer      'ﾉｨﾀﾗﾄ｣ﾊｽ   End If        'ｼﾆﾋ聆ﾔｶｯﾉｨﾀﾗﾋﾃﾊｱｼ   mTime = (CLng(mWidth * mHeight) - MineNum) * CInt(txtSleep.Text) \ 1000 + 1   lblInfo.Caption = "ｴﾅ " & mTime & " ﾃ・ﾉﾒﾔﾍ・ﾉﾉｨﾀﾗﾈﾎﾎ｣"      'SendMessageｵﾄﾗ鋓ｻｸﾎﾊlParamﾔﾚｷ｢ﾋﾍWM_LBUTTONDOWNﾏ鋧｢ﾊｱｴ﨑櫤凜ｬﾈ郤ﾎｰﾑﾗ鷙,Yｺﾏｲ｢ｳﾉlParamﾄﾘ   'DelphiﾊﾇﾓﾃMakelParam(x,y)   'a = postmessage(hwand,WM_LBUTTONDOWN , 0, (x And &hFFFF)+(y And &HFFFF)*&H10000)    '  For Row = 0 To mHeight      'ｴﾓｵﾚﾒｻﾐﾐｿｪﾊｼ｣ｬﾓﾉﾗﾒ｣ｬｴﾓﾉﾏｶﾂ '    For Col = 0 To mWidth   'ﾗﾔｶｯﾉｨﾀﾗｵﾄﾎﾊﾌ筌ｬﾈ郢鋐ﾑｾｭﾊﾇｰｴｹｵﾄ｣ｬｾﾍﾊﾇｱｻﾗﾔｶｯｷｭｿｪｵﾄ｣ｬｶﾁﾈ｡ﾒｻﾏﾂﾄﾚｴ贍ｵ｣ｬｷ｢ﾏﾖﾒﾑｾｭﾊﾇｷｭｿｪﾗｴﾌｬｵﾄ｣ｬｾﾍｲｻﾒｪﾔﾙﾒﾆｶｯｵ羹ﾋ｣ｬﾄﾇﾑﾍﾏﾔｵﾃﾓﾐｵ羮ﾙ   'ﾕ簷ﾓｵﾄﾗﾔｶｯﾉｨﾀﾗ｣ｬﾊﾇﾒｻﾐﾐﾒｻﾐﾐｵﾄﾋｳﾐｨﾏﾂﾀｴ｣ｬﾒﾔｺｼﾂﾇﾊｹﾓﾃﾋ貊揵ｨﾀﾗ｣ｬﾕ簷ﾔｵﾃﾕ賁ｵﾒｻｵ   'ﾈ郢鉑ｨﾀﾗﾊﾇﾒﾑｾｭｿｪﾊｼﾓﾎﾏｷｵﾄﾗｴﾌｬ｣ｬｻﾟﾊﾇﾒﾑｾｭｽ睫・ﾉｵﾄﾗｴﾌｬ｣ｬｿｼﾂﾇﾈﾃﾊ・ﾔｶｯｵ羹ﾇｸｦﾁｳｵﾄﾍｼｱ凜ｬﾈﾃﾓﾎﾏｷﾖﾘﾐﾂｿｪﾊｼ   'ﾗﾔｶｯﾒﾆｶｯﾖｸﾕ・ｱ｣ｬｷ｢ﾏﾖﾓﾐﾊｱﾖｸﾕ・眷ﾜｵｽｱﾄｵﾘｷｽ｣ｬﾂﾒﾉﾁ(ｿﾉﾓﾃﾒｲﾘﾖｸﾕ・ｦﾄﾜ｣ｬﾃｻｵ羹ｱﾒｲﾘ｣ｬﾗﾔｶｯｵ羹ｱﾏﾔﾊｾ,ShowCursor)   'ﾒｻｸ貉ﾖｵﾄﾎﾊﾌ筌ｬｵｱﾉｨﾀﾗｵｽﾁﾋﾗ鋓ﾄﾊｱｺｬｹ箜・ｻｻ睿｣ﾔﾚﾗ鋓ｻｸｬｶ｣ﾔﾚｵｹﾊｵﾚｼｸｸ・ﾒｻｰ聆鋓睫ﾇﾀﾗ      'ﾗﾔｶｯｵ羹ｦﾁｳﾍｼｱ・ｴﾅ･｣ｬﾖﾘﾐﾂｿｪﾊｼﾒｻｾﾖ(255,75,ﾉｨﾀﾗﾖﾐﾐｦﾁｳｰｴﾅ･ﾋﾚｵﾄﾎｻﾖﾃ)ﾕ篋ﾟｶﾈｲｻﾋ羈・簑ｸｵﾄｸﾟｶﾈｺﾍｲﾋｵ･ｵﾄｸﾟｶﾈ｣ｬﾖｻﾋ譱ﾍｻｧﾇﾄｸﾟｶﾈ '  SetForegroundWindow hMine '  mP.x = 255 '  mP.y = 75 - 45 '  Call ClientToScreen(hMine, mP) '  SetCursorPos mP.x, mP.y    '  Call SendMessage(hMine, WM_LBUTTONDOWN, 0, MakelParam(255, 30)) '  Call SendMessage(hMine, WM_LBUTTONUP, 0, MakelParam(255, 30))  '  mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0    'ｷ｢ﾋﾍｼ・ﾌﾏ鋧｢F2ｼ・ｬﾒｲｿﾉﾒﾔﾖﾘﾐﾂｿｪﾊｼﾐﾂﾓﾎﾏｷ   'Call SendMessage(hMine, WM_KEYDOWN, VK_F2, 0&)   'Call SendMessage(hMine, WM_KEYUP, VK_F2, 0&)      'sendkeys ( )    '  SetForegroundWindow hMine '  keybd_event VK_F2, 0, 0, 0 '  keybd_event VK_F2, 0, KEYEVENTF_KEYUP, 0   ' release H '  DoEvents    'ﾋ菠ｻﾏﾂﾃ豬ﾄﾓ・萼ﾐﾐｧ｣ｬｵｫﾊﾇｺﾃﾏﾌﾐｴﾃｻﾓﾐｴﾓﾄﾚｴ贍ﾐﾇ蟲ｸﾉｾｻ,VBｵﾄｽ睫・ﾔﾈｻﾓﾐﾐｧ｣ｬｴｰﾌ袵ﾑｾｭｲｻｼ訒ｬﾒｪﾊﾖｶｯｽ睫ﾌﾐ '  Call SendMessage(Command2.hwnd, WM_KEYDOWN, VK_SPACE, 0&) '  Call SendMessage(Command2.hwnd, WM_KEYUP, VK_SPACE, 0&)    For Row = 0 To (mHeight - 1)    'ｴﾓｵﾚﾒｻﾐﾐｿｪﾊｼ｣ｬﾓﾉﾗﾒ｣ｬｴﾓﾉﾏｶﾂ     For Col = 0 To (mWidth - 1)       'ﾈ郢赶ｴﾏﾂESCｼ・ｬﾔ｣ﾖｹﾗﾔｶｯﾉｨﾀﾗ       If GetAsyncKeyState(VK_ESCAPE) <> 0 Then         Call CloseHandle(pMine)         Exit Sub       End If              If ReadProcessMemory(pMine, miStart + Row * 32 + Col, lpBuffer, nSize, lpNumberOfBytesRead) Then         'If lpBuffer <> 143 Or (lpBuffer > &H40 And lpBuffer <= &H48) Then 'ｼｴ$8Fﾎｪﾀﾗ,&H40ｵｽ&H48ｴ﨑・-8         'If lpBuffer <> 143 Or (lpBuffer < &H40 And lpBuffer > &H48) Then           mP.x = xOffset + 16 * Col           mP.y = yOffset + 16 * Row         If lpBuffer <> 143 Then 'ｼｴ$8Fﾎｪﾀﾗ,&H40ｵｽ&H48ｴ﨑・-8           If OptAuto.Value Then     'ﾗﾔｶｯﾉｨﾀﾗ             If chkSleep.Value Then   'ﾈ郢鋙｡ﾖﾐﾁﾋﾑﾓﾊｱ               'ShowWindow hMine, SW_SHOW     'ｼ､ｻ鐱ｨﾀﾗｴｰｿﾚ               'ﾔｭｴﾋｴｦｷﾅｼ､ｻ鋗ｰｿﾚｵﾄｴ惲               If IsIconic(hMine) <> 0 Then     'ﾈ郢鉑ｨﾀﾗｴｰｿﾚﾊﾇﾗ隯｡ｻｯ｣ｬﾔﾖｸｴﾆ莇ｰｿﾚ                 ShowWindow hMine, SW_RESTORE               End If               If GetForegroundWindow <> hMine Then  'ﾈ郢鉑ｨﾀﾗｴｰｿﾚｲｻﾊﾇﾇｰﾌｨｴｰｿﾚ｣ｬﾔ靹ﾃﾎｪﾇｰﾌｨｴｰｿﾚ                 SetForegroundWindow hMine               End If                              'If lpBuffer >= &H40 And lpBuffer <= &H48 Then     'ﾈ郢鈹ﾇ0-8ｵﾄﾊﾗﾖﾔﾋｳｻﾗﾔｶｯｵ羹               'If lpBuffer < &H40 And lpBuffer > &H48 Then               If lpBuffer = &HF Then    'ﾈ郢軏ｻﾊﾇﾀﾗ｣ｬｶﾒﾃｻﾓﾐｷｭｿｪｹ,&H0F                 'Sleep 50      'ﾑﾓﾊｱ                 Sleep CInt(txtSleep.Text)                 DoEvents      'ﾗｪﾒﾆｿﾘﾖﾆﾈｨ                 'ﾒﾆｶｯﾊ・ｸﾕ・ｬｸﾐｾﾍﾏ豬ﾄﾔﾚﾗﾔｶｯﾉｨﾀﾗﾒｻﾑ                 Call ClientToScreen(hMine, mP)                 Call SetCursorPos(mP.x, mP.y)                                  'ﾄ｣ﾄ簔ﾋﾊ・・ﾄｵ羹ﾂｼ                 'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・・ｴﾏﾂｵﾄﾏ鋧｢                 Call SendMessage(hMine, WM_LBUTTONDOWN, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))                 'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・・ｧﾆﾄﾏ鋧｢                 Call SendMessage(hMine, WM_LBUTTONUP, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))                              End If             End If                        ElseIf OptNotMine.Value Then             'ﾔﾚｷﾇﾀﾗﾇ・｢ﾎﾊｺﾅ             'ﾄ｣ﾄ簔ﾋﾊ・ﾒｼ・ﾄｵ羹ﾂｼ             'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・ﾒｼ・ｴﾏﾂｵﾄﾏ鋧｢             Call SendMessage(hMine, WM_RBUTTONDOWN, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))             Call SendMessage(hMine, WM_RBUTTONUP, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))             'ﾄ｣ﾄ簔ﾋﾊ・ﾒｼ・ﾄｵ羹ﾂｼｼｴｱ・｢ﾀﾗ             'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・ﾒｼ・ｴﾏﾂｵﾄﾏ鋧｢             Call SendMessage(hMine, WM_RBUTTONDOWN, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))             'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・ﾒｼ・ｧﾆﾄﾏ鋧｢             Call SendMessage(hMine, WM_RBUTTONUP, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))           End If          Else    '=&H8F(143),ﾓﾐﾀﾗ           'If OptMine.Value Or OptAuto.Value Then      'ｱ・ﾇﾀﾗﾇﾔｶｯﾉｨﾀﾗｶｼﾒｪﾓﾃﾓﾒｼ・ﾗﾇ衵｡ｺ・           If OptMine.Value Then             'ﾄ｣ﾄ簔ﾋﾊ・ﾒｼ・ﾄｵ羹ﾂｼ             'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・ﾒｼ・ｴﾏﾂｵﾄﾏ鋧｢             Call SendMessage(hMine, WM_RBUTTONDOWN, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))             'ﾏ・ﾉｨﾀﾗ ｴｰﾌ蠏ﾄ ｣ｨxOffset+16*col,yOffset+16*row｣ｩｴｦ ｷ｢ﾋﾍﾊ・ﾒｼ・ｧﾆﾄﾏ鋧｢             Call SendMessage(hMine, WM_RBUTTONUP, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))           ElseIf OptAuto.Value Then             'Debug.Print Row; ","; Col              Sleep CInt(txtSleep.Text)             DoEvents      'ﾗｪﾒﾆｿﾘﾖﾆﾈｨ              'ﾒﾆｶｯﾊ・ｸﾕ・ｬｸﾐｾﾍﾏ豬ﾄﾔﾚﾗﾔｶｯﾉｨﾀﾗﾒｻﾑ             'ﾊ・ﾒﾒﾆｵﾄｴ﨔ﾖﾔﾚﾏﾂﾃ豬ﾄﾁｽｾ茱ｬﾒｪmPﾖﾐｴ豬ﾄｹ箜・ｻﾖﾃﾒﾑｾｭｱｻｻｻｹﾁﾋ｣ｬｴﾋﾊｱﾔﾙｻｻｾﾍｲｻｶﾔﾁﾋ             Call ClientToScreen(hMine, mP)             Call SetCursorPos(mP.x, mP.y)                          Call SendMessage(hMine, WM_RBUTTONDOWN, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))             Call SendMessage(hMine, WM_RBUTTONUP, 0, MakelParam(xOffset + 16 * Col, yOffset + 16 * Row))                      End If         End If       End If     Next   Next      Call CloseHandle(pMine)     End Sub       我这日文的操作系统对vba是硬伤,将就参考吧

user: user-4
content: http://club.excelhome.net/thread-370916-1-1.html

user: user-5
content: 不可能 内存中的数据运行时没有名称，连续内存也不分哪些字节是一起的

user: user-4
content: 以前看到过一个用Excel VBA做的扫雷外挂,应该和这个问题的解决思想类似.感兴趣可以去excelhome搜下

user: user-6
content: 推荐使用WinHex软件查看硬盘或文件或内存中的原始字节内容。

user: user-6
content: bool AdjustPrivileges() {     HANDLE hToken;     TOKEN_PRIVILEGES tp;     TOKEN_PRIVILEGES oldtp;     DWORD dwSize=sizeof(TOKEN_PRIVILEGES);     LUID luid;      if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {         if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) return true;         else return false;     }     if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) {         CloseHandle(hToken);         return false;     }     ZeroMemory(&tp, sizeof(tp));     tp.PrivilegeCount=1;     tp.Privileges[0].Luid=luid;     tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;     /* Adjust Token Privileges */     if (!AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &oldtp, &dwSize)) {         CloseHandle(hToken);         return false;     }     // close handles     CloseHandle(hToken);     return true; }  ReadProcessMemory The ReadProcessMemory function reads memory in a specified process. The entire area to be read must be accessible, or the operation fails.   BOOL ReadProcessMemory(   HANDLE hProcess,  // handle to the process whose memory is read   LPCVOID lpBaseAddress,                     // address to start reading   LPVOID lpBuffer,  // address of buffer to place read data   DWORD nSize,      // number of bytes to read   LPDWORD lpNumberOfBytesRead                      // address of number of bytes read );   Parameters hProcess  Handle to the process whose memory is being read. The handle must have PROCESS_VM_READ access to the process.  lpBaseAddress  Pointer to the base address in the specified process to be read. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access. If this is the case, the function proceeds; otherwise, the function fails.  lpBuffer  Pointer to a buffer that receives the contents from the address space of the specified process.  nSize  Specifies the requested number of bytes to read from the specified process.  lpNumberOfBytesRead  Pointer to the actual number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored.  Return Values If the function succeeds, the return value is nonzero.  If the function fails, the return value is zero. To get extended error information, call GetLastError.  The function fails if the requested read operation crosses into an area of the process that is inaccessible.   Remarks ReadProcessMemory copies the data in the specified address range from the address space of the specified process into the specified buffer of the current process. Any process that has a handle with PROCESS_VM_READ access can call the function. The process whose address space is read is typically, but not necessarily, being debugged.   The entire area to be read must be accessible. If it is not, the function fails as noted previously.   QuickInfo   Windows NT: Requires version 3.1 or later.   Windows: Requires Windows 95 or later.   Windows CE: Unsupported.   Header: Declared in winbase.h.   Import Library: Use kernel32.lib.  See Also Debugging Overview, Debugging Functions, WriteProcessMemory, ReadProcessMemoryVlm

user: user-7
content: 多少RMB？

user: user-8
content: VS，可以动态挂上被调试程序，既然如此，你也可以， 在程序运行过程中，可以暂时挂起B中的线程，然后搜内存，什么的。 你这是在做破解？还是准备做外挂？

user: user-7
content: 共享内存、共享段、导出变量跨进程读取变量

user: user-0
content: 引用 10 楼 h70614959 的回复:可以放到缓存组件cBase、memcatch 。实在不想用中间件。放到一个文件里面也是可以的。只要两个程序都可以访问即可。  哦，明白你的意思了，，， 可是你说的情况，需要对已经存在的B程序做修改，让B程序定期的把数据dump到某个容器内，，， 我想要的是，随便一个什么程序，只要在运行中，我就能读取到它当前所有活着的变量，并且查看变量值，前提是我不修改B程序

user: user-9
content: 写硬盘文件或者得到B的窗口句柄

user: user-10
content: 可以放到缓存组件cBase、memcatch 。实在不想用中间件。放到一个文件里面也是可以的。只要两个程序都可以访问即可。

user: user-0
content: 引用 3 楼 lm_whales 的回复:Windows 可以用Debug Api。 大概看了一下，3楼的像是靠谱的。。。。。。。看看再说。。

user: user-11
content: 共享内存吧～～

user: user-0
content: 引用 5 楼 h70614959 的回复:定义个全局变量，让A、B都可以看到这个变量，防止并发休息可以用 volatile 修饰 B是一个已经存在，并且一直运行着的程序，我现在想再写一个程序，来得到B中变量的值，如何定义一个变量让A，B同时看到？

user: user-10
content: 定义个全局变量，让A、B都可以看到这个变量，防止并发休息可以用 volatile 修饰