VB6 Legacy Code can't "Call Shell" - shell

I am working on some legacy VB6 code and I am having my program break with this message:
and it then highlights this code:
I know that the specified locations exist per these screenshots:
I am running this Visual Studio 6.0 on a 64-bit Windows 7 machine. How can I make the program see shell?

command.com does not exist on 64 bit windows.
Try using C:\Windows\SysWOW64\cmd.exe instead. C:\Windows\SysWOW64 is a folder giving you backwards compatibility stuff for 32 bit.
But see the comment below (taken from Euro Micelli).
Really you should use %SYSTEMROOT\System32\cmd.exe instead. First, Windows is not always installed in C:\Windows; you should let the system figure that out. Second, using System32 is always correct for a 32-bit application: when running on Win32, it is the correct folder; when running on Win64, Windows will map %SYSTEMROOT%\System32 to %SYSTEMROOT%\SysWOW64

I use vb6 and windows 7.
I've done the same thing as you but I put the dos command in a bat file.
Login.bat
NET USE W: \\10.48.10.8\e$
Then in the code
Shell ("c:\login.bat")

The vb command is not correct for the OS that you are running. You need to check that that drive is not already mapped, and remove the command.com /c from the command that you are trying to execute.

Related

Compiled Visual Basic Application gets Runtime Error 52 in Windows 8

The application that I compiled via Visual Basic 6 can run on my Windows XP computer. But when I execute the same executable on my other computer that runs Windows 8, I always get Runtime Error 52-Bad File name or number as soon as I launch it. I can't run the program even if there is no "Shell command" in that program which leads to a "Bad file name" error.
I used "Package and Deployment wizard" for the packaging process.
And also I registered the needed DLL's on the Windows 8 PC manually via the regsvr32 command line utility.
I also cleaned the whole registry via a registry cleaner (Wise Registry Cleaner). I used compatibility mode for Windows XP but nothing solved the problem.
Additional informations:
XP Version - SP 2
Windows 8 Version-8.1
VB - VB 6.0
Assuming that your code is
If Dir("C:/file.txt") = "" Then...
Change it to a backslash ("\")
After some research I found the answer for the problem. That was not a problem in the coding; it was ALL about windows 8 compatibility.
Go to the “Compatibility” tab of the properties window of the file and select “Windows XP SP2” under the “Compatibility mode”. That’s all
Windows 8 no longer allows you to write programmatically in the root of drive C:\ (and in many others 'system' folders like Program Files, Windows, System32, ...).
Try to use a sub-folder.

which file can install a program on windows 7?

Which of these files( in setup folder), if execute can install a program on windows 7 ?
1- setup.com
2-setup.ini
3-setup.inf
COM files are executable in Windows. You should be able to run setup.com from the CMD prompt by cding to the directory setup.com is in, and running setup or setup.com.
Keep in mind, COM files cannot be executed on 64-bit versions of Windows, since these editions lack NTVDM, the MS-DOS-emulating subsystem that handles COM file execution. You would instead need to emulate the 32-bit environment using an emulator like DOSBox.
setup.inf can be used to file copy and installation. I cannot remember setup.com installers for Windows programs.
msdn inf description

Why can I not see winlogon.exe using Python on top of Cygwin?

This is the file I'm searching for on a Windows XP computer
C:\Windows\System32\winlogon.exe
I have displayed file extensions for all files, checked Show Hidden Files, checked Show Hidden System Files, and I can see the file using Explorer but cannot see the file with python. I cannot even see the file using:
os.system( 'dir C:/Windows/System32/winlogon.exe' )
I can see the file by using command prompt by running
dir C:\Windows\System32\winlogon.exe
Python's documentation: "On some platforms, this function may return False if permission is not granted to execute os.stat() on the requested file, even if the path physically exists."
I'd like to use the regular python libraries to be able to do this. I also tried open() command. How do I go about finding this file using Python?
Note: I'm running Python27 under Cygwin in Windows XP. This is because I'm in networking and it's easier to write scripts that run off of Linux, ssh into Windows' Cygwin sshd client, in order to run things.
The issue was that I was using 64 bit Windows with 32 bit Cygwin. Apparently 32 bit Cygwin can only see 32 bit files while 64 bit Cygwin can see all the files.
Source: http://cygwin.com/ml/cygwin/2006-01/msg00444.html
This may be true for all 32 bit applications running on a 64 bit environment. Another reason for many 32 bit applications to upgrade to 64 bit if the applications plan to be run on present 64 bit machines.

Launching 32 bit executable from command prompt in Win 7 64 bit OS

I am working on Windows 7 64 bit and have a wierd problem. I installed installAnywhere(a 32 bit application) in c:\Programs(x86) since I did not want to install it in the regular "c:\Program Files(x86)" to avoid the hassles of space in directory.
When I attempted to call the installanywhere from command prompt using the syntax:
cmd /c "c:\Programs(x86)\InstallAnywhereEnterprise\build\build.exe" ...
I get the error "c:\Programs" is not a command. The reason being it is attempting to look to installAnywhere in c:\Programs ignoring the (x86) part.
I did some investigation on launching 32 bit programs vs 64 bit programs from command prompt and tried using %windir%\SysWow64\cmd.exe. When I used "%windir%\SysWow64\cmd.exe",
the %programfiles% correctly points to "c:\Programs Files(x86)" but launching the command I mentioned just gives the same error. The FileSystemRedirector of Windows still
keeps pointing to c:\Programs. I reinstalled InstallAnywhere in the default location "C:\Programs Files(x86)" but I dont know why it does not work with "C:\Programs(x86)".
Does anyone know of a workaround?
Escape the parentheses.
"C:\Programs^(x86)\..."
Why exactly are you not ok with putting it in the regular Program Files directory? Space shouldn't be an issue.

what's your utf-8 console setting when programming Google Go under Windows

We know google's Go default is UTF-8.
I found in my Windows XP. It can not display correct about the UTF-8.
The following code display in wrong.
package main
func main() {
println("中文")
}
I've googled. It said use another font + reg + chcp 65001.
But, I failed.
I've tried cmd and powershell v1 (it is the only provide version under XP).
Both can NOT display well.
Install MSYS
Download mintty and put mintty.exe in c:\MinGW\msys\1.0\bin
Adjust MinGW Shell icon, set target as C:\MinGW\msys\1.0\msys.bat -mintty, then click the icon
Menu->Option->Text->Font, Locale,Character set(UTF-8)
Download go Windows 386
cd /c/go/src ; mkdir ; test your code here.
BTW, setting vim with utf-8
I will try this the next time I'm at a Windows XP machine. I develop mostly on Win 7 and CentOS. One thought, cmd.exe is awfully old on Windows XP. I wonder if it would work better if run from PowerShell. Also, in the last couple days I've switched to using MSys on Windows so that I can take advantage of unified makefiles on Linux and Windows. I'll post an update if I get the command to work on XP or 7.

Resources