Error "Out of memory" vb6 - vb6

I have an app that runs well in the IDE, but wont run in the exe form. I have logging, so the app generates the out of memory error at the login form
Login.Show vbModal
Unload Login
In the login load subroutine, this is the code i have there.
m_lsLoginState = Failed
Me.Height = 1815
does anyone have any idea what could be causing th error. The m_isLoginState is an enum variable
Public Enum LoginStates
Failed
Succeed
Quit
End Enum

I finally found the cause and solution to the problem
It happens that am using manifest file added to the project resources so that when the app compiles, it will show the controls in windows theme.
I then notice that the main form frmMain had this initialization, whereas the login form is shown first.
m_Shell32 = LoadLibrary("Shell32.dll")
Call InitCommonControls
what puzzled me is that the compiled executable has been working like this for a while without any problem.
After much tweaking, i got another error system error &H80070583 (-2147023485), when the app executable was launched. This error indicates that it is a manifest problem, leading me to the solution
I solve the problem by moving the code above to the initialization of the login form
Thanks for all you help

Related

Windows Phone crashes in Release

I have made a Windows Phone application with Xamarin and Mvvmcross. When debugging the application it works perfectly. So the application was uploaded to the app store. but when the application got downloaded and run from the store it shut down immidiately after the icon gets clicked. So now i found out that the application does not work when running it on a device in release mode. (on a emulator it works fine).
First i got this exception
Error 1 Error : DEP6810 : MdilXapCompile.exe failed with error code 1004. See log file '~project.WinPhone\obj\Release\MDIL\MDILXapCompileLog.txt' for more details.
in this file there was an error
Compile filter argument specified non-existent file: ~project.WinPhone\obj\Release\MSIL\nl-NL\project.resources.dll
Invalid argument
This error made it unable to deploy the application to the device in release mode. I still have no idea why i got this error and how i am supposed to solve it. But i found a form of workaround by creating a 'nl-NL' map in the MSIL and adding the resource.dll to it. This made it able to deploy the application.
But when deploying the application in this state it crashed immediately. with the native debugger i could get it to break. it gave me this exception
Unhandled exception at 0x775E062F (COMBASE.DLL) in project.WinPhone.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x04F80AB8, 0x00000006).
Clicking on the Disassembly it had it's pointer on this line
77808534 bl SignalStartWerSvc (777FED78h)
It probably has something to do with my localizedresources, where i define some .resx files for filling the app with text. I did find out that this is causing me some problem with WP but i am not sure what i could do against it, i cannot use .resw files as have been suggested.
Has anyone ever had this sort of issue before and does anyone know how to solve it? It is keeping me from placing a working application on the app store, which is really frustrating.
Thank you in advance

Controls not getting identified by vb6

This sounds strange but I just installed vb6 from Microsoft's site and when I run the project, I get errors like "the frmname.log files cannot be loaded". After clicking ok, I see the next errors are compile erros- method or data member not found. The strange thing is that the method that it points to is .Caption
Do I have to reinstall vb6 or I'm missing something else?Please help.
The backend for this project is MS ACCESS.

Final installation folder debugging

When I install my finished product it runs fine until the very last action is done (a button that 'saves' the job).
The program pops this error up:
Unhandled exception has occurred in your application. If you click continue, the app will ignor this error and attempt to continue. If you click quit, the app will close.
Could not find a part of the path 'C:\Program Files (x86)\ATR\Save A Job\obj\Release\42\ATR\BackupProgram\Backup.xml
For some reason, the program is looking for the backup.xml file in the wrong place. (and seemingly added folders)
The way I'm calling the backup.xml file in the program is by:
(System.Environment.SpecialFolder.ProgramFile sX86 & "\ATR\Save A Job\Backup.xml")
Which, could be the wrong way, but it makes sense to me.
I would assume that the full path to the file location would be as follows:
C:\Program Files (x86)\ATR\Save A Job\backup.xml
However, it is looking for it in the wrong place (obvious from the error)
Anyone know why?
Got it fixed guys. It was the permissions to the installation folder. My user was set to "read/write only"...once i switched it to Full Control, everything worked fine

Getting missing component error in a VB6 application

