How to make SAS to open with maximized window? - sas

How to make SAS to open with the main window and the editor window automatically maximized?

One way to do this is to push the command AWSMAXIMIZE at startup. You could place this statement in your autoexec.sas
dm "awsmaximize";
I was also able to do this by editing the start menu entry and adding to the end of the SAS command: -initstmt "dm 'awsmaximize';"
More here: http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#a000115355.htm#win-af-wincmds

Not sure if you can do this automatically at startup, but you can set a hotkey to do it.
Tools -> Options -> Keys
Choose a key and type this into the command:
AWSMAXIMIZE ON; WPGM; ZOOM
"AWSMAXIMIZE ON" is the SAS for Windows command to maximize itself.
"WPGM" is the command to bring focus to the Enhanced Program Manager
"ZOOM" is the command to maximize the in-focus window.

Related

How to lock Windows 7 into a single program with C++?

I have been working on an app in Visual Studio 2015 (C++). It's a kiosk app for my school's tech support. Basically, it's a support site that will run in a kiosk. I need to figure out how to lock windows so it only runs that program. It would also be helpful to run the program in fullscreen mode. Keep in mind that all of the kiosks run Windows 7.
Set registry key
HKCU SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Shell="c:\path\to\whatever.exe"
Disallow task manager via security of taskmgr.exe (add a deny read + deny execute to the binary)
Set autologn:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
DefaultUserName = whatever
DefaultPassword = whatever
Have a boot disk handy. The only way to reverse this is to boot the boot disk and undo one of the steps after mounting the appropriate hive.
you can create your program with main window in full screen mode and popup:
hWnd = CreateWindowEx(WS_EX_CLIENTEDGE|WS_EX_APPWINDOW|WS_EX_TOPMOST,
lpClsName,
"MDI Project under Visual C++ WINAPI",
WS_BORDER|WS_POPUP,
...);// add the remaining parameters
and find taskmgr.exe and hide it and start menu button and hide them also:
hTaskBar = ::FindWindow ("Shell_TrayWnd", "");
hStart = ::FindWindowEx(GetDesktopWindow(), NULL, "Button", "Start");
ShowWindow(hTaskBar, SW_HIDE);
ShowWindow(hStart, SW_HIDE);
so your program looks like easycafe or handycafe
I actually switched from C++ to C#, so I'm gonna explain my answer with C#.
I used a keyboard hook library to capture keyboard input and block all non-letter/number input so alt-f4, alt-tab etc. would not work. I then determined a closing sequence of characters using another keyboard hook (LWin+C+Home+F12+PrtSc).
As for Ctrl-Alt-Del, that cannot be disabled (as far as I know) because it is a system function, so I just left that as it is.
I also got the bounds of the screen and set the size of the window to the maximum screen size at application launch, as well as whenever the app is resized or moved. This essentially makes it so the app covers the task bar, and the bar with the close and minimize buttons is also covered, but if someone found a way to move it it would immediately go back to it's full size.
I also set up autologin as was detailed in a previous answer, but I just didn't do it through code.

Application icon is not getting displayed in control panel add/remove programs

I have a c++ application. The app icon shows fine on the start menu, task bar etc., but not in Add / Remove Programs in the control panel. What do I need to do to fix this?
Control panel add/remove program reads all the programs list from registry.
For XP it's HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
you can take backup of your registry, and remove your program name from this registry.

Hotkey to run program in SAS?

I know in R I can use control+r to run my program code. I am wondering if there is an equivalent hotkey in SAS? If not, is there a way to 'program' one into SAS?
The default hot key for run (submit program) is the F8 key.
If you're using Base SAS (not EG), then you can type 'keys' into the box in the upper left hand corner, or by default hit F9, and bring up a window where you can set most of your hotkeys. You can also customize the toolbar buttons at the top of the window by right clicking on the toolbar and selecting 'customize'.
See http://www2.sas.com/proceedings/sugi28/240-28.pdf for more options.

Block .EXE in Windows Firewall with context menu

I got the following bit of code for a .REG file that adds "Add to Firewall" to the context menu on right clicking on a .EXE file. It simply creates an Outbound Rule in the windows firewall for that specific file you had selected instead of doing it manually.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell]
[HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall]
[HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall\command]
#="netsh advfirewall firewall add rule name=\"%1\" dir=out action=block program=\"%1\""
http://oi46.tinypic.com/2rgnxaf.jpg
My problem is that the following syntax name=\"%1\" gives the full directory (C:\New folder\test.exe) as name in the windows firewall instead of just a simple test.exe
Another feature i´m seeking is adding it all to a shift right mouse-click instead of a normal right click, cause i really don't use the feature that often so i wana see it everytime i right click on a .EXE
PS. Run the following to remove it from the context menu again.
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall]
Hope to hear from someone, and in advance a big thanks from here ;)
The following will do exactly what you're asking, but it requires that you have UAC disabled. Without creating a script file or using third party tools, or alternatively overwriting the runas key, I don't think you would be able to create a UAC prompt.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\firewallblock]
#="Add to Firewall" ; String to be displayed in context menu
"HasLUAShield"="" ; Adds UAC shield icon to the left of the command
"Extended"="" ; Requires shift to be held when right-clicking
[HKEY_CLASSES_ROOT\exefile\shell\firewallblock\command]
#="cmd.exe /s /c for %%a in (\"%1\") do netsh advfirewall firewall add rule name=\"%%~na\" dir=out action=block program=\"%%~nxa\""
To elaborate, I use the FOR command not because of its looping functionality but because it gives me access to parameter extensions. I modify %%a (which we'll say has a value of x:\fully\qualified\path\filename.exe) with %%~nxa to use filename.exe and %%~na to use filename.
As for the UAC stuff, I'd just use one of those third party tools I mentioned above and change the command accordingly, e.g.:
#="elevate.exe -c for %%a in (\"%1\") do netsh advfirewall firewall add rule name=\"%%~na\" dir=out action=block program=\"%%~nxa\""
Hope it helps!

CPP:How to pause resume a running script in cmd line console using mouse?

I am in desperate need of help.... :). I am running a script from cmd line console. It does a sequence of operations. whats the best way to pause the script in between to check the results and resume it back using mouse????? or any key
I would appreciate for your reply back,
-Abishek
If I understand your question correctly, and if your program is writing to the standard output (the console window) and you are running on Windows:
You can turn on 'quick edit' in the console window by editing the cmd.exe window properties.
Open a command prompt (start | run | cmd.exe)
Click the upper left corner of the window and choose 'Defaults'.
Click the Options tab and then in Edit Options section make sure the QuickEdit Mode box is checked.
Click OK and you should be set.
If you click with the mouse inside the console window when quick edit is enabled, it will block the program from continuing while it is waiting to be able to write the next message to the output. If you then hit 'esc', the program will continue.
It's a useful shortcut for pausing a running console program that I use all of the time.
try cin.get()
There isn't any easy way to do that. You'd need to create a wrapper to run the program (for example, a debugger is a wrapper to a program), and this wrapper would have to have mouse functions programmed into it.
Without use of the mouse, use cin.get();. It will take an input from the keyboard before continuing.
I'm not sure about using the mouse to pause, but you can pause the execution of command line process by pressing the Pause / Break key or Ctrl + NumLock .
You can then resume the execution with Ctrl + Z