MFC c ++ Web对话框项目,拦截CTRL + ALT + DEL按钮. [英] MFC c++ web dialog project, intercepting CTRL+ALT+DEL buttons.

查看:99
本文介绍了MFC c ++ Web对话框项目,拦截CTRL + ALT + DEL按钮.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web对话框MFC项目,该项目使用FTP,MySql,访问某些网站和其他一些人员.
我已经包含了一些功能,例如某个网站的导航完成和文档完成.
因此,一旦文档完成加载,即在某个网站完成加载后,因此,如果用户按下CTRL + ALT + DEL按钮,则将什么也不做.所以在函数BOOL CMFC_ApplicationDlg :: OnInitDialog()的结尾,我有代码:

Hi, I have a web dialog MFC project which uses FTP, MySql, accessing some websites and some other staff.
I have included several features, like navigate complete and document complete for a certain website.
So once the document completes loading, meaning after a certain website finish loading, so if the user presses CTRL+ALT+DEL buttons it would do nothing. So at the end of the function BOOL CMFC_ApplicationDlg::OnInitDialog(), I have code:

Control.Navigate("http://example.com/", NULL, NULL, NULL, NULL);
return TRUE;  // return TRUE  unless you set the focus to a control



因此,我不确定在哪里放置该代码,在哪个函数中以及在哪个文件中拦截CTRL + ALT + DEL按钮.
这是定义:



So, I am not sure where to place that code, in which function, and in which file to intercept CTRL+ALT+DEL buttons.
And here is the definition:

#include <winwlx.h>
#include <windows.h>
DWORD WINAPI WlxLoggedOnSAS(void *threadparams)
{ struct Wlx
    {
        PVOID pWlxContext;
        DWORD dwSasType;
        PVOID pReserved;
    } *tp = threadparams;
   if (tp->dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL)
  {
    // Add additional code of you own
    ::MessageBox(HWND_DESKTOP,"Unable to LoggOff!","help",MB_OK);
    return WLX_SAS_ACTION_NONE;
  }
else return GWlxLoggedOnSAS( tp->pWlxContext,tp->dwSasType, tp->pReserved );
}</windows.h></winwlx.h>


调用它的方式是:


And the way to call it is :

struct Wlx
{
    PVOID pWlxContext;
    DWORD dwSasType;
    PVOID pReserved;
}threadparams;

CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&WlxLoggedOnSAS, (void*)&threadparams, 0, NULL);



但是我仍然出现2个错误:

未定义的GWlxLoggedOnSAS,我不确定还包括什么/
和错误:



However I still get 2 errors:

undefined GWlxLoggedOnSAS, I am not sure what else to include/
and error:

'initializing' : cannot convert from 'void *' to 'WlxLoggedOnSAS::Wlx *'
1>        Conversion from 'void*' to pointer to non-'void' requires an explicit cast



一行:* tp = threadparams;在结构定义中.

所以我的问题是如何解决这两个错误,以及在完成文档加载后在哪里以及如何调用它,因为oninit对话框必须返回?
在此先感谢...



in a line : *tp = threadparams; within the struct definition.

So my question is how to fix these two errors and where and how do I call it , when document finish loading, since oninit dialog has to return???

Thanks in advance...

推荐答案

好吧,我可以告诉你,你在做什么是没有意义的.可以通知用户按下Ctrl-Alt-Del,但是不能停止WinLogon对其进行处理.

您是否阅读过有关此功能的文档?如果这样做,您将知道您无法在用户代码中实现它.它只能在替换的GINA(仅限Windows XP及以下版本)内部使用.
Well, I can tell you that what you''re doing is pointless. You can be notified of the user pressing Ctrl-Alt-Del, but you cannot stop WinLogon from processing it.

Did you read the docs on this function? If you did, yiou''d know that you cannot implement it in user code. It can only be used inside of a replacement GINA (Windows XP and below only).


初始化":不能从"void *"转换为"WlxLoggedOnSAS ::" Wlx *''
1>从"void *"到非"void"的指针的转换需要显式强制转换

一行:* tp = threadparams;在结构定义中.

您试图将void*分配给WlxLoggedOnSAS::Wlx*.如消息所述,您需要对此进行明确的强制转换:
''initializing'' : cannot convert from ''void *'' to ''WlxLoggedOnSAS::Wlx *''
1> Conversion from ''void*'' to pointer to non-''void'' requires an explicit cast

in a line : *tp = threadparams; within the struct definition.

You are trying to assign a void* to a WlxLoggedOnSAS::Wlx*. As the message states you need an explicit cast for this to be permitted thus:
...
} *tp = (WlxLoggedOnSAS::Wlx*)threadparams;



您还需要为GWlxLoggedOnSAS()定义;检查文档.



You also require a definition for GWlxLoggedOnSAS(); check the documentation.


然后我应该将其保留,然后是"Gina.dll",我也需要Windows VISTA和7.

无论如何,当用户按下CTRL + ALT + DEL时,我得到以下屏幕:

1.锁定此计算机
2.切换用户
3.注销
4.更改密码
5.任务管理器

无论如何,无论UAC是打开还是关闭,我都设法禁用了任务管理器.
只有在UAC关闭的情况下,其他人员才能被禁用,但切换用户除外(我不确定这一点.)

我试图以编程方式禁用UAC,我需要执行以下代码:

Then I should leave it alone then "Gina.dll", I need for Windows VISTA and 7 as well.

Anyway, when user presses CTRL+ALT+DEL I get these screen:

1. Lock this computer
2.Switch User
3.Log-off
4.Change Password
5.Task Manager

Anyway, I managed to disable Task Manager regardless if UAC is on or off.
The other staff can only be disabled if UAC is off except Switch user ( I am not sure about this one.)

I tried to disable UAC programmaccally, I needed to execute the following code:

TCHAR UAC_TURN_OFF[MAX_PATH];
GetSystemDirectory(UAC_TURN_OFF,MAX_PATH);
TCHAR* ADD_UAC_OFF = "\\cmd.exe /k %windir%\\System32\\reg.exe ADD HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v EnableLUA /t REG_DWORD /d 0 /f";
strcat_s(UAC_TURN_OFF,MAX_PATH,ADD_UAC_OFF);
WinExec(UAC_TURN_OFF,SW_HIDE);



这些将触发UAC警告,即将更换计算机,并且需要重新启动.我不确定该如何隐藏需要重新启动PC的警告? (在行动中心中).

任何建议将不胜感激.

预先感谢...



These would trigger the UAC warning, that the computer is about to be changed, and it requires a reboot. I am not sure how to hide this warning that the PC is need to be restarted? (in the action center).

Any suggestions would appreciate.

Thanks in advance...


这篇关于MFC c ++ Web对话框项目,拦截CTRL + ALT + DEL按钮.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