I have a VB6 app that has a ton of 3rd party components. The app works well, but on exit (and only when running as a standalone EXE, e.g. not in the IDE), it pops up an error message:
I've seen errors like these before but typically it says which component is missing dependencies or is not registered properly.
I ran it through Process Monitor and got the following files that it cannot find:
And then it quits. I googled the file names that it cannot find and can't seem to find anything. It seems like its searching for a variation of MSComENU, MSComEN and MSCOENU dlls.
I checked and rechecked to make sure that all the the 3rd party components are there and they are - the application functions fine, it wouldn't if they weren't there.
It is worth noting that error occurs after the last line of VB6 code (in Form_Unload event) has fired. I know this because the last line is a message box that does appear.
Much, much later EDIT: I finally got back to dealing with the problem and figured it out by process of elimination (and it was a loooong process). In the end it had nothing to do with any MSCOMM*.dll entries. In fact, I do not know why they still show up in Process Monitor. The problem was much simpler.
I had several 3rd party controls on the main form. In an effort not to pollute the main form with a ton of event handling code, I delegated these controls to a new class, like so:
' declaration code in main form'
Private WithEvents moDelegateObject as clsDelegateObject
' still in the main form, after initialization'
Set moDelegateObject = new clsDelegateObject
With moDelegateObject
Set .ThirdPartyCtlHandler1 = me.ThirdPartyCtl1
Set .ThirdPartyCtlHandler2 = me.ThirdPartyCtl2
Set .ThirdPartyCtlHandler3 = me.ThirdPartyCtl3
end with
' declarations and properties inside of clsDelegateObject'
Private WithEvents moThirdPartyCtlHandler1 as ThirdPartyCtl
Private WithEvents moThirdPartyCtlHandler2 as ThirdPartyCtl
Private WithEvents moThirdPartyCtlHandler3 as ThirdPartyCtl
Public Event FooEvent() ' other various events as well '
Public Property Set ThirdPartyCtlHandler1(o as ThirdPartyCtl)
moThirdPartyCtlHandler1 = o
End Property
Public Property Get ThirdPartyCtlHandler1() as ThirdPartyCtl
ThirdPartyCtlHandler1 = moThirdPartyCtlHandler1
End Property
' ... Repeat for each handler ...'
What was missing was code to explicitly deallocate these objects prior to closing. This is something that Visual Basic typically does. So I added the following in the Form_QueryClose in the main form:
With moDelegateObject
Set .ThirdPartyCtlHandler1 = Nothing
Set .ThirdPartyCtlHandler2 = Nothing
Set .ThirdPartyCtlHandler3 = Nothing
End with
Set moDelegateObject = Nothing
Last line turned out to be superflous, but I threw it in there for completeness sake. I think it was a combination of delegating controls to a delegate class and receiving events from it in the Main form and using a good number of really obscure 3rd party controls which contributed to this problem. It is probable that the 3rd party control does not cleanly deallocates itself. Anyway, lesson learned.
This could be a DLL_PROCESS_DETACH or CoUninitialize problem. Raymond Chen's blog "The Old New Thing" has a couple of relevant articles:
When DLL_PROCESS_DETACH tells you that the process is exiting, your best bet is just to return without doing anything
Do you know when your destructors run? Part 1.
Quick overview of how processes exit on Windows XP
How you might be loading a DLL during DLL_PROCESS_DETACH without even realizing it
The thread that gets the DLL_PROCESS_DETACH notification is not necessarily the one that got the DLL_PROCESS_ATTACH notification
As you said these are 3rd party components. You could try to make smaller test cases until the problem disappears to pinpoint the buggy component. You could also try a native code debugger and analyze what code created the error message.
The simplest solution however to work around the issue is trying to force a specific load-order of all those components. In the Main() or startup form, try to use some functionality of each 3rd party component in a fixed order. If the bug still appears, change the order until the problem vanishes. That might work.
You could try using dependency walker on the list of references in the project file to see if any of those third party files are missing dependencies. If no dependencies are missing then try registering the files again using regsvr32. If any of the regsvr32 commands fail then you may have found the component with missing dependencies.

VB6 IE frame / WebBrowser causing NT.dll error

We have a legacy VB6 application which has worked just fine on Windows XP Professional SP 3 until just recently when we added an IE frame control so that we could display static local HTML files on a form. And, it works fine until I go to close the application. And, then it reports the following error message (consistently):
Faulting module ntdll.dll, version 5.1.2600.5755, stamp 49901d48
Here's the reference in the Visual Basic project file:
Object={EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0; ieframe.dll
And we use it by performing the following actions:
Development machine is running Win7 + Vb6 IDE.
Add a component reference to the "Microsoft Internet Controls" located at C:\Windows\SysWow64\ieframe.dll
Place a control on the form at design time.
Show that form modally by calling Form.Show vbModal The error happens when I use the default form instance frmMyForm.Show vbModal as well as when I use a local instance Dim MyForm as New frmMyFormMyForm.Show vbModal
Call WebBrowser.Navigate "staticPage.html"
When the user presses a button, the button click event returns the user choice and the form is disposed of.
Exit the application -- Here's where I get the error.
I've been looking all over the web, and haven't been able to find a whole lot of people still trying to use VB6 in this way. So, I'm wondering if someone might be able to help me on stackoverflow. Any help is much appreciated!
[Update] And, the plot thickens. I made a sample application with just that web component in order to make sure that it was causing the error. But, I didn’t experience the error when it closed like I was when exiting our existing/legacy vb6 application. I'll do a bit more investigating.
A follow up to this in case any runs into the same issue (the original poster and I were coworkers at the time)...
The application was using the VBCorLib library, and some of its string manipulation classes utilized direct memory access incorrectly. Read more at this VBCorLib forum post.
It turns out that the issue was that I was trying to delete the temporary file that the browser had loaded. It works now that I've moved that delete file code to the form unload event.

Resources