Basically, I am using a simple WebBrowser.Navigate command to access an IP camera across our LAN. After authenticating myself, I am brought to the video screen. After the video lasts some seconds, VB will hang and I am forced to restart my computer. On a regular IE browser, it does not hang. Just on the Web Browser Control

There are special settings, though, that are enforced on IE. I need to change the security settings to these:
Enable: Download unsigned ActiveX controls
Enable: Initialize and script ActiveX controls not marked as safe
Enable: Run ActiveX controls and plu-ins

I was wondering if I needed to configure anything else on VB for the video feed to work. Thanks.

P.S. I also tried the Mozilla Control and it results in the same thing.

Recommended Answers

All 27 Replies

Additional:

Code works fine on my desktop. It is only on my laptop that it hangs. What do you think is the problem? Both used the same Visual Studio installer and this laptop even has Microsoft .NET Framework 4.

It seems that the processing speed differs on both desktops, hence the hanging first and then the unresponsive application.

Is there any other code running while you connect or interact with the video feed?

Nope. Simply calling the feed results in a hang without any other codes. Does processing speed really have an effect?

The laptop has an i7 processor with 6GB of RAM (hangs)
The desktop has a Dual Core processor with 2GB of RAM (fine)

Thanks for the help.

Nope, then something else is wrong...

Please post the code that you are using in your browser to get the feed, read the feed and then when done, finish off.

This seems like the file is read from a network and not the internet. It now starts boiling down to network transfer speeds etc, expensive stuff if you want to upgrade.

What bothers me still is the fact that you said it does not hang on your desktop pc but only on the laptop. How many processes is running etc.

I think we are going to have to move this post to Hardware Software/ Windows. I'm sure one of the network guys will have a more definite solution.:)

Try running this outside the VB6 environment by isolating the web function with a call to the ShellExecute function.
If the problem persists, the problem should stem from the VB6 environment.
Make sure you have service pack 6 installed.

Option Explicit
' Windows Function ShellExecute
' Windows C Language Function, references the shell32 dynamic link library
'
' "HINSTANCE ShellExecute(
'    HWND hwnd,
'    LPCTSTR lpOperation,
'    LPCTSTR lpFile,
'    LPCTSTR lpParameters,
'    LPCTSTR lpDirectory,
'    INT nShowCmd
' );
' Opens or prints a specified file.
' Returns a value greater than 32 if successful, or an error value
' that is less than or equal to 32 otherwise. The following table
' lists the error values. The return value is cast as an HINSTANCE
' for backward compatibility with 16-bit Windows applications." (Visual Studio 6: MSDN)

' -----------------------------------------------------
' Windows Platform Software Development Kit (PSDK) Functions
Private Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" (ByVal hWnd As Long, _
    ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
    ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

' ------------------------------------------------------
' Windows PSDK Constants
Private Const SW_MAXIMIZE = 3
Private Const SW_NORMAL = 1
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMAXIMIZED = 3
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const SE_ERR_NOASSOC = 31
Private Const SE_ERR_ACCESSDENIED = 5


Private Sub Form_Load()
    On Error GoTo LOAD_ERR
    Dim lngReturn As Long
    lngReturn = ShellExecute(Me.hWnd, "open", "iexplore.exe", "http://www.mozilla.org", "", SW_SHOWNORMAL)
    If lngReturn <= 32 Then
        Err.Raise vbObjectError + 512 + lngReturn
    End If
    Exit Sub
LOAD_ERR:
    Select Case Err.Number
    Case vbObjectError + 512 + SE_ERR_ACCESSDENIED
        MsgBox "Access Denied", vbInformation, "Error"
    Case vbObjectError + 512 + SE_ERR_NOASSOC
        MsgBox "No Application associated with file name extension", vbInformation, "Error"
    Case vbObjectError + 512 + ERROR_FILE_NOT_FOUND
        MsgBox "Could not find URL", vbInformation, "Error"
    Case vbObjectError + 512 + ERROR_PATH_NOT_FOUND
        MsgBox "Invalid Path", vbInformation, "Error"
    Case Else
        Debug.Print Err.Number
    End Select
End Sub

P.S.
1) You have my permission to comment on this thread.
2) My main goal is to help, not to seek Dani Points.
3) I am happy, if you are helped.
4) Feel free to send private messages.
5) More thank likely, I will respond.

Thanks for the help Andre.

Hi hkdani,
I tried your code and it works fine. It is just in the WebBrowser control that it hangs my laptop. I don't think I can give anymore information apart from what I already mentioned. Same Visual Studio installers used so I have no clue what's the problem. It only hangs when the video feed is shown and not on any other occasions.

Can you open both pc's task manager and give me the total processes running on each?

At the moment, I only have access to the laptop. 75 processes running and I forgot to mention that this Windows 7 is 64bit Home Premium and for the desktop, it is 32bit Ultimate.

What RAM? 64 bit is more than ample.:)

What processor?

Laptop:
Windows 7 Home Premium 64 Bit
6MB RAM
Intel Core i7-720QM

Desktop:
Windows 7 Ultimate 32 Bit
2GB RAM
Intel Dual Core

I really think it is an OS problem. The laptop still has the free OS when I purchased it. The desktop has been reformatted to Ultimate from its original XP. Possibility? I'd rather not reformat though if someone has an idea what went wrong. :)

If you are on a wired network, transfer speeds probably are at least 3 megabytes a second, probably faster with the newer 1 GB network cards. I seriously doubt CPU or hardware capability is your problem.

You might check your network wire. It might not be solid core wire. Maybe some of those cheap pre-built wires from Radio Shack, Best Buy, etc.

If your network is using a domain name type server instead of a workgroup type set up, then windows home premium does not support domain name servers. That is a professional business feature for which Microsoft charges extra. It just will not work.

Can't be an OS problem if the ShellExecute function works properly called from your vb6 program.

The problem is in vb6. Do you have service pack 6 installed? And you can also check to see if you have the latest merge modules installed.

Sometimes VB6 has threading problems. It loses threads. In the middle of a function it will just quit and skip 15 lines of code. Certain controls and processes are notorious for doing this: e.g. Jet database calls, third party ActiveX controls, and even Microsofts' own controls.

Microsoft was pulling their hair out trying to make the internet work with visual studio 6 when it came into full bloom. Why do you think we have .NET?

The key is to get the internet to work on its own thread. If your vb6 app and the control are sharing the same thread, you'll probably have problems. Use ShellExecute or figure out a way to make your own vb6 apartment threaded dll or ocx that you can call that will run in its own thread and memory space.

I don't think it is a network problem as both computers are attached to the same switch and the ip camera as well. Also just using simple workgroup.

I do not know if my VB6 has SP6 already. I tried checking the About page but it does not show anything. In any case, I downloaded the file here and installed it. I still don't see any difference with the About page though. These are the details I see:

Microsoft Visual Basic 6.0 For 32-bit Windows Development
Version 8176
VBA: Retail 6.0.8169
Forms3: 12.0.6415.100

The For 32-bit Windows Development part troubles me. Is there really no problem that my laptop is 64bit?

If your vb6 app and the control are sharing the same thread, you'll probably have problems. Use ShellExecute or figure out a way to make your own vb6 apartment threaded dll or ocx that you can call that will run in its own thread and memory space.

I know the theory on OS threading but I don't really know how to use ShellExecute to troubleshoot my problems or how to make a threaded dll, ocx. Sorry.

64 bit will not be a problem, unless you use 32 bit code say for instance kernel32, which should be kernel64.

Have you tried and open the video feed with IE explorer or Chrome. on both pc's? If it hangs/lag, it is a pc problem. If not, VB6 will be the culprit.

Your version(8176) is correct for VB6 sp6, so thats sorted.

Ok. You can download the service pack here:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7b9ba261-7a9c-43e7-9117-f673077ffb3c&displaylang=en

Sounds like you just extracted the files without installing the service pack. Back then Microsoft did not do everything for you like they do today.

It will ask you to specify a location on you hard drive to extract files: I use "c:\sp6" or something that I can find.

You'll have to find that folder: it's full of cab files, dlls, which will probably help improve the stability of your program.

In particular, there is a mswinsck.cab file and a msinet.cab file that probably contain updates that will help out your situation.

But after finding and running the setupsp6.exe file in this folder, your Visual Basic About form should say something like the following:

Microsoft Visual Basic 6.0 (SP6)
For 32-bit Windows Development

Copyright @ 1987-2000 Microsoft Corp.
.............
.............
Version 9782 VBA: Retail 6.0.9782

Notice the version number and the Visual Basic for Applications version number:

Also the initial splash screen when you start up VB6 now shows a nice big 'SP6' in bold black letters to the right and under the Visual Basic 6.0 title of the splash screen.

If any of what I have just written doesn't look familiar, you probably do not have service pack 6 installed. My version number is 9782 after installing SP6. Your about box should have the "(SP6)" now after Visual Basic 6.0
, i.e. Visual Basic 6.0 (SP6).

As far as your not knowing how to run ShellExecute, you already said that you had tried the code:

Hi hkdani,
I tried your code and it works fine.

But you really don't have to go through all that mess. You can skip about 45 lines of code by just doing the following straight from VB6: Shell "C:\Program Files\Internet Explorer\iexplore.exe http://administrator:1234@192.168.0.15" It's not as flexible as the 45 lines of code, but it gets the job done. Notice that you have to type in the exact name of the path for the program you wish to run. In your case, type in the exact path to your executable file for internet explorer or Firefox.

By default, the Shell function runs other programs asynchronously. (MSDN)

Basically, that means that your program will not wait for the shell statement to finish, it will just continue on to the next line of code in vb6 and let the shell function do its own thing. In one simple line of code you have just started another thread apart from your vb6 application.
You are now a vb6 wizard.

The VB6 Shell function is not as flexible as the 45 lines of code, but it does the job.

Oh, by the way. I doubt that your laptop running Windows 7 Home Premium has only 6MB RAM. 6GB?

Hi again,

I downloaded the file from there if you check my URL earlier. :)
I got VB6.0-KB290887-X86 and it asked me to choose a directory for extraction. After extracting, I got a single file which is vbrun60sp6.exe.

I run it and it extracts dll(s) to my system32 folder. I'm not sure because it is very fast and I was only able to point out the folder after printing the screen after clicking the .exe file. It unpacked comcat.dll to my system32. I don't know what else it did. I don't see those cab files you mentioned though. My about page and version details remain the same.

Also, sorry about that typo. Yeah, I have 6GB of RAM on this laptop.


@Andre,

Yeah, It works perfectly and is really supposed to be used on browsers specifically IE,Firefox and Chrome(in the menu screen of the IP cam). I found it works on Opera too.

You already had sp6 as per the previous posts. Reinstalling though will not cause any harm.

If you say it runs fine in all the other browsers, except in vb6, the problem lies within the action of loading and streaming the video feed. What I suggest you do is to first get the buffer rate, download some of the file and THEN start streaming it. What player are you using for the video feed. flash?

Another way is to use first download the file to your browser using a download accelerator and then start streaming. I personally use VLC within my application, it boosts the download, has all the codecs and is very simple to use in a browser.

So, it seems that the interaction with vb6 and your browser download speed is the culprit.;)

You already had sp6 as per the previous posts. Reinstalling though will not cause any harm.

If you say it runs fine in all the other browsers, except in vb6, the problem lies within the action of loading and streaming the video feed. What I suggest you do is to first get the buffer rate, download some of the file and THEN start streaming it. What player are you using for the video feed. flash?

Another way is to use first download the file to your browser using a download accelerator and then start streaming. I personally use VLC within my application, it boosts the download, has all the codecs and is very simple to use in a browser.

So, it seems that the interaction with vb6 and your browser download speed is the culprit.;)

The video is in .cgi form so I don't think it uses any application. How do I get the buffer rate? I also don't know how to download from the browser. I've never tried streaming the video on any media player because the ip cam interface is browser based.

