对屏幕取词程序感兴趣的,可以看看

CCppCs 2003-03-28 03:13:46
我对一套能在WinXP和Win2000下取词的小程序进行了一点点改进,有兴趣的人可以到我的个人网站下载源码。
我的网站是:www.yangning.com
...全文
228 27 打赏 收藏 转发到动态 举报
写回复
用AI写文章
27 条回复
切换为时间正序
请发表友善的回复…
发表回复
大脚板 2003-06-24
  • 打赏
  • 举报
回复
不错
zsx0077133 2003-06-17
  • 打赏
  • 举报
回复
good!
UP
mathsword 2003-06-15
  • 打赏
  • 举报
回复
偶去看看!
hookuy 2003-06-15
  • 打赏
  • 举报
回复
UP
wwwxing 2003-06-12
  • 打赏
  • 举报
回复
好是好,可惜不能在W98下取,
请问在W98下,特别是取IE浏览器下的词怎么实现?
3m2u 2003-04-16
  • 打赏
  • 举报
回复


//-----------------------------------------------------------------------------
// begin get words
//-----------------------------------------------------------------------------
//此函数执行的是真正的取词操作。所以,是最重要的一个函数。
//此函数只是在CNhdemoApp::PreTranslateMessage(MSG* pMsg)函数中被调用了一次。
void NHD_BeginGetWord(POINT& ptMousePos)
{
char szAppClassName[NHD_CLASSNAME_LEN + 1];//NHD_CLASSNAME_LEN==64
HWND hAppWin;
int nFlyWinLeft;
int nFlyWinWidth;
RECT rcAppWin;

//get window from mouse point;
//The WindowFromPoint function retrieves a handle to the window that contains the specified point.
//The WindowFromPoint function does not retrieve a handle to a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.
hAppWin = WindowFromPoint(ptMousePos);//调用此函数,获取鼠标点下的窗口的句柄
//add begin
if(
g_hPushpin2Dlg == hAppWin||
g_hPushpinButton== hAppWin||
g_hIconButton_A == hAppWin||
g_hIconButton_B == hAppWin||
g_hIconButton_C == hAppWin||
g_hIconButton_D == hAppWin
)//不对Pushpin2Dlg窗口及其内部的子窗口取词
return;
//add end
//check if the app window is EDIT, if it is, redraw whole line;
//The GetClassName function retrieves the name of the class to which the specified window belongs.
//第二个参数是输出参数。输出的是the class name string。
GetClassName(hAppWin, szAppClassName, NHD_CLASSNAME_LEN);//取出鼠标点下的窗口的class name

DbgPrintf("YJK hAppWin: %x\n", hAppWin);//在“输出”窗口中显示调试信息:窗口句柄
DbgPrintf("YJK ClassName: %s\n", szAppClassName);//在“输出”窗口中显示调试信息:窗口类名

// special window class
if (stricmp(szAppClassName, "Edit") == 0 || //NotePad
stricmp(szAppClassName, "Internet Explorer_Server") == 0 || //IE4.0
stricmp(szAppClassName, "RichEdit") == 0 || //
stricmp(szAppClassName, "RichEdit20A") == 0 || //WordPad
stricmp(szAppClassName, "RichEdit20W") == 0 || //WordPad
stricmp(szAppClassName, "HTML_Internet Explorer") == 0 || //IE3.0
stricmp(szAppClassName, "ThunderTextBox") == 0 || //VB Edit
stricmp(szAppClassName, "ThunderRT5TextBox") == 0 || //VB Edit
stricmp(szAppClassName, "ThunderRT6TextBox") == 0 || //VB Edit
stricmp(szAppClassName, "EXCEL<") == 0 || //Excel 2000
stricmp(szAppClassName, "EXCEL7") == 0 || //Excel 2000
stricmp(szAppClassName, "EXCEL6") == 0 || //Excel 2000
stricmp(szAppClassName, "ConsoleWindowClass") == 0 || //NT V86
stricmp(szAppClassName, "_WwG") == 0 ||
stricmp(szAppClassName, "tty") == 0 ||
stricmp(szAppClassName, "ttyGrab") == 0) //Word97
{
//The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
GetWindowRect(hAppWin, &rcAppWin);//获取鼠标点下方的窗口的RECT
nFlyWinLeft = rcAppWin.left - 4;
nFlyWinWidth = rcAppWin.right - rcAppWin.left - 8;//鼠标点下方的窗口的RECT减8,也是够宽的了。

//do not repaint whole line if too long;
if ((ptMousePos.x - nFlyWinLeft) > 200)
{
//这里的代码是用来保证nFlyWinLeft与ptMousePos.x之间的距离不会超过200
nFlyWinLeft = ptMousePos.x - 200;
}

DbgPrintf("!!!!tty window");//在“输出”窗口中显示调试信息而已。
}
else//在VC6源码编辑器中的取词,获取的窗口ClassName是“Afx:400000:8”,不满足上面的条件,所以会执行else代码块中的代码。
{
nFlyWinLeft = ptMousePos.x;
nFlyWinWidth = NHD_FLYWIN_WIDTH;//NHD_FLYWIN_WIDTH宏的值是1,这样,fly-window的宽度就是1了。
}

//note: move the fly-window to cursor pos "y - 1" to aviod mouse shape changing between ARROW and EDIT in edit area;
//use SetWindowPos instead of MoveWindow, for MoveWindow can not make menu item redraw.
SetWindowPos(g_hFlyWin, HWND_TOPMOST,
nFlyWinLeft,
ptMousePos.y - 1 ,
nFlyWinWidth,
NHD_FLYWIN_HEIGHT,
SWP_NOACTIVATE | SWP_NOREDRAW);

//set flag to avoid re-entry;
g_bInGetWord = TRUE;

//hook TextOut;
//hook TextOut; 将第一个参数设为GETWORD_ENABLE,表示: 开始取词。
fpBL_SetFlag32(GETWORD_ENABLE, g_hFlyWin, ptMousePos.x, ptMousePos.y);//此函数在ReadMe.rtf文件中有介绍。
//把fly-window窗口又移动到新的位置(其实,这个位置是在屏幕之外,窗口的宽度和高度都是1,所以,只有一个像素而已)
//由于窗口被移走了,所以,鼠标下面的窗口会被重绘,如果鼠标下有字,就会引起TextOut函数
//被调用,而由于在上面已经把微软的TextOut函数给换成了Dll中的TextOut32函数,所以,就可以
//从传递给此函数的参数中获取“词”了,这就是鼠标屏幕取词的原理。
// Sleep(500);
// Beep(1000,50);
MoveWindow(g_hFlyWin, -1, -1, NHD_FLYWIN_WIDTH, NHD_FLYWIN_HEIGHT, TRUE);//将fly-window移走,这导致鼠标下的窗口被重绘

DbgPrintf("ptMousePos(%d, %d)\n", ptMousePos.x, ptMousePos.y);//输出调试信息而已。不管它。

ASSERT (g_nGWTimerID == 0);//此变量是用来存放SetTimer函数的返回值用的。此变量不为0时,表示定时器有效
//定时器的timer identifier==2;time-out value==200毫秒;
g_nGWTimerID = SetTimer(g_hFlyWin, NHD_GETWORD_TIMER, NHD_GW_WAITING_TIME, (TIMERPROC)NHD_GetWordTimerProc);
//此g_nGWTimerID变量是用来存放SetTimer函数的返回值用的。此变量不为0时,表示定时器有效
ASSERT (g_nGWTimerID != 0);
}

