f



my hook can't work well,help me!

my hook already in a dll and the handle is shared,but the hook cant
work well,when i run the application,My mouse click the application's
view,the hook work well,but when i click the other place(like
taskbar),it cant work,why?help me.
this is the hook:
// HookDll.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "HookDll.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define WM_MAP_OPEN WM_USER+101
#define WM_DATA_READY WM_USER+102
#pragma data_seg("Shared")
static HHOOK hms=NULL;//系统钩子
HINSTANCE hins=NULL;
#pragma data_seg()
#pragma comment(linker, "/section:Shared, rws")

		HANDLE hMapFile;//内存数据共享区句柄
		LPVOID lpData;
		HWND Phwnd;//父窗口句柄


/////////////////////////////////////////////////////////////////////////////
// CHookDllApp

BEGIN_MESSAGE_MAP(CHookDll, CWinApp)
	//{{AFX_MSG_MAP(CHookDllApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHookDllApp construction
//回调函数
LRESULT __declspec(dllexport)__stdcall  CALLBACK HookProc(int
nCode,WPARAM wParam,LPARAM lParam)
{
	PMSG pmsg=(PMSG)lParam;
	if (nCode==HC_ACTION) {
	
		switch(pmsg->message)
		{
		case WM_KEYDOWN:
			//处理键盘按键按下消息,拷贝数据到内存共享区中
			{
				char KeyName[50];
				ZeroMemory(KeyName,50);
				GetKeyNameText(pmsg->lParam,KeyName,50);
				CString str;
				str="KeyPress(" + CString(KeyName) + ");";
			// 数据复制到共享内存
				//首先清空内存
				memset(lpData,NULL,100);	
				memcpy(lpData, str, str.GetLength());
			// 通知接收方接收数据
		
				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_KEYUP:
			//处理键盘按键释放消息
			{
				char KeyName[50];
				ZeroMemory(KeyName,50);
				GetKeyNameText(pmsg->lParam,KeyName,50);
				CString str;
				str="KeyUp(" + CString(KeyName)+");";
			// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
			// 通知接收方接收数据

				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_SYSKEYDOWN:
			//处理用户按下alt的同时按下其他的键消息
			{
				char KeyName[50];
				ZeroMemory(KeyName,50);
				GetKeyNameText(pmsg->lParam,KeyName,50);
				CString str;
				str="SysKeyDown(" + CString(KeyName)+");";
			// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
			// 通知接收方接收数据

				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_SYSKEYUP:
			//处理用户按下alt的同时按下其他的键消息
			{
				char KeyName[50];
				ZeroMemory(KeyName,50);
				GetKeyNameText(pmsg->lParam,KeyName,50);
				CString str;
				str="SysKeyUp(" + CString(KeyName)+");";
			// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
			// 通知接收方接收数据

				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
//		case WM_CHAR:
			//处理键盘按键消息
//			break;
/*		case WM_COMMAND:
			//处理菜单选择消息
			break;
		case WM_MOUSEMOVE:
			//处理鼠标移动消息
			break;*/
		case WM_LBUTTONDOWN:
			//处理鼠标左键按下消息
			{
				double x,y;
				x=LOWORD(pmsg->lParam);
				y=HIWORD(pmsg->lParam);
				CString strx,stry;
				strx.Format("%f",x);
				stry.Format("%f",y);
				CString str;
				str="MouseLbuttonDown("+strx+","+stry+");";
				// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
				// 通知接收方接收数据

				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_LBUTTONUP:
			//处理鼠标左键释放消息
			{
				double x,y;
				x=LOWORD(pmsg->lParam);
				y=HIWORD(pmsg->lParam);
				CString strx,stry;
				strx.Format("%f",x);
				stry.Format("%f",y);
				CString str;
				str="MouseLbuttonUp("+strx+","+stry+");";
				// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
				// 通知接收方接收数据
				/*char* str1[100];
				memcpy(str1, lpData, 100);*/
				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_LBUTTONDBLCLK:
			//处理鼠标双击消息
			{
				double x,y;
				x=LOWORD(pmsg->lParam);
				y=HIWORD(pmsg->lParam);
				CString strx,stry;
				strx.Format("%f",x);
				stry.Format("%f",y);
				CString str;
				str="MouseLbuttonDbClick("+strx+","+stry+");";
				// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
				// 通知接收方接收数据
	
				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_RBUTTONDOWN:
			//处理鼠标右键按下消息
			{
				double x,y;
				x=LOWORD(pmsg->lParam);
				y=HIWORD(pmsg->lParam);
				CString strx,stry;
				strx.Format("%f",x);
				stry.Format("%f",y);
				CString str;
				str="MouseRbuttonDown("+strx+","+stry+");";
				// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
				// 通知接收方接收数据

				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
		case WM_RBUTTONUP:
			//处理鼠标右键释放消息
			{
				double x,y;
				x=LOWORD(pmsg->lParam);
				y=HIWORD(pmsg->lParam);
				CString strx,stry;
				strx.Format("%f",x);
				stry.Format("%f",y);
				CString str;
				str="MouseRbuttonUp("+strx+","+stry+");";
				// 数据复制到共享内存
				memset(lpData,NULL,100);
				memcpy(lpData, str, str.GetLength());
				// 通知接收方接收数据

				::PostMessage(Phwnd, WM_DATA_READY, (WPARAM)0,
(LPARAM)str.GetLength());
			}
			break;
/*		case WM_SYSCOMMAND:
			//处理选择系统菜单或者选择最大化最小化按钮消息
			break;
*/
		}

    }

	LRESULT RetVal = CallNextHookEx( hms, nCode, wParam, lParam );	
	return  RetVal;
}
BOOL __declspec(dllexport)__stdcall installhook(HWND hwnd)
{
//	hkb=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,hins,0);
	Phwnd=hwnd;
		//建立内存共享区

		hMapFile=CreateFileMapping(INVALID_HANDLE_VALUE, NULL, 
			PAGE_READWRITE | SEC_COMMIT, 0, 100, "DataMap");
		if(hMapFile!=NULL)
		{
			lpData = (LPBYTE)MapViewOfFile(hMapFile, FILE_MAP_WRITE, 0, 0, 0);
			if (lpData == NULL)
			{
				CloseHandle(hMapFile);
				hMapFile = NULL;
			}
			// 通知接收程序内存文件映射对象的视图已经打开
			::PostMessage(Phwnd, WM_MAP_OPEN, 0, 0);

		}
	hms=SetWindowsHookEx(WH_GETMESSAGE,(HOOKPROC)HookProc,hins,0);
	return TRUE;
}
BOOL __declspec(dllexport)  Uninstallhook()
{ 
	BOOL unhooked=TRUE;
	if(hms!=NULL)
	{	
		unhooked = UnhookWindowsHookEx(hms);
		hms=NULL;
	}
	//释放内存共享区资源
	if (lpData != NULL)
	{
	UnmapViewOfFile(lpData);
	lpData = NULL;
	}
	if (hMapFile != NULL)
	{
	CloseHandle(hMapFile);
	}

	return unhooked;
} 
CHookDll::CHookDll()
{
	// TODO: add construction code here,

}
BOOL CHookDll::InitInstance()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	hins=AfxGetInstanceHandle();

	return TRUE;
}
BOOL CHookDll::ExitInstance()
{
	return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CHookDllApp object

CHookDll theDll;

//这是钩子的实现代码
0
ayiiq180
2/11/2004 9:35:18 AM
comp.lang.c++ 49423 articles. 7 followers. Post Follow

1 Replies
9965 Views

Similar Articles

[PageSpeed] 52

This question is off-topic on this ng. Try ngs on MS news server -
msnews.microsoft.com.
There is a lot of activity specially on microsoft.public.vc.language.

Best wishes,
Sharad


0
2/11/2004 11:27:04 AM
Reply:

Similar Artilces:

Help: I can't figure out why this won't work
I have a hyperlink on an ASP page that calls another ASP page with the code shown below. This page allows (forces) a user to select a file to be uploaded, then should call a third ASP page that will do the actual upload. What happens is I can enter a file name but the third page doesn't get loaded. I see the upload page being called in the browser when the alert message displays, but then it appears to reload this page. What am I missing??? I should also note that the upload page opens fine if I move the location.href command outside of the function (for testing purposes). <FORM N...

FAQ 5.33 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?
This message is one of several periodic postings to comp.lang.perl.misc intended to make it easier for perl programmers to find answers to common questions. The core of this message represents an excerpt from the documentation provided with Perl. -------------------------------------------------------------------- 5.33: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape charact...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted st...

FAQ 5.33: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?
This message is one of several periodic postings to comp.lang.perl.misc intended to make it easier for perl programmers to find answers to common questions. The core of this message represents an excerpt from the documentation provided with Perl. -------------------------------------------------------------------- 5.33: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape charact...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?
This message is one of several periodic postings to comp.lang.perl.misc intended to make it easier for perl programmers to find answers to common questions. The core of this message represents an excerpt from the documentation provided with Perl. -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape charact...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #5
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.36 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #2
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.36: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape character. The full list of these is in "Quote and Quote-like Operators" in perlop. Unsurprisingly, you don't have a file called "c:(tab)emp(formfeed)oo" or "c:(tab)emp(formfeed)oo.exe" on your legacy DOS filesystem. Either single-quote your strings, or (preferably) use forward slashes. Since all DOS and Windows versions since something like MS-DOS 2.0 or so have treated "/" and "\" the same in a path, you might as well use the one that doesn't clash with Perl--or the POSIX shell, ANSI C and C++, awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more portable, too. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily ex...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #9
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&quo...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #4
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape character. The full list of these is in "Quote and Quote-like Operators" in perlop. Unsurprisingly, you don't have a file called "c:(tab)emp(formfeed)oo" or "c:(tab)emp(formfeed)oo.exe" on your legacy DOS filesystem. Either single-quote your strings, or (preferably) use forward slashes. Since all DOS and Windows versions since something like MS-DOS 2.0 or so have treated "/" and "\" the same in a path, you might as well use the one that doesn't clash with Perl--or the POSIX shell, ANSI C and C++, awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more portable, too. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily e...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #10
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&quo...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #8
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.36 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? 466732
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.36: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted st...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #3
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #2
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.36 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #3
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.36: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&quo...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #7
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&quo...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #6
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #7
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&quo...

FAQ 5.36 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? 297624
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.36: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted st...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #9
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #8
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&quo...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #6
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape character. The full list of these is in "Quote and Quote-like Operators" in perlop. Unsurprisingly, you don't have a file called "c:(tab)emp(formfeed)oo" or "c:(tab)emp(formfeed)oo.exe" on your legacy DOS filesystem. Either single-quote your strings, or (preferably) use forward slashes. Since all DOS and Windows versions since something like MS-DOS 2.0 or so have treated "/" and "\" the same in a path, you might as well use the one that doesn't clash with Perl--or the POSIX shell, ANSI C and C++, awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more portable, too. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily ex...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #4 555136
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings (&qu...

FAQ 5.34 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? #2 554081
This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.34: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape character. The full list of these is in "Quote and Quote-like Operators" in perlop. Unsurprisingly, you don't have a file called "c:(tab)emp(formfeed)oo" or "c:(tab)emp(formfeed)oo.exe" on your legacy DOS filesystem. Either single-quote your strings, or (preferably) use forward slashes. Since all DOS and Windows versions since something like MS-DOS 2.0 or so have treated "/" and "\" the same in a path, you might as well use the one that doesn't clash with Perl--or the POSIX shell, ANSI C and C++, awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more portable, too. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily e...

Web resources about - my hook can't work well,help me! - comp.lang.c++

Resources last updated: 3/3/2016 5:33:50 PM