Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2002.01.31;
Скачать: [xml.tar.bz2];

Вниз

Блокировка сочетаний типа Win+M и т.п.   Найти похожие ветки 

 
Crafox   (2001-12-04 19:51) [0]

Кто нить знает как осуществить подобное ? Пробовал ставить хук, он отслеживать то нажатие отслеживает, а вот отменять действие не отменяет. Кто нить сталкивался с подобным или видел где примеры как добиться желаемого.


 
Cobalt   (2001-12-04 22:27) [1]

В каком смысле не отменяет?
1) Что, все сочетания Win+Key получаешь с кодом HC_NOREMOVE?
Или 2)ты не знаешь как отменить нажатие?
тогда Reading The F*cking Manual()Win32 Reference


 
Holms   (2001-12-04 22:32) [2]

Вот код на С,(Alt+Esc, Ctrl+Esc, and Alt+Tab are now not working) если очень будет надо переведешь и снабдишь для своих целей.


#define _WIN32_WINNT 0x0400
#include <Windows.h>
#include<conio.h>
#include<stdio.h>
#include <stdlib.h>
#include <string.h>


///////////////////////////////////////////////////////////////////////////////


LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam) {

BOOL fEatKeystroke = FALSE;
if (nCode == HC_ACTION) {
switch (wParam) {
case WM_KEYDOWN: case WM_SYSKEYDOWN:
case WM_KEYUP: case WM_SYSKEYUP:
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
fEatKeystroke =
( (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0) ) ||
( (p->vkCode == VK_ESCAPE) && ((p->flags & LLKHF_ALTDOWN) != 0) ) ||
( (p->vkCode == VK_ESCAPE) && ((GetKeyState(VK_CONTROL) & 0x8000) != 0) )||
( (p->vkCode == 46) && ( (p->flags & LLKHF_ALTDOWN) != 0 ) &&
( (GetKeyState(VK_CONTROL) & 0x8000) != 0));
//its possible to add other keys....
//the 46 means del
break;
}
}
return(fEatKeystroke ? 1 : CallNextHookEx(NULL, nCode, wParam, lParam));
}

typedef int (__stdcall * pFunc)();
///////////////////////////////////////////////////////////////////////////////


int WINAPI WinMain(HINSTANCE hinstExe, HINSTANCE, PTSTR pszCmdLine, int) {

// Install the low-level keyboard & mouse hooks
HHOOK hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL,
(pFunc)LowLevelKeyboardProc, hinstExe, 0);

// Keep this app running until we"re told to stop
MessageBox(NULL,
TEXT("Alt+Esc, Ctrl+Esc, and Alt+Tab are now not working.\n"),
TEXT("Disable Low-Level Keys"), MB_OK);
UnhookWindowsHookEx(hhkLowLevelKybd);

return(0);
}




 
Вот вам кукиш   (2001-12-05 05:09) [3]

Вот собственно "мессаге постер" который так просто не минимизировать


object Form1: TForm1
Left = 453
Top = 421
Width = 195
Height = 135
BorderIcons = [biSystemMenu]
Caption = "Messages Poster"
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = "MS Sans Serif"
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
OnActivate = FormActivate
OnCreate = FormCreate
OnDestroy = FormDestroy
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 33
Top = 12
Width = 25
Height = 13
Caption = "Host:"
end
object Label2: TLabel
Left = 12
Top = 36
Width = 46
Height = 13
Caption = "Message:"
end
object EHost: TComboBox
Left = 64
Top = 8
Width = 121
Height = 21
Hint = "Ins - add host, Del - delete host"
ItemHeight = 13
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnKeyDown = EHostKeyDown
end
object EMsg: TMemo
Left = 64
Top = 40
Width = 121
Height = 65
Hint = ""Shift-Enter" - send message"
Lines.Strings = (
"")
ParentShowHint = False
ShowHint = True
TabOrder = 1
WordWrap = False
OnKeyDown = EMsgKeyDown
end
end

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, RxIni;