//-----------------------------------------------------------------------------
// copy words in buffer to destination
//-----------------------------------------------------------------------------

BOOL NHD_CopyWordsTo(char* szBuffer, int nBufferSize)
{
ASSERT(szBuffer);
//g_TextBuffer肯定是用来存放从屏幕中取出的词用的,是个全局的字符串缓冲区。
int nLen = strlen(g_TextBuffer);//取其长度
//如果其长度大于目的缓冲区的长度,则
if(nLen + 1 > nBufferSize)
{
return FALSE;//返回false,表示失败了
}

memset(szBuffer, 0, nBufferSize);//先将输出缓冲区初始化为0
memcpy(szBuffer, g_TextBuffer, nLen);//拷贝串到输出缓冲区szBuffer中。

return TRUE;
}
3m2u 2003-04-16
  • 打赏
  • 举报
回复


//-----------------------------------------------------------------------------
// destroy auxiliary window
//-----------------------------------------------------------------------------
//销毁那个用来使鼠标点下的窗口区域重绘的fly-window
BOOL NHD_DestroyWindow()
{
if (g_hFlyWin)
{
DestroyWindow(g_hFlyWin);
g_hFlyWin = NULL;
}

return TRUE;
}

//-----------------------------------------------------------------------------
// initial function called once before getting words
//-----------------------------------------------------------------------------
//调用此函数时,第二个参数传递的是对话框窗口的window handle
//此函数只是在CNhdemoDlg::OnInitDialog()函数体中被调用了一次。
HWND NHD_InitGetWords(HINSTANCE hInst, HWND hwnd)
{
//save NH main window to send run time error messages:
g_hNHMainWin = hwnd;//保存 对话框窗口的window handle
//如果 load nhw32.dll 不成功,则
if (!NHD_LoadGetWordLib())
{ //调用此函数,free nhw32.dll
NHD_FreeLoadedLib();
return NULL;
}

//Create fly_window (cause paint) and show text window;
//fly_window大概就是那个跟随鼠标移动的窗口,引起鼠标下的窗口的部分区域重绘,导致TextOutA函数被调用。
//text window是什么?
g_hFlyWin = NHD_CreateWindow(hInst);//create auxiliary window used to help get text on screen
//如果auxiliary window创建失败,则
if (!g_hFlyWin)
{
NHD_FreeLoadedLib();//调用此函数,free nhw32.dll
return NULL;
}
//The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages.
//If the message is successfully registered, the return value is a message identifier in the range 0xC000 through 0xFFFF.If the function fails, the return value is zero.
g_WM_GetWordOk = RegisterWindowMessage(GWMSG_GETWORDOK);//注册一个自定义消息GWMSG_GETWORDOK,需要注意的是:此消息在nhw32.dll中也被定义了一遍,但是由于两个消息的内容完全相同,所以,两次对RegisterWindowMessage函数的调用,返回的是同一个消息的注册编号。
//如果注册自定义消息失败,则
if (!g_WM_GetWordOk)
{
NHD_FreeLoadedLib();//调用此函数,free nhw32.dll
return NULL;
}

return g_hFlyWin;//返回的是auxiliary window(或叫做fly_window)的句柄
}

