Well, i was wondering if this is possible .

If it is possible,
can somebody show me how or give me the code ?

Im pretty newbie in coding as my only resource of learning Visualbasic is from the internet :/

And , I would like to disable some key inputs when my application starts.
Means i will put the script given by you guys at MyBase.Load.

Thank you guys in advance . (:

Dani AI

Generated

Useful context and a safer path forward for a LAN-cafe “kiosk” setup.

You’re on the right track wanting customers to run only approved apps, but desktop/taskbar hacks are fragile. , ’s quick-answer approach and ’ suggestion to use Security Policies point to two different strategies: (A) quick GUI hacks that break easily, and (B) OS-level lockdowns that are maintainable and secure. Prefer the latter for a public PC environment.

Why you saw the “unbalanced the stack” error: the code posted earlier used VB6-style Declares (Long) which do not match VB.NET’s expectations. In VB.NET P/Invoke you must use IntPtr and proper DllImport attributes. Example correct signatures and a simple usage snippet (VB.NET):

Imports System.Runtime.InteropServices

Public Class NativeMethods
  <DllImport("user32.dll", SetLastError := True, CharSet := CharSet.Auto)>
  Public Shared Function FindWindowEx(hwndParent As IntPtr, hwndChildAfter As IntPtr, lpszClass As String, lpszWindow As String) As IntPtr
  End Function

  <DllImport("user32.dll", SetLastError := True)>
  Public Shared Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean
  End Function

  Public Const SW_HIDE As Integer = 0
  Public Const SW_SHOW As Integer = 5
End Class

' Example call:
Dim h As IntPtr = NativeMethods.FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", Nothing)
If h <> IntPtr.Zero Then NativeMethods.ShowWindow(h, NativeMethods.SW_HIDE)

Practical recommendations for a reliable kiosk:

  • Use a dedicated, locked-down Windows user account for customers.
  • Enforce allowed executables with AppLocker (or Software Restriction Policies) rather than trying to block keys/processes from your app.
  • For full-shell control, set your program as the user’s shell (Winlogon Shell or Group Policy custom shell) or use Windows’ built-in kiosk/Assigned Access features where available—these are far more robust than killing explorer or hooking keys.
  • Provide an admin escape (secure hotkey, separate admin login, or remote/admin console) and always test changes in a VM. Editing shell/registry values or intercepting system keys can render a machine unusable if done incorrectly.

Notes: desktop icons may not always live under the same window class across Windows versions (WorkerW/SHELLDLL_DefView), so window enumeration may be required. Avoid trying to block Ctrl+Alt+Del — that is handled by the OS and cannot be reliably intercepted from user-mode.

Recommended Answers

All 10 Replies

sounds like your trying to create some kind of very basic virus

Yes, I agree with the user above. I do not think anyone is going to help you out just because you want to create a malicious application to "punk" your friends or create a simple virus that has the potential to mess up a computer.

NOPE . Definitely not . I am going to create a LAN cafe program. so the customers are only allow to open programs from my program. So i must block startbar , task bar and every single file in windows . and they login thru MYSQL . and i have done that part . So i need help.

Why would you want users to only access the programs via your application? Could you not just set permissions on the PC itself? Well I will try to help. Let me get to coding and see what I can come up with.

EDIT:
Referring to the Taskbar, could you not just end the process explorer.exe?

Cause i want that program have admin access. and when i logons with a admin account, i can just click the buttons that are able to unhide desktop, show desktop files and start button.
if not it will be troublesome for me to reactivate the things, right?
I already had the start bar script . and it works. It hided the startbar . and it doesnt seem to work when i press 'windows' key . the menu still comesup even there is not button there . :/

If you end the explorer.exe process, the entire taskbar will disappear. Also referring to the start button you can check here:
http://www.a1vbcode.com/a1vbcode/vbforums/Topic6395-3-1.aspx#bm6412

And now onto the icons, create a module and add this code to it:

'Code from http://www.developerfusion.com/code/4722/showhide-desktop-icons/

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Function DesktopIconsShow()
    Dim hwnd As Long
    hwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
    ShowWindow hwnd, 5
End Function

Function DesktopIconsHide()
    Dim hwnd As Long
    hwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
    ShowWindow hwnd, 0
End Function

Then just call the functions from your application.

I'm sorry to ask . But how could i actually call for a function for this situation ? And where should i put it in?

Ok so the code I gave you had the Function DesktopIconsShow and DesktopIconsHide so to call the function from the module you will add the code below to a button called Show Icons:

DesktopIconsShow()

That is pretty much all there is to it :)

Hey i got an error .

A call to PInvoke function 'GameLauncher!GameLauncher.Module1::FindWindowEx' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

I would suggest to change all your approach, because 'killing' processes that you don't like is always a bad practice (IMO); better never start them.

Every thing you are asking for can be done through Security Policies.
If the PC, where to run your program, is part of a LAN, and there is a server with a Domain Security enabled, those policies can be managed centrally from the server. If not, you'll need to play with the Software Restriction Policies in the Local Security Policy from the Security Configuration Management in the Administrative Tools of your PC.

If you need support on how to manage it, please post a request in the Windows forum.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.