Click here to Skip to main content
15,896,063 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Detect if any of controls inside a TableLayoutPanel is clicked Pin
Sascha Lefèvre6-Apr-15 8:00
professionalSascha Lefèvre6-Apr-15 8:00 
QuestionScroll controls in a TableLayoutPanel using code Pin
dilkonika3-Apr-15 18:45
dilkonika3-Apr-15 18:45 
AnswerRe: Scroll controls in a TableLayoutPanel using code Pin
Richard MacCutchan3-Apr-15 21:50
mveRichard MacCutchan3-Apr-15 21:50 
AnswerRe: Scroll controls in a TableLayoutPanel using code Pin
Dave Kreskowiak4-Apr-15 3:47
mveDave Kreskowiak4-Apr-15 3:47 
AnswerRe: Scroll controls in a TableLayoutPanel using code Pin
Sascha Lefèvre4-Apr-15 13:18
professionalSascha Lefèvre4-Apr-15 13:18 
GeneralRe: Scroll controls in a TableLayoutPanel using code Pin
dilkonika4-Apr-15 14:38
dilkonika4-Apr-15 14:38 
GeneralRe: Scroll controls in a TableLayoutPanel using code Pin
Sascha Lefèvre4-Apr-15 14:52
professionalSascha Lefèvre4-Apr-15 14:52 
QuestionEXCEL - Hooking Excel VTABLE Pin
jaafar tribak2-Apr-15 18:58
jaafar tribak2-Apr-15 18:58 
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
Dave Kreskowiak3-Apr-15 2:37
mveDave Kreskowiak3-Apr-15 2:37 
GeneralRe: EXCEL - Hooking Excel VTABLE Pin
jaafar tribak3-Apr-15 13:01
jaafar tribak3-Apr-15 13:01 
GeneralRe: EXCEL - Hooking Excel VTABLE Pin
Dave Kreskowiak3-Apr-15 14:52
mveDave Kreskowiak3-Apr-15 14:52 
GeneralRe: EXCEL - Hooking Excel VTABLE Pin
jaafar tribak3-Apr-15 17:49
jaafar tribak3-Apr-15 17:49 
GeneralRe: EXCEL - Hooking Excel VTABLE Pin
Dave Kreskowiak3-Apr-15 19:12
mveDave Kreskowiak3-Apr-15 19:12 
AnswerRe: EXCEL - Hooking Excel VTABLE Pin
jaafar tribak17-Apr-15 13:56
jaafar tribak17-Apr-15 13:56 
QuestionModify the number of rows that a datagridview can show instantly , on runtime Pin
dilkonika2-Apr-15 18:19
dilkonika2-Apr-15 18:19 
AnswerRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
Sascha Lefèvre2-Apr-15 18:54
professionalSascha Lefèvre2-Apr-15 18:54 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
dilkonika2-Apr-15 18:57
dilkonika2-Apr-15 18:57 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
Sascha Lefèvre2-Apr-15 19:14
professionalSascha Lefèvre2-Apr-15 19:14 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
dilkonika2-Apr-15 19:22
dilkonika2-Apr-15 19:22 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
Sascha Lefèvre2-Apr-15 19:52
professionalSascha Lefèvre2-Apr-15 19:52 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
dilkonika3-Apr-15 6:20
dilkonika3-Apr-15 6:20 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
Sascha Lefèvre3-Apr-15 6:25
professionalSascha Lefèvre3-Apr-15 6:25 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
dilkonika3-Apr-15 6:33
dilkonika3-Apr-15 6:33 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
Sascha Lefèvre3-Apr-15 6:40
professionalSascha Lefèvre3-Apr-15 6:40 
GeneralRe: Modify the number of rows that a datagridview can show instantly , on runtime Pin
dilkonika3-Apr-15 6:46
dilkonika3-Apr-15 6:46 

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.