//-----------------------------------------------------------------------------
// deinit function called when not get words any more
//-----------------------------------------------------------------------------
//很简单的函数,没什么可以解释的。
BOOL NHD_ExitGetWords(void)
{
//free libarys:
NHD_FreeLoadedLib();

NHD_DestroyWindow();

return TRUE;
}

//-----------------------------------------------------------------------------
// timer process callback function used to get text from buffer
//-----------------------------------------------------------------------------
//定时器的timer procedure,延时到了之后,会调用此过程。定时器的timer identifier==2;time-out value==200毫秒;
void CALLBACK NHD_GetWordTimerProc(HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime)
{
ASSERT (g_nGWTimerID != 0);//此变量是用来存放SetTimer函数的返回值用的。此变量不为0时,表示定时器有效

//may be prior finished by Getword message;???
//如果是处于取词状态下,则
if (g_bInGetWord)
{
g_bInGetWord = FALSE;//表示取词结束了
//UnHook TextOut; 将第一个参数设为GETWORD_DISABLE,表示: 停止取词。因为词已经被取出来了,不用再取了。
fpBL_SetFlag32(GETWORD_DISABLE, NULL, 0, 0);//此函数在ReadMe.rtf文件中有介绍。
//此函数在ReadMe.rtf文件中有介绍。
fpBL_GetText32(g_TextBuffer, NHD_MAX_TEXTLEN, &g_WordRect);//从内部缓冲区取出单词文本串,放到全局字符串缓冲区g_TextBuffer中。
}

KillTimer(g_hFlyWin, NHD_GETWORD_TIMER);//销毁定时器
g_nGWTimerID = 0;//此变量是用来存放SetTimer函数的返回值用的。此变量为0时,表示定时器无效

//给对话框程序窗口发送自定义消息NHD_WM_GETWORD_OK,通知对话框程序窗口已经取到了新词,可以在Edit控件中把新词显示出来了。
PostMessage(g_hNHMainWin, NHD_WM_GETWORD_OK, 0, 0);

return;
}