type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
EHost: TComboBox;
EMsg: TMemo;
function NetSend(Host,Msg: String):boolean;
procedure EHostKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure EMsgKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Minim(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
NetMessageBufferSend: function (ServerName,
MsgName,FromName:PWideChar;
Buf:Pointer;BufLen:DWord):word; stdcall;
SFile: String;
IFile: TRxIniFile;

implementation
{$R *.DFM}
function TForm1.NetSend(Host,Msg: String): Boolean;
var
HLib:HModule;
PWCHost,PWCMsg: PWideChar;
Error:word;
begin
@NetMessageBufferSend:=nil;
HLib:=LoadLibrary("netapi32.dll");
if HLib<>0 then
begin
@NetMessageBufferSend:=GetProcAddress(HLib,"NetMessageBufferSend");
if @NetMessageBufferSend<>nil then
begin
try
Error:=1;
GetMem(PWCHost, 2*Length(Host)+2);
GetMem(PWCMsg, 2*Length(Msg)+2);
StringToWideChar(Host, PWCHost, Length(Host)+2);
StringToWideChar(Msg, PWCMsg, Length(Msg)+2);
Error:=NetMessageBufferSend(nil, PWCHost,nil,PWCMsg,2*Length(Msg));
finally
FreeMem(PWCHost);
FreeMem(PWCMsg);
Result := (Error=0);
end;
end;
FreeLibrary(HLib);
end;
end;

procedure TForm1.EHostKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// Caption := IntTostr(Key);
Case Key of
45: begin
EHOst.Items.Add(EHost.Text);
end;
46: begin
Ehost.Items.Delete(Ehost.ItemIndex);
end;
// 40: EMSG.SetFocus;
end;
end;

procedure TForm1.EMsgKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case Key of
38: EHost.SetFocus;
13:
if ssShift in Shift then
begin
EMsg.Enabled := False;
if Not NetSend(EHost.Text ,EMsg.Text) then ShowMessage("Error");
EMsg.Enabled := True;
end;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
GetDir(0,SFile);
Application.OnMinimize := Minim;
if SFile[Length(SFile)] <> "/" then SFile := SFile + "/";
SFile := SFile + "prog.ini";
IFile := TRxIniFile.Create(SFIle);
IFile.ReadClearList("Hosts", EHost.Items);
BoundsRect := IFile.ReadRect("WinSize", "MainWin", BoundsRect);
IFile.Free;
If EHost.Items.Count > 0 then
EHost.ItemIndex := 0;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin

IFile := TRxIniFile.Create(SFIle);
IFile.WriteList("Hosts", EHost.Items);
Ifile.WriteRect("WinSize", "MainWin", BoundsRect);
IFile.Free;
end;

procedure TForm1.Minim(Sender: TObject);
begin
ShowWindow(Handle, SW_RESTORE);
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
Application.Minimize;
end;

procedure TForm1.FormResize(Sender: TObject);
begin
EMSG.Width := Form1.Width - EMSG.Left - 10;
EMSG.Height := Form1.Height - EMSG.Top - 30;
end;

end.


 
Cobalt   (2001-12-05 09:34) [4]

Так всё-таки, у тебя не получается или ты не знаешь, как сделать?


 
Crafox   (2001-12-05 12:44) [5]

всем спасибо за советы

2Cobalt: скорее и то и другое :)

я не знаю (у меня не получается) отменить действие такой системной клавиши как Win :)



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2002.01.31;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.004 c
3-99884
Shoo
2001-12-21 09:47
2002.01.31
Создание Table


1-99976
Georg
2002-01-14 15:56
2002.01.31
Проблемулька...


3-99835
Андрей К.
2001-12-25 09:38
2002.01.31
FreeReport для Delphi 6


7-100086
Кенгуру
2001-10-14 16:58
2002.01.31
Как из Дельфи отследить нажатия на клавиши MIDI клавиатуры ?


4-100115
vov1
2001-12-04 19:59
2002.01.31
надо отключить ScreenSaver помогите плз...





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский