Click here to Skip to main content
15,880,891 members
Home / Discussions / COM
   

COM

 
GeneralRe: Trouble with implement Com Local Server Pin
Tri Cuong3-Oct-15 7:29
Tri Cuong3-Oct-15 7:29 
GeneralRe: Trouble with implement Com Local Server Pin
Richard MacCutchan4-Oct-15 2:41
mveRichard MacCutchan4-Oct-15 2:41 
QuestionWhy is the resolution in SampleGrabber different from the resolution in IAMStreamConfig? Pin
garry.fang24-Jun-15 12:44
garry.fang24-Jun-15 12:44 
QuestionC#: Fixed Function ID in COM DLL Pin
DoxMan20-Apr-15 23:52
DoxMan20-Apr-15 23:52 
AnswerRe: C#: Fixed Function ID in COM DLL Pin
Richard Deeming21-Apr-15 2:37
mveRichard Deeming21-Apr-15 2:37 
AnswerRe: C#: Fixed Function ID in COM DLL Pin
F-ES Sitecore29-Apr-15 4:09
professionalF-ES Sitecore29-Apr-15 4:09 
QuestionIoleUndoManager with Excel application Pin
jaafar tribak6-Apr-15 5:28
jaafar tribak6-Apr-15 5:28 
QuestionEXCEL - Hooking Excel VTABLE Pin
jaafar tribak3-Apr-15 17:53
jaafar tribak3-Apr-15 17:53 
The following code is supposed to redirect the call to the Excel Calculate Method to my own function (MeMsg)

After running the HookCOMFunction routine , the Test Macro successfully executes the MeMsg replacement function as expected .. So far so good

However, when executing an excel calculation via the User Interface (not via code) such as by pressing the F9 key , the MeMsg replacement function doesn't get called ... I thought that replacing the 'Calculate' VTable offset address with the address of my replacement function would also work everytime excel is calculated via the User Interface

Any thoughts anyone ? My goal is to hook the excel Calculate Method via code as well as via the UI

Regards.

Code :

Option Explicit

Private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" ( _
Destination As Any, _
Source As Any, _
ByVal Length As Long _
)

Private Declare Function VirtualProtect Lib "kernel32.dll" ( _
ByVal lpAddress As Long, _
ByVal dwSize As Long, _
ByVal flNewProtect As Long, _
lpflOldProtect As Long _
) As Long

Private Const PAGE_EXECUTE_READWRITE As Long = &H40&

Sub HookCOMFunction()
Dim pVTable As Long
Const lFuncOffset As Long = 84

CopyMemory pVTable, ByVal ObjPtr(Application), 4
VirtualProtect pVTable + lFuncOffset, 4&, PAGE_EXECUTE_READWRITE, 0&
CopyMemory ByVal pVTable + lFuncOffset, AddressOf MeMsg, 4
End Sub

Private Function MeMsg(ByVal voObjPtr As Long, ByVal Param As Long) As Long
MsgBox "Excel 'Calculate Method Hooked !!"
End Function

Sub Test()
Application.Calculate
End Sub
AnswerRe: EXCEL - Hooking Excel VTABLE Pin
jaafar tribak17-Apr-15 13:59
jaafar tribak17-Apr-15 13:59 
QuestionHow to generate an early-bound COM object in VS2013 Pin
CrewR4-Mar-15 6:50
CrewR4-Mar-15 6:50 
SuggestionHow to reference IWshRuntimeLibrary Pin
ThanhTrungDo2-Mar-15 17:24
professionalThanhTrungDo2-Mar-15 17:24 
GeneralRe: How to reference IWshRuntimeLibrary Pin
Richard MacCutchan2-Mar-15 21:27
mveRichard MacCutchan2-Mar-15 21:27 
QuestionRegistration Free COM / COM Interop Pin
Michael Salzlechner8-Feb-15 3:28
Michael Salzlechner8-Feb-15 3:28 
AnswerRe: Registration Free COM / COM Interop Pin
F-ES Sitecore2-Mar-15 4:55
professionalF-ES Sitecore2-Mar-15 4:55 
GeneralRe: Registration Free COM / COM Interop Pin
DriveByCoder24-Mar-15 7:18
professionalDriveByCoder24-Mar-15 7:18 
GeneralRe: Registration Free COM / COM Interop Pin
F-ES Sitecore24-Mar-15 8:12
professionalF-ES Sitecore24-Mar-15 8:12 
QuestionHow to SubClass ContentControl in MSWORD Pin
Member 1017975812-Dec-14 16:07
Member 1017975812-Dec-14 16:07 
QuestionDCOM CLASSNOTREG error Pin
Billy Bang19-Nov-14 18:58
Billy Bang19-Nov-14 18:58 
AnswerRe: DCOM CLASSNOTREG error Pin
Richard MacCutchan19-Nov-14 21:29
mveRichard MacCutchan19-Nov-14 21:29 
GeneralRe: DCOM CLASSNOTREG error Pin
Billy Bang19-Nov-14 21:48
Billy Bang19-Nov-14 21:48 
GeneralRe: DCOM CLASSNOTREG error Pin
Richard MacCutchan19-Nov-14 22:49
mveRichard MacCutchan19-Nov-14 22:49 
QuestionHow to remove other submenu items when implement my context menu handle. Pin
chiyun11-Sep-14 20:39
chiyun11-Sep-14 20:39 
QuestionC# COM Server should be called by a C++ client... Pin
Juergen_8027-Aug-14 1:44
Juergen_8027-Aug-14 1:44 
SuggestionRe: C# COM Server should be called by a C++ client... Pin
Richard MacCutchan27-Aug-14 2:09
mveRichard MacCutchan27-Aug-14 2:09 
GeneralRe: C# COM Server should be called by a C++ client... Pin
Juergen_8027-Aug-14 2:27
Juergen_8027-Aug-14 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.