//add begin
void SavePushpin2DlgHWND(HWND hwnd)
{
// g_hPushpin2Dlg=hwnd;
//#define IDC_PUSHPIN_BUTTON 1000
//g_hPushpinButton=GetDlgItem(g_hPushpin2Dlg,1000);
//#define IDC_BUTTON_A 1005
//g_hIconButton_A=GetDlgItem(g_hPushpin2Dlg,1005);
//#define IDC_BUTTON_B 1006
//g_hIconButton_B=GetDlgItem(g_hPushpin2Dlg,1006);
//#define IDC_BUTTON_C 1007
//g_hIconButton_C=GetDlgItem(g_hPushpin2Dlg,1007);
//#define IDC_BUTTON_D 1008
//g_hIconButton_D=GetDlgItem(g_hPushpin2Dlg,1008);
}
//add end


3m2u 2003-04-16
  • 打赏
  • 举报
回复
续:
//-----------------------------------------------------------------------------
// load nhw32.dll
//-----------------------------------------------------------------------------
//此函数只是在HWND NHD_InitGetWords(...)函数中被调用了一次。
BOOL NHD_LoadGetWordLib(void)
{
//采用的是“显式”加载dll的方法,也叫“动态”加载。
g_hGetWordInst = LoadLibrary("nhw32.dll");//此语句引起DllMain函数被调用。
if (!g_hGetWordInst)
{
DbgPrintf("NHD_LoadGetWordLib loading error!\n") ;//在VC6中的“输出”窗口中显示字符串,或者是让the system debugger displays the string.
return FALSE;
}

//果然是如此,用“显式”加载的方法加载DLL,通常都需要使用函数指针来保存从DLL中获取的函数地址。
fpBL_GetText32 = (BL_GETTEXT32)GetProcAddress(g_hGetWordInst, "BL_GetText32");
if (!fpBL_GetText32)
{
return FALSE;
}

fpBL_SetFlag32 = (BL_SETFLAG32)GetProcAddress(g_hGetWordInst, "BL_SetFlag32");
if (!fpBL_SetFlag32)
{
return FALSE;
}

//only valid in windows NT environment
//又定义了一个函数指针类型
typedef BOOL (WINAPI *SETNHW32)();
SETNHW32 SetNHW32 = NULL;
//从加载的DLL中获取函数SetNHW32的地址。
SetNHW32 = GetProcAddress(g_hGetWordInst, "SetNHW32");
//如果获取函数地址成功,则
if(SetNHW32)
{
//调用SetNHW32函数(Win NT/2000 环境下的初始化函数。一般在程序开始时,调用一次。如果成功返回 TRUE ,失败返回 FALSE 。)
if(!SetNHW32())//调用DLL中的函数。此函数就是调用了SetWindowsHookEx函数。
{
DbgPrintf("Unable to Set nhw32!");
return FALSE;
}
}

return TRUE;
}

//-----------------------------------------------------------------------------
// free nhw32.dll
//-----------------------------------------------------------------------------