About the service pack, I wonder why hkdani's sp6 is version 9782 and mine is 8176? Are you positive I already have sp6? I don't see any sign on the VB splash screen. :(

Thanks again,

I run it and it extracts dll(s) to my system32 folder. I'm not sure because it is very fast and I was only able to point out the folder after printing the screen after clicking the .exe file. It unpacked comcat.dll to my system32. I don't know what else it did. I don't see those cab files you mentioned though. My about page and version details remain the same.

That's odd. Maybe you're not using a US English Version of VB6? Your English appears to be very good. I would guess that you're using an English Version of VB6? Could you verify that? If not, it may be that the application only appears to be updating.

I would right click on the file and set its properties to XP SP2 mode first. And then I would right click on the setupsp6 file that you found and run it as Administrator. AndreRet has an excellent post on things you should do when installing vb6 apps on Vista or Windows 7 you should check out. Those files I mentioned should show up I would say. Maybe you have the hidden file options set and can't see them?

I've installed SP6 on Windows 2000, Windows XP64, Window XP, etc. and every time I install it I see the SP6 show up in the splash screen and the About Box. I've never failed to see that message. It may be that the bug you're seeing has already been fixed. But the service packs are not being applied?

Which version of VB6 are you using? Professional, Enterprise? Those are the only 2 versions I have experience with. Maybe my information does not coincide with your version of VB6?

From what I've checked on MSDN's site, 8176 is the SP6 version. Maybe Microsoft likes me and gave me a special updated version? I do have the complete Visual Studio package and not just the stand alone Visual Basic version.

http:
//
visualstudiomagazine.com/articles/2007/10/01/get-critical-vb6-updates.aspx

Apparently, there is an update to service pack 6. I think I remember downloading it awhile back.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=CB824E35-0403-45C4-9E41-459F0EB89E36

Sorry, for the change in results in this one post. Didn't realize or remember there were such recent updates. That last link comes from 2009.

Hi, sorry for the delay in reply. :)

That's odd. Maybe you're not using a US English Version of VB6? Your English appears to be very good. I would guess that you're using an English Version of VB6? Could you verify that? If not, it may be that the application only appears to be updating.

I'm using an English version.

I would right click on the file and set its properties to XP SP2 mode first. And then I would right click on the setupsp6 file that you found and run it as Administrator. AndreRet has an excellent post on things you should do when installing vb6 apps on Vista or Windows 7 you should check out. Those files I mentioned should show up I would say. Maybe you have the hidden file options set and can't see them?

I saw his post here. I'll try running VB in Virtual XP later on. Running the setup in compatibility mode and as an administrator doesn't change anything. :(

I've installed SP6 on Windows 2000, Windows XP64, Window XP, etc. and every time I install it I see the SP6 show up in the splash screen and the About Box. I've never failed to see that message. It may be that the bug you're seeing has already been fixed. But the service packs are not being applied?

The bug is still there. :(

Which version of VB6 are you using? Professional, Enterprise? Those are the only 2 versions I have experience with. Maybe my information does not coincide with your version of VB6?

I use Visual Studio Enterprise Edition.

From what I've checked on MSDN's site, 8176 is the SP6 version. Maybe Microsoft likes me and gave me a special updated version? I do have the complete Visual Studio package and not just the stand alone Visual Basic version.

http:
//
visualstudiomagazine.com/articles/2007/10/01/get-critical-vb6-updates.aspx

Apparently, there is an update to service pack 6. I think I remember downloading it awhile back.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=CB824E35-0403-45C4-9E41-459F0EB89E36

Sorry, for the change in results in this one post. Didn't realize or remember there were such recent updates. That last link comes from 2009.

The update installed successfully but I still don't see any change in the splash screen or about page version number.

Thanks.

Well, I would set a break point at the start of the function that opens the URL and use your <F8> function key to step through it until crashes. At this point, you need to develop some debugging skills to find your problem.

But I would guess it crashes somewhere at this point: webbrowser1.navigate "..... " That might not tell you much, but it should give you a good starting point.

Try Dependency Walker. Install it. Read through the manual and get an idea of how it works and then load the program from Dependency Walker. It should show you exactly which control, dll, etc. is the source of the problem.

http://www.dependencywalker.com

Dependency Walker is also very useful for troubleshooting system errors related to loading and executing modules.

Have a look at This link regarding buffering, cleaning up your temp files as well as your registry to accelerate the transfer rate of video streams in a browser. It is as I thought, your system resources is some or other way overloaded, slowing down the buffer speed. I'm sure you will get your answer if you follow every step.:)

Hi all. Sorry for my long disappearance. Had to finalize our thesis and stuff.

@hkdani, I will try it in a while. Thanks. Its always good to debug.

@Andre, I've tried them and they still don't work. I was very skeptical about the fact that it was the video since it works fine in any other browser. Its just in the browser control that it hangs. :(

I have lost track of this thread, will have a GOOD look again tomorrow.:)

@hkdani, I will try it in a while. Thanks. Its always good to debug.

There is an option in the compile stage of the executable where you can make a debug build of your program. Turn off all the optimizations and check the option to make a debug build.

You can debug the executable file in Visual C++ of Visual Studio. It might be easier to use than Dependency Walker.

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.