I'm not really sure why VB6 is crashing. I have a form with a checkbox and if it's checked, then I msgbox a value. The only thing I have in that Subroutine is the msgbox.
I'm running this on Windows 10. I've already set the compatibility mode to Windows XP but that doesn't change the behavior that's happening.
How do I fix this? I'm not even sure what the issue is.
Private Sub ChkNonSerialize_Click()
MsgBox "Test"
End Sub
Related
I am trying to install a VB6 application in Windows 10 computers, but when I load a child form and then unload it, the program crashes. If I start the application as Administrator from the shortcut, I can load and unload everything without issues. Have you experienced this before?
So far I've tried the following:
Started the .exe directly as Administrator. Not working.
Checked the Run As Administrator checkbox in the contextual menu (Properties / Compatibility) of the .exe. No good.
Created a .reg file to affect the HLKM\ ... \AppCompatFlags\Layers keys. Nada.
Tried affecting both the HKLM AND HKCU keys. Thank you, next.
Checked if some Recordset or variable was filled or active. Everything empty.
Tried Unload [name of the form] instead of Unload Me for one of the forms. Same result.
Part of the Unload code for one of the forms is as follows:
Private Sub cmdSalir_Click()
On Error GoTo ErrHandler
Dim frm As Form 'Identifica las formas a cerrar
For Each frm In Forms
If Not frm Is frmPoliza And Not frm Is MDIPrincipal Then
If Not frm Is frmAsegNoReclam And Not frm Is frmEndosoMedico Then _
Unload frm
End If
Next frm
gsPlan = ""
gmstrInstPagoInd = ""
gmstrCondEnv = ""
If IsFormLoaded("frmCotiza") = False Then
'gbInicio = True
End If
Unload Me
ErrHandler: 'APM 2019-01-31: Captura el error que se provoca al descargar la forma
If Err.Number <> 0 Then
MsgBox "Ocurrió un error al cerrar: " & Err.Number & " - " & Err.Description, vbOKOnly
End If
End Sub
It is important to say that WinXP's installations are working correctly, but in 2 Win10's computers the error was replicated, so I'm guessing either Win10's security policies or the way the installation package is made has something to do with this.
If you can help me with this issue, I will appreciate it greatly.
Thank you,
Tony.
If the issue is that you need to run with elevated rights, then I suggest you declare that in you application manifest such that the user is prompted grant that. You can either create a separate manifest file or embed it. See here for details:
How do I create a manifest file in Visual Basic 6.0?
So I told the client about this issue, and decided to have the program virtualized in XP better than adapted to x64. Not the closing I wanted, but a closing after all.
Thank you all for your efforts.
Not sure if this will fix the specific problem but have found that running the application in Windows 8 Compatibility Mode on Windows 10 helps with issues like this. Worth a try.
Bizarre problem.
I am using Excel VBA to control IE and download data from web sites. Pretty vanilla.
I experience an error that only happens when I am running Windows 8.1 and IE 10. On a second PC, which is running Windows 7 and IE 8, the code works fine.
Here is the behavior.
I call the following code to open a web page:
Set appIE = CreateObject("InternetExplorer.Application")
With appIE
.navigate sURL 'Where sURL is a valid web address
End With
This works fine, and opens a browser.
Shortly afterwards, I call the following:
With appIE
.navigate sURL'a different valid web address
End With
An error message pops up at the .navigate line. The message says:
Run-time Error '-2147024726(800700aa)'
Method 'Navigate' of object 'IEWebBrowser2' Failed
I have looked up this error message and the only thing that I can find is that it may relate to spyware. But I completely reinstalled the OS and all apps on the system and the same thing happened.
Another very strange phenomenon is that if I put a trace point in-between the above two sections and pause the code, then manually start the code again, everything works fine. But if, instead of me putting in a trace point I put in a wait loop, I get the same failure. That is, if I manually pause and then resume the code, the code works, but if I automate a pause and resume, the code does not work.
As you consider this situation, please remember that everything works fine under Windows 7 and IE 8, and everything works fine if I manually pause and restart.
Does any of this make sense?
1- Please Check sURL (if you check, please check again compiled folder)
2- Delete WebBrowser Control and Add New
Me forget copy original file App.Path + "\error.html" and see this problem.
I know I've had this before but I can't remember how to get around it.
I built a managed code add-in that works fine apart from one thing. When I try to close the Access application the application window still persists unless I end task it. When I'm debugging the add-in using Visual Studio 2010 it closes fine when I stop debugging.
I am setting all variables to nothing as part of the on disconnect event.
Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
'On Error Resume Next
If Not MenuCommandControls Is Nothing Then MenuCommandControls.Delete()
If Not MenuCommandDimensionVariable Is Nothing Then MenuCommandDimensionVariable.Delete()
If Not MenuCommandFields Is Nothing Then MenuCommandFields.Delete()
If Not MenuCommandForms Is Nothing Then MenuCommandForms.Delete()
If Not MenuCommandParseSQL Is Nothing Then MenuCommandParseSQL.Delete()
If Not MenuCommandQueries Is Nothing Then MenuCommandQueries.Delete()
If Not MenuCommandReports Is Nothing Then MenuCommandReports.Delete()
If Not MenuCommandTables Is Nothing Then MenuCommandTables.Delete()
If Not MenuCommandVariables Is Nothing Then MenuCommandVariables.Delete()
If Not searchForm Is Nothing Then searchForm.Close() : searchForm = Nothing
If Not ObjectSetting Is Nothing Then ObjectSetting = Nothing
If Not AccessInst Is Nothing Then AccessInst = Nothing
If Not addInInstance Is Nothing Then addInInstance = Nothing
'If Not FormParseSQL Is Nothing Then FormParseSQL = Nothing
applicationObject.Quit(Access.AcQuitOption.acQuitPrompt)
If Not applicationObject Is Nothing Then applicationObject = Nothing
End Sub
add x as optional integer to the subroutine
Create a Quit app button and
setting x=1
call your subroutine, and pass the Optional x value to it.
putting the application.quit commmand
at bottom of subroutine, if x=1 then application.quit.
call ONdisconnect subroutine thru the quit app button.
disable all other ways to exit your application.
easy, simple and functional.
this way the Ondisconnect will work when a disconnect occurs or your closing the application.
I am using ruby a WIN32OLE to automate execution of Excel macros with windows scheduler.
I have all of this working properly. My problem comes with having to run a macro embedded in an excel file of an external party (ie I don't have control of the macro). I can call the macro with no problem, however the code contains user prompts (in the form of Msgbox statements)
In short how do I tell the msgbox "yes" or "ok" via WIN32OLE?
What I have tried
Event handling: The Msgbox does not throw a worksheet event. I would have to think that windows throws an event somewhere for the Msgbox (but I am not skilled enough to capture it with WIN32OLE)
-Threading and Sendkeys: I was also unable to get the msgbox to respond to sendkeys. More problematic was that I was unable to get the threading to work with the WIN32OLE object (it worked fine when I was using puts and sleeps to simulate the macro running.)
It appears I am stuck with copying the code into another workbook and removing the msgbox statments, I don't really want to do that because then it will add maintenance work everytime the business logic of the 3rd party code changes.
Here's one way,
install Autoit
and then do:
au3 = WIN32OLE.new("AutoItX3.Control")
au3.ControlClick("MessageBox Title",'', 'OK')
I'm having an issue referencing public procedures of User Controls that I've created within a VB6 project.
A simple example (exe), I have a form with a button and a user control:
Option Explicit
Private Sub Command1_Click()
UserControl1.updateMessage ("TIME NOW: " & DateTime.Time)
End Sub
The User Control code is as follows:
Option Explicit
Public Sub updateMessage(ByVal newMessage As String)
Label1.Caption = newMessage
End Sub
This exe compiles and works fine, and when I'm typing updateMessage in the Form, it appears in the intellisense list with the appropriate requirements. The issue I have is when I'm wanting to "go to the definition" of updateMessage, instead of going to the appropriate section of the code within the User Control, the message always returns with:
"Cannot jump to 'updateMessage' because it is in the library 'Unknown1' which is not currently referenced."
where the numbered suffix of "Unkown1" changes from time to time.
It seems that if there were no reference to this procedure, then it would not appear in the intellisense and the project shouldn't compile. When running this with MZTools (though the error appears regardless of this plug-in being installed), I can go into the updateMessage procedure, and use it to find all procedures calling this function, so the link between the two should exist (although I'm not sure if MZTools just finds using a text-matching pattern).
If anyone out there could shed some light on this matter, it would be very much appreciated, and save this poor VB6 developer a lot of hassle!
I have SP6 installed (build 9782) of VB6 and am running XP SP3 on an HP dx2400.
Yes, this is extremely annoying and I'm convinced it's a bug in VB6. I say this because, if you locate the updateMessage method in the object browser and double-click on it, you are taken to the definition. So, the compiler actually does know where the definition is, it just refuses to take you there with Shift+F2.