void NHD_FreeLoadedLib(void)
{
//如果已经加载了DLL文件到进程的地址空间中,则
if (g_hGetWordInst)
{
//only valid in windows NT enviroment

typedef BOOL (WINAPI *RESETNHW32)();//定义一个函数指针类型
RESETNHW32 ResetNHW32 = NULL;
//获取DLL中的函数ResetNHW32的地址
ResetNHW32 = GetProcAddress(g_hGetWordInst, "ResetNHW32");
//如果获取函数地址成功,则
if(ResetNHW32)
{
ResetNHW32();//调用DLL中的函数ResetNHW32(调用UnhookWindowsHookEx函数,把钩子摘下来)。
}

FreeLibrary(g_hGetWordInst);//卸载已经加载了的DLL文件。
g_hGetWordInst = NULL;
}

return ;
}

//-----------------------------------------------------------------------------
// auxiliary window process function
//-----------------------------------------------------------------------------
//下面的函数是:那个引起窗口重绘的小窗口的窗口过程
LRESULT CALLBACK NHD_FlyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
//我认为,这里的代码是多余的,所以,试着注释掉看看效果如何。
//答:我注释掉了这里的代码后,一切都正常,目前还没发现有什么不对的,所以,我暂时先认为
//这里的代码是多余的吧。等发现了问题后再说。
/*
//Unhook textout when receive GWMSG_GETWORDOK msg from getword;
//如果此窗口过程接收到的消息是GWMSG_GETWORDOK消息,则
if (msg == g_WM_GetWordOk)//从名字上分析,GWMSG_GETWORDOK消息的含义是:The operating of getting word already OK!由于词已经被取出来了,所以就不需要再取了,所以就Unhook textout function.
{
//如果已经开始取词了,则
if (g_bInGetWord)
{
g_bInGetWord = FALSE;//表示取词结束了
//此变量是用来存放SetTimer函数的返回值用的。此变量不为0时,表示定时器有效
ASSERT(g_nGWTimerID != 0);//仅仅是判断一下g_nGWTimerID是否不等于0
//g_hFlyWin是那个auxiliary window的窗口句柄,这说明,定时器是属于auxiliary window窗口的。
KillTimer(g_hFlyWin, NHD_GETWORD_TIMER);//销毁GETWORD_TIMER定时器
g_nGWTimerID = 0;//此变量是用来存放SetTimer函数的返回值用的。此变量为0时,表示定时器无效

//UnHook TextOut; 将第一个参数设为GETWORD_DISABLE,表示: 停止取词。因为词已经被取出来了,不用再取了。
fpBL_SetFlag32(GETWORD_DISABLE, NULL, 0, 0);//此函数在ReadMe.rtf文件中有介绍。

//get word on cursor pos; 获取鼠标位置处的word
if (wParam == 0)//???为什么要加上这么一个条件判断呢?为什么???
{
//get word from 16BIT API HOOK for NORMAL App;
//此函数在ReadMe.rtf文件中有介绍。
fpBL_GetText32(g_TextBuffer, NHD_MAX_TEXTLEN, &g_WordRect);//从内部缓冲区取出单词文本串,放到全局字符串缓冲区g_TextBuffer中。
}

PostMessage(g_hNHMainWin, NHD_WM_GETWORD_OK, 0, 0);//给对话框程序窗口发送自定义消息NHD_WM_GETWORD_OK,通知对话框程序窗口已经取到了新词,可以在Edit控件中把新词显示出来了。

return (0);
}
}
*/
return (DefWindowProc(hWnd, msg, wParam, lParam));
}

