Mapped drives not visible on open dialog - c#

I have a user that has Windows 10 and is saying that their mapped drives are not showing up on one machine specifically and only in my program. I am using a standard Microsoft.Win32.OpenFileDialog to allow the user to browse to a file to open. On this machine they sent me a screen shot where there is one windows explorer window open that shows the mapped drives just fine, then the open dialog in my program that doesn't show them at all (simultaneously). The really strange thing is that other machines on their network do not have the same issue, they show the drives in my program as well.
I'm not sure even where to start with this. I googled it but didn't really turn up anything; I also searched here and didn't find anything. Does anyone know if there is some obscure setting or something that could be causing it not to show mapped drives?

If you are attempting to run the program as an administrator you will not be able to see mapped drives.
Thanks to #jcolebrand who said this:
Are they running it as an administrative user? If so, mapped drives don't run across UAC elevations, and this could be what you're running into. – jcolebrand Sep 25 '15 at 21:15
In a comment above.

Related

Squirrel for Windows - Setup/Install fails on Windows 7

I am building a .net 4.5 (c#) app and packaging it with Squirrel for Windows.
As expected, the releasify command creates one Setup.exe file and one Setup.msi. The Setup.exe installs the app as expected on the two windows 10 computers I had access to.
On the windows 7 I used to build the app though, when I try to open Setup.exe, the window where I double clicked the icone goes in "please wait mode" (with the blue progress circle instead of the usual mouse pointer) forever. If I check the processes open at that point, I see three Setup.exe that I cannot kill with the kill process button or via Taskkill command. And all I can do at that point to kill them is pretty much rebooting.
As to the Setup.msi, it seems to do nothing I can see (tells me something like "checking requirements", and once it has, it just closes with no visible effect).
Any idea about what's going on or how I could find out?
Apparently years later this keeps hitting people so I'm posting the answer I had first put in the comments:
Deactivating my antivirus solved the issue >< I wish Avast had told me "hey I'm blocking this" and saved me a few hours

How do I show network printer in a browse dialog via C#?

basically what I want to do is allow the user of my software to browse the network for a printer shared on another computer or server, the problem is that printers do now show up in the File Selection dialog in c#, is there an alternative that shows printers? if this is not simple to do I may look into a drag and drop feature to get the path to the printer instead.
-Background-
This is for a program that can be scripted to do a lot of things for a computer when first installed at a customers location (such as branding for our company, updating windows, installing certain third party apps, mapping network drives, adding printers, changing some home page etc etc etc), I know i could manually enter in printer names for shared printers rather than browsing but the names are often long useless names that are hard to type.
UPDATE:
After some research and tinkering, I cannot drag and drop onto the form as it requires administrative privileges, there are still other, more convoluted options, such as selecting or entering the network computer name and manually getting shared printers, but allowing them to select them via an explorer would be nice.
Refer the below links...
Is there a .NET way to enumerate all available network printers?
http://www.mindfiresolutions.com/How-to-get-list-of-Local-and-Network-Printers-1495.php

Save As Dialog Box freezes

I have a winform Application and there is a code to open Save as Dialog box.
DialogResult result = saveFileDialog1.ShowDialog();
The program very well runs on Windows XP but on Win 7 the application hangs, the debugger does not return from this line of code. The Event Viewer detail reads as follows
The Program Sample.exe stopped interacting with windows and was closed
Has anyone been through this problem?
Update
It seems that the error was caused due to the code running on another thread which I have nowremoved .Although it is not recommended to access UI elements from another thread I am surprised why I didnt get this error while running on XP ??
Are you setting the InitialDirectory property of the dialog?
If you are, try setting it to another location if you are not you could try setting it.
If this is defaulting to a network path, it could be taking the time opening that path?
This could be result of corrupted file system or hard disk. When save dialog is invoked, it will try to get the list of hard drives , logical drives and folders. If any of it is corrupt, it will hang/throw an exception.
Try running same app in different Windows 7 machine
Did you run System File Chccker (SFC) scan on the windows 7 which would scan for corrupt system files on the computer and replace them.
http://support.microsoft.com/kb/929833

Why does OpenFileDialog freeze WinForms app on a specific machine?

I have a WinForms app deployed to multiple machines in the same office. Up until this Monday, all users in the office used the app without issue and used the OpenFileDialog to select files to import. One machine had lots of updates to other apps and now freezes when our app tries to show the OpenFileDialog. It shows the OpenFolderDialog fine; though I failed to try the SaveFileDialog. Just to repeat, it worked last week, our app was not updated, but it freezes on one machine this week whereas it works on all other machines in the office.
The machine in question has another .NET app installed and I verified the OpenFileDialog opens without issue in the other app.
Any ideas as to why the OpenFileDialog would freeze on one machine? Any ideas on how to fix this? We could try reinstalling without knowing the cause, but I figured it is better to investigate why to prevent it from happening again.
This machine may have connected to a network resource in the past, which is no longer available. OpenFileDialog could be waiting for the network resource to respond, which will take several minutes to timeout.

How to allow users only interactive with my program?

I'm writing a software for a call-center. It's somewhat like a ATM program: user can only interactive with it, not with underlying Windows. It takes controls when user logs in to Windows, and when user exits, it logs off Windows.
How can I do that in .NET? A demo will be much appreciated.
Thank you.
Replace the Windows Shell.
By that I mean Explorer.exe, by means of editing the Windows Registry. What this does for you is instead of logging on and the system running Explorer.exe which consists of the Start Menu, Taskbar and other similar features you are familiar with, it only runs your program. There is no desktop, no context menu, no taskbar, or start menu. Thus, making your application "The Shell" or the new "Explorer.exe".
However, by doing this the user still has access to Control+Alt+Delete, so they would still be able to access the Windows Task Manager, which mind you can also be disabled via a simple Registry Key Entry.
This is the most pain free, easiest solution because you don't even have to worry about things such as disabling the WindowsKey or other annoyances.
The registry key to this is as follows:
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
The name of the value to modify is:
Shell
And you can simply enter the value to be the fully qualified path to your program's executable file. You will only want to do this under HKEY_CURRENT_USER and only for the account that is to run your shell program. So you will need two separate accounts.
Administrator account
This account will just be a normal password protected account that will be used to manage the system
Kiosk account
This account will be the account that is logged on at all times, which runs your custom shell (your application)
Additional Notes
To disable the Task Manager the registry path is as follows:
Software\Microsoft\Windows\CurrentVersion\Policies\System
The name of the value is:
DisableTaskMgr
This is a DWORD value which to enforce the policy must be set to '1'.
What I did was to use DirectX and just use full-screen and exclusive modes, which you can see a small example of here: http://www.directxtutorial.com/tutorial9/b-direct3dbasics/dx9B2.aspx.
This is more work, but it will allow you to do what you want.
Depending on what control you have, there are steps you can do with group policy to limit what people can do on the computer. You can look at how people set up a kiosk application on Windows for some ideas.
What you want to do is run the OS in "kiosk mode".
This entails using the Group Policy Management Console to apply the kiosk mode template - as part of this you register your application as the shell.
As such there is no taskbar, or explorer view to fall back on to. The only way to run the usual shell would be to connect a keyboard to the system - press ctl-alt-delete and run explorer from the taskmanager that pops up.
And you can disable even the standard task manager if users are going to have keyboard access to the console. You will want to implement some kind of launch explorer.exe interface otherwise the system might become a bit difficult to manage :P
You can set your applications window to be always on top and to cover the entire screen. If you exclude buttons that close the window the user must know that ALT+F4 closes the window in order to exit. This has been good enough for me those times I've needed it.

Categories