Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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


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);


However I still get 2 errors:

undefined GWlxLoggedOnSAS, I am not sure what else to include/
and error:
CSS
'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.

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...
Posted

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).
 
Share this answer
 
'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;


You also require a definition for GWlxLoggedOnSAS(); check the documentation.
 
Share this answer
 
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);


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...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900