//-----------------------------------------------------------------------------
// create auxiliary window used to help get text on screen
//-----------------------------------------------------------------------------
//hInst参数传递的是对话框程序的模块句柄
HWND NHD_CreateWindow(HINSTANCE hInst)
{
HWND hwnd;
WNDCLASS wc;

if (hInst == NULL)
{
return NULL;
}

//create a very small window, cause AP paint by moving it;
wc.lpszMenuName = NULL;
wc.lpszClassName = "NHD_FLYWIN_DEMO";
wc.hInstance = hInst;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.style = WS_EX_TOPMOST;
wc.lpfnWndProc = NHD_FlyWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;

RegisterClass(&wc);//注册窗口类
//WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.
hwnd = CreateWindowEx (WS_EX_TOPMOST | WS_EX_TOOLWINDOW,
"NHD_FLYWIN_DEMO",
"NHD_FlyWindow_Demo",
WS_POPUP | WS_VISIBLE,
NHD_WIN_INITPOSX, //宏定义,等于-1
NHD_WIN_INITPOSY, //宏定义,等于-1
NHD_FLYWIN_WIDTH, //宏定义,等于1
NHD_FLYWIN_HEIGHT, //宏定义,等于1
NULL,
NULL,
hInst,
NULL);//宽度和高度都是1的窗口,不就是只显示一个像素吗???

//注意了,窗口虽然被创建出来了,但是,并没有被显示出来。

return hwnd;
}
3m2u 2003-04-16
  • 打赏
  • 举报
回复
哪里屏掉了取数字和特殊符号?我怎么没看出来呀。

getwords.cpp

//***************************************************************************//
//File Name : getwords.cpp
//Content : get words demo using nhw32.dll
//Version : 0.01
//Date : 2000/7/15
//Aurthor : ITC RD-VIOLET1
//***************************************************************************//

#include "stdafx.h"
#include "getwords.h"

//-----------------------------------------------------------------------------
// Global variables:
//-----------------------------------------------------------------------------

HINSTANCE g_hGetWordInst = NULL;
BOOL g_bInGetWord = FALSE;
char g_TextBuffer[NHD_MAX_TEXTLEN];
RECT g_WordRect;
UINT g_WM_GetWordOk;
UINT g_nGWTimerID = 0;//此变量是用来存放SetTimer函数的返回值用的。此变量不为0时,表示定时器有效
HWND g_hNHMainWin = NULL;
HWND g_hFlyWin = NULL;
HWND g_hPushpin2Dlg;//added by yjk
HWND g_hPushpinButton;//added by yjk
HWND g_hIconButton_A;//added by yjk
HWND g_hIconButton_B;//added by yjk
HWND g_hIconButton_C;//added by yjk
HWND g_hIconButton_D;//added by yjk
/*----------------------------------------------------------------------------

nhw32.dll exports two function mainly:
******************************************************************
DWORD WINAPI BL_SetFlag32(UINT nFlag,
HWND hNotifyWnd,
int MouseX,
int MouseY
)
functions:
Start or Stop getting word.
parameters:
nFlag
[in] specify the following values
GETWORD_ENABLE: start getting word. set this flag before repaint region where
the word is around. In order to get words, need to repaint
region where the word is around.
GETWORD_DISABLE: stop getting word.
hNotifyWnd
[in] handle to be notified window. when the word has been got, send a registered
GWMSG_GETWORDOK message to window which handle is hNotifyWnd.
MouseX
[in] Specify the x-coordinate of point where the word is around.
MouseY
[in] Specify the y-coordinate of point where the word is around.
return values:
can be ignored.
==============================================================================
DWORD WINAPI BL_GetText32(LPSTR lpszCurWord,
int nBufferSize,
LPRECT lpWordRect
)
functions:
get words text string from internal buffer.
Parameters:
lpszCurWord
[in] pointer to destination buffer to which copy words got.
nBufferSize
[in] size of destination buffer.
lpWordRect
[out] pointer to RECT struct where defines the coordinates of the upper-left and
lower-right corners of a corresponding word's rectangle.
Return values:
Current Caret place in total word.

**************************************************************************
The NT version nhw32.dll specially exports other two function beside
above two function:
**************************************************************************

BOOL WINAPI SetNHW32()
functions:
initial function only valid in Win NT/2000 environment.
return values:
TRUE if successful, FALSE if failed.
===========================================================================
BOOL WINAPI ResetNHW32()
functions:
only valid in Win NT/2000 environment, must be called before exit programm.
return values:
TRUE if successful, FALSE if failed.
=============================================================================

note: The WinNT/2000 version nhw32.dll is different from Win95/98 version nhw32.dll, but
BL_SetFlag32 and BL_GetText32 - two function's interface is same.

-------------------------------------------------------------------------------*/

