Tuesday, May 15, 2018

Easy solution of SendKeys() permission denied error in vb6.0

Easy solution of SendKeys() permission denied error in vb6.0

Sendkeys() basically work for any key press or combination of key press from keyboard. But it present error during running process. SKOTechLearn describe the tips to easy solution of SendKeys() permission denied error in VB6.0.

If you want to perform any shortcut key like: (ctrl+F, ctrl+G, ctrl+N, Enter, TAB etc.) through any VB’s controls then use SendKeys() in VB6.0 application. But, when we are working in Windows edition with Windows7, 8, 10 or Vista. Then we have to face problem of "Access denied".

It is very important to understand for a developer that whenever they write function or statement in coding, which will produce an error message, they have to consider about its solution.
You are always thinking that there were some coding problem, but when checking other site for code, we find that there is no coding problem. So, what is the problem being occurred during process on this code at run time.

SendKeys() code with error output:
There is code we run on VB6.0 application.
Private Sub Text1_GotFocus()

SendKeys ("%{TAB}")

End Sub

Sendkeys() permissdion denied Error output
Error output
In this post, we provide step by step solution of "Access denied" problem in this process.
Follow given bellow steps.

Step 1: Open Control Panel
First, go to “Start” Menu from left bottom of Windows and then find “Control Panel”. From “Control Panel” find “User Accounts”. Other way to find “User Accounts” from “Start” menu search bar and click on it.

Design Login form with MSAccess connection through ADODC in vb6.0

Start >> Control Panel >> User Accounts
Control panel and User Accounts for sendkeys error
Open Control panel and User Accounts
Step 2: Open User Account Settings
After that "User Accounts" screen will show. In this screen, find "Change User Account Control settings" and click on it. After clicking on this option, an another screen will show for setting user account. This screen will help to protect from harmful programs which are making changes to your computer. But, we have to changes for error solution.

Selected record edit or delete from MSHFlexGrid
User Account control settings for sendkeys() error
User Account control settings
Step3: Control Settings
In above given picture, setting some changes in Account Control Settings. This screen has a "Slider", with 2 labels ‘Always notify’ in upper side and ‘Never notify’ in lower side.

Just slide down "Slider" like mention above, then press "OK" button. This is not complete. It is necessary to restart computer. After restarting system, the all system settings will be change.

Now, open Visual Basic application and once again run application. This time it will not showing any error message of "Access denied".
If you create a setup file of application and install or run application to another system. Then you have to apply same setting on another computer. Because every system require control's setting for this key process.

But if there is some other issue like: SendKeys() is not working on given key.

You have to check code. If key code will not written in proper way, it will not showing according output.

Some example you have to put on code:

For particular single key process

Use " (inverted comma)
Use { (curly brase)
eg.: SendKeys("{ENTER}")

For combination of key process

Combination of key cannot complete without Ctrl, Alt, Shift key. but in some case this is not require.
Apply this key as:

Ctrl = ^
Alt = %
Shift = +

Apply given key for (ctrl + v).
eg. SendKeys (“^v”)

Other combination key example:
eg. SendKeys("{HOME}+{END}")
This is the easy solution of SendKeys() “Access Denied” in visual basic 6.0.

Some easy programming tips.

Create folders or Directories and Copy files through CMD

2 comments:

  1. Not working In windows 10 after UAC set to never notify

    ReplyDelete
    Replies
    1. After UAC setting, have you restarted your system. Tell me the error msg.

      Delete