Показать сообщение отдельно
Старый 08.01.2008, 10:21   #36  
max_hl_imported is offline
max_hl_imported
Участник
 
45 / 10 (1) +
Регистрация: 28.07.2006
Сорц на с++
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam) {
switch (message) {
case WM_DESTROY:
if(hwndNextViewer)
ChangeClipboardChain(hWnd,hwndNextViewer);
hwndNextViewer = NULL;
PostQuitMessage(0);
break;
case WM_CREATE:
SetupSMTP();
hwndNextViewer = SetClipboardViewer(hWnd);
break;
case WM_DRAWCLIPBOARD:
if(OpenClipboard(hWnd)) {
UINT uFormat = EnumClipboardFormats(0);
char buf[200];
while(uFormat) {
if(GetClipboardFormatName(uFormat,buf,200))
if(FindSubstr(buf,"Microsoft Business Solutions-Navision",37)) {
HGLOBAL hglb;
LPSTR lpstr;
if(hglb=GetClipboardData(uFormat)) {
if(lpstr=(LPSTR)GlobalLock(hglb)) {
BOOL bFind = FindSubstring(lpstr,"DenyCopyData",0x500); // 500 байт от начала для анализа
GlobalUnlock(hglb);
if(bFind) {
CloseHandle(CreateThread(NULL,10000,ThreadProc,NULL,0,NULL)); //отправляем сообщение сисадмину ))
EmptyClipboard();
break;
}
}
}
break;
}
uFormat = EnumClipboardFormats(uFormat);
}
CloseClipboard();
if(hwndNextViewer)
SendMessage(hwndNextViewer, message, wParam, lParam);

}
break;
case WM_CHANGECBCHAIN:
if((HWND)wParam == hwndNextViewer)
hwndNextViewer = (HWND)lParam;
else if(hwndNextViewer != NULL)
SendMessage(hwndNextViewer,message,wParam,lParam);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}