//-----------------------------------------------------------------------------
// import functions from nhw32.dll
//-----------------------------------------------------------------------------
//定义了两个函数指针类型
typedef DWORD (WINAPI *BL_SETFLAG32)(UINT nFlag, HWND hNotifyWnd, int MouseX, int MouseY);
typedef DWORD (WINAPI *BL_GETTEXT32)(LPSTR lpszCurWord, int nBufferSize, LPRECT lpWordRect);
//定义了两个函数指针类型的变量
BL_GETTEXT32 fpBL_GetText32 = NULL;
BL_SETFLAG32 fpBL_SetFlag32 = NULL;

//-----------------------------------------------------------------------------
// internal functions called from this file
//-----------------------------------------------------------------------------
//这个代码块,是预先声明几个函数。
void NHD_FreeLoadedLib(void);
void CALLBACK NHD_GetWordTimerProc(HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime);
HWND NHD_CreateWindow(HINSTANCE hInst);
BOOL NHD_DestroyWindow(void);
BOOL NHD_LoadGetWordLib(void);
LRESULT CALLBACK NHD_FlyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
VOID dbgPrintf(LPTSTR fmt, ...);//此函数的参数个数是可变的。

//-----------------------------------------------------------------------------
// function used to output debug message
//-----------------------------------------------------------------------------

#ifdef _DEBUG
VOID dbgPrintf(LPTSTR fmt, ...)
{
va_list marker;
TCHAR szBuf[1024];

va_start(marker, fmt);
wvsprintf(szBuf, fmt, marker);
va_end(marker);
//The OutputDebugString function sends a string to the debugger for display. If the application has no debugger, the system debugger displays the string. If the application has no debugger and the system debugger is not active, OutputDebugString does nothing.
OutputDebugString(szBuf);
OutputDebugString(TEXT("\r\n"));
}

#define DbgPrintf dbgPrintf
#else
//下面的这一句代码真是荒唐,后面的这部分“1 ? ((void)0) : dbgPrintf”,结果肯定是“((void)0)”呀,真是啰嗦。
#define DbgPrintf 1 ? ((void)0) : dbgPrintf
#endif //_DEBUG


meet99 2003-04-13
  • 打赏
  • 举报
回复
up
OnceILoveLinda 2003-04-13
  • 打赏
  • 举报
回复
up
fishsward 2003-04-12
  • 打赏
  • 举报
回复
帮你up一下!
3m2u 2003-04-12
  • 打赏
  • 举报
回复
好东西啊,谢谢你
你的资料我下载了 :)
CCppCs 2003-03-30
  • 打赏
  • 举报
回复
3jaja(3++输入法),我访问过你的网站了,不错。
你的个人网站的访问量居然有一万多,真是厉害!
yaotang 2003-03-30
  • 打赏
  • 举报
回复
GZ
3jaja 2003-03-29
  • 打赏
  • 举报
回复
谢谢,交个朋友,关于网页速成,有空到我的网站看看,http://www.freewebs.com/3jj/。
CCppCs 2003-03-29
  • 打赏
  • 举报
回复
我的网站恢复了,但是,访问速度比以前慢了一些。
谢谢各位网友帮我up.
CCppCs 2003-03-29
  • 打赏
  • 举报
回复
多谢各位的支持。
现在回答tomew(渔夫㊣)的问题:并不是不识别数字,而是被作者的代码过滤掉了,因为数字并不是“词”呀。如果你想要识别数字,只需要把程序的代码改一下就行了。
XueBoy163 2003-03-29
  • 打赏
  • 举报
回复
帮你UP
luckypopy 2003-03-29
  • 打赏
  • 举报
回复
why???
加载更多回复(6)

1,650

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 非技术类
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