问题描述
以下是我的 WH_CBT
回调代码。我试图忽略 Outlook 中超链接的任何点击。当我单击 Outlook 中的超链接时,我收到一个消息框:
但是当我在没有 1
条件的回调中返回 if
时,它工作正常。
LRESULT __declspec(dllexport)__stdcall CALLBACK GetCBTProc(int nCode,WParaM wParam,LParaM lParam)
{
HRESULT hResult;
if (nCode < 0)
CallNextHookEx(hkb,nCode,wParam,lParam);
HWND parentWin;
DWORD ChiledThreadID;
DWORD parentProcessID = 0;
std::ostringstream streamcb;
DWORD xx = (DWORD)15028;
HWND hCurrWnd;
TCHAR clsName_v[22];
TCHAR className[22]="OleMainThreadWndClass";
LPCSTR oleName2 = _T("OLEChannelWnd");
int number;
f1 = fopen("C:\\Log\\report.txt","a+");
if (nCode == HCBT_CREATEWND)
{
hCurrWnd = (HWND)wParam;
parentWin = GetAncestor(hCurrWnd,GA_ROOT);
ChiledThreadID = GetwindowThreadProcessId(parentWin,&parentProcessID);
if (parentProcessID == xx)
{
writetofile("HCBT_CREATEWND",15,f1);
CBT_CREATEWNDA* cw = (CBT_CREATEWNDA*)lParam;
CREATESTRUCTA* lpcs = (CREATESTRUCTA*)cw->lpcs;
number = GetClassName(hCurrWnd,clsName_v,22);
writetofile(clsName_v,number,f1);
if (lpcs->lpszName)
{
if (CompareString(LOCALE_SYstem_DEFAULT,lpcs->lpszName,-1,_T("OLEChannelWnd"),13) == CSTR_EQUAL)
{
return 1;
}
}
}
}
fclose(f1);
LRESULT RetVal = CallNextHookEx(hkb,lParam);
return RetVal;
}
解决方法
您的代码缺少两个 *{
font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;
font-size: normal;
line-height: normal;
}
/*
Generic Styling,for Desktops/Laptops
note: the default HTML contains class="topTdStyle" which may be useful.
*/
table {
width: auto;
border-collapse: collapse;
}
td,{
padding: 6px;
border: 1px outset #fff;
text-align: left;
white-space: nowrap; /*creates scrollbar on iPads */
}
/*tr { border: 0px outset #fff; }*/
div,table,tbody {
border: none !important;
}
/*
Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px
and also iPads specifically.
*/
@media
only screen and (max-width: 760px),(min-device-width: 768px) and (max-device-width: 1024px) {
/* tr:nth-of-type(odd) {
background: #f2f2f2; }*/
/* Force table to not be like tables anymore */
table,thead,tbody,th,td,tr {
display: block;
}
/* Hide table headers (but not display: none;,for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr:first-child {
display: none;
}
tr {
border: 1px outset #fff;
}
td {
/* Behave like a "row" */
border: none;
/*border-bottom: 1px solid #eee; */
position: relative;
padding-left: 50%;
white-space: normal !important;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
}
/*
Label the data
*/
td:nth-of-type(1):before { content: "Event"; } /*used to be "Event"*/
td:nth-of-type(2):before { content: "Time"; }
td:nth-of-type(3):before { content: "Standard"; }
td:nth-of-type(4):before { content: "P/F/T"; }
td:nth-of-type(5):before { content: "Athlete"; }
td:nth-of-type(6):before { content: "Age at Meet"; }
td:nth-of-type(7):before { content: "Swim Date"; }
td:nth-of-type(8):before { content: "Meet Name"; }
}
语句,一个在 return
上,一个在回调的末尾。因此,除非输入字符串符合您的条件,否则回调的返回值是不确定。您的编译器应该警告您第二个缺失的 CallNextHookEx()
。具有非 return
返回类型的函数必须以 void
语句退出。
试试这个:
return <value>;