I am using VB.net to develop an application, but there needs to be applied to the dll technology.

So come here to seek help.

First I will describe the features I need this dll

I want to monitor an application's window to get in on a PSD_ENVSTAMPRECT the lParam value.

Here I use SPY + + to monitor the application's window to get that information.

<00031> 00020E46 S WM_PSD_ENVSTAMPRECT wParam: 00000001 lParam: 00000001 <<<1
<00032> 00020E46 R WM_PSD_ENVSTAMPRECT lResult: 00000000
<00033> 00020E46 S WM_PSD_PAGESETUPDLG wParam: 00000000 lParam: 00000000
<00034> 00020E46 R WM_PSD_PAGESETUPDLG lResult: 00000001
<00035> 00020E46 S WM_PSD_ENVSTAMPRECT wParam: 00000001 lParam: 00000002 <<<2
<00036> 00020E46 R WM_PSD_ENVSTAMPRECT lResult: 00000000
<00037> 00020E46 S WM_PSD_PAGESETUPDLG wParam: 00000000 lParam: 00000000
<00038> 00020E46 R WM_PSD_PAGESETUPDLG lResult: 00000002
<00039> 00020E46 S WM_PSD_ENVSTAMPRECT wParam: 00000001 lParam: 00000003 <<<3 of lParam value for WM_PSD_ENVSTAMPRECT
<00040> 00020E46 R WM_PSD_ENVSTAMPRECT lResult: 00000000
<00041> 00020E46 S WM_PSD_PAGESETUPDLG wParam: 00000000 lParam: 00000000


This window WM_PSD_ENVSTAMPRECT function of the value of lParam will update immediately.

I would like to create a globle hook by to monitor the application window WM_PSD_ENVSTAMPRECT in the lParam of the message.

I spent a lot of time to study a lot with the HOOK on the C + + code.

But this problem is too difficult for me.

Difficult to understand.

Please do not give me references.
I've searched a lot of reference material.
I know of are:
1 have to install a hook
2 Select the type of hook
3 defines the structure
4 shared memory should also consider
5 off hook

Install a hook type hook with SetWindowEx do not know what was right.
Define the structure do not know what to consider?

I want to direct this project for me to give me what to write code directly into the help

Thank you.

The following is my code:
-----------------------------------------------

// hookps.cpp : Custom DLL's exported function application.
//
#include <windows.h>
#include "stdafx.h"



 HWND g_hWnd;
 HHOOK hThisHook; //Save the hook handle.
 static LRESULT CALLBACK HookedShellProc(int nCode, WPARAM wParam, LPARAM lParam);
 //Define common data structures
typedef struct
{
 HHOOK hThisHook; //Currently in use HOOK
 //... Increase the sharing of other information here.
};

LRESULT HookProc (
  int code,       // hook code
  WPARAM wParam,  // virtual-key code
  LPARAM lParam   // keystroke-message information
);

HINSTANCE hDll;
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
)
{
hDll = (HINSTANCE) hModule;
    return TRUE;
};

int GetWindowTextRemote(HWND hwnd,LPSTR lpString)
{
    g_hWnd=hwnd;
    hThisHook=SetWindowsHookEx(WH_SHELL,(HOOKPROC)HookProc,hDll,GetWindowThreadProcessId(hwnd,NULL) );

};

#define RELEASEHOOK(hThisHook)                                                              //  <<<<Off the hook.
{                                  //<<<  I do not know why the smoke has IntelliSense: must be declared.
 if(hThisHook)
  {
   UnhookWindowsHookEx(hThisHook);
   hThisHook = NULL;
  }
};

enum
{
HM_SHELL = 0x0100,
};

--------------------------

# define RELEASEHOOK (hThisHook) / / <<<<<< off the hook
{//<<<
Here do not know why the above has been cropped IntelliSense: The error message must be declared.

This is one of the problems.

Then I now need to add anything in the code or what is wrong or which side of the extra code.

Or where the code is useless at this type of hook in the wrong.

Please give these questions for me to help me.

Edited 5 Years Ago by ctjh900801: n/a

There is an example of setting a windows hook in my skydrive (the link in my signature).

Otherwise, I read your whole post and still don't know what you are wanting.

Sorry, I repeat my clear design of the program.

I use VB.NET to develop a program, but involves third-party software to monitor the control interface.

So I must use C + + to develop a hook.

By creating a dll.

This third-party software to monitor the control interface to send a message to my VB.NET program.

I want to monitor third-party software for this control interface is this:

https://byfiles.storage.live.com/y1pqTTSlpLBQdKlbhIIknehZTP4Gnzrny4bANCyTSWCzvgq_VpT_OL8L5eS5dBTbMnerbe29WsNqH4/app3.JPG?psid=1

Then I used SPY + + to view the following information to be:

<00031> 00020E46 S WM_PSD_ENVSTAMPRECT wParam: 00000001 lParam: 00000001 <<<1
<00032> 00020E46 R WM_PSD_ENVSTAMPRECT lResult: 00000000
<00033> 00020E46 S WM_PSD_PAGESETUPDLG wParam: 00000000 lParam: 00000000
<00034> 00020E46 R WM_PSD_PAGESETUPDLG lResult: 00000001
<00035> 00020E46 S WM_PSD_ENVSTAMPRECT wParam: 00000001 lParam: 00000002 <<<2
<00036> 00020E46 R WM_PSD_ENVSTAMPRECT lResult: 00000000
<00037> 00020E46 S WM_PSD_PAGESETUPDLG wParam: 00000000 lParam: 00000000
<00038> 00020E46 R WM_PSD_PAGESETUPDLG lResult: 00000002
<00039> 00020E46 S WM_PSD_ENVSTAMPRECT wParam: 00000001 lParam: 00000003 <<<3 of lParam value for WM_PSD_ENVSTAMPRECT
<00040> 00020E46 R WM_PSD_ENVSTAMPRECT lResult: 00000000
<00041> 00020E46 S WM_PSD_PAGESETUPDLG wParam: 00000000 lParam: 00000000

I have to get the PSD_ENVSTAMPRECT of lParam value of information.

To my VB.NET program.

I have supplemented the program the following concept map to explain my design:

https://byfiles.storage.live.com/y1ppILAf6GarrrPP1CMc1IQFedyw02aeYSa6iaOQ4bOXB44SY7VUMwt58ITns__cnUtxT-KiunwmCQ/appp.JPG?psid=1

I hope my explanation, make you more clear about my problem.

But I did not experience developed over hook.

A bunch of information on the network but also be hard for me.

Now I need someone to guide me to develop this hook.

Edited 5 Years Ago by ctjh900801: n/a

This article has been dead for over six months. Start a new discussion instead.