Re: New code for simulating multithreading in VB6...
@Wokawidget: Thanks a lot for this multithreading project...
I will try experimenting with it....
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Simulating multithreading in VB6 - error if using manifest
Although WokaWidget's multithreading code is quite old now, it is ideal for what I am doing (spread a large VB6 number-crunching simulation across multiple processor cores).
Had it all working in the IDE and compiled, but then when I add a manifest file, the mobjgateway DLL immediately crashes with an error on SetWindowsLong
This problem is simple to reproduce with WokaWidgets vbGateway2\Demo\Project1 code. Just add a standard 'XP' manifest (as project1.exe.manifest containing the usual mscomctl assembly for XP look). Start up project1.exe and bingo - you get an error 'Unable to hook window', which is generated by SetWindowLong in sub HookWindow in mobjgateway.vbp
SO... Can anyone tell me what the manifest is screwing up and why? Then point me at how to resolve it???
Re: New code for simulating multithreading in VB6...
Wow. Never seen than before.
I have never really done any work in anger with manifest files and vb6 I am afraid.
But why it should cause an error of that nature is a bit of a mystery.
Can you post a screen shot of the error...and the function, including all the functions lines of code, where this occured.
Re: New code for simulating multithreading in VB6...
While I do love my vbGateway code...it's a little bit outdated now thanks to .NET.
You know you can do in .NET in a few lines of code what this entire project does?
Re: Simulating multithreading in VB6 - doesn't work with manifest file
Woka,
Here are the full details of the problem with vbGateway. I have stripped out all the code down to the bare minimum - even removing the .startlink
The test code
Code:
Option Explicit
Private WithEvents mobjGateway As Gateway
Private Sub Form_Load()
Set mobjGateway = New Gateway
End Sub
Procedure: The attached zip file contains the vbp and also the manifest file. The second zip is the original Woka gateway code with vbGateway2
1. Compile vbGateway2 and register the dll
2. Compile SimpleDemo (after adding the wokawidget gateway reference of course)
3. Now run SimpleDemo.exe and you will see -
This seems to be from vbGateway2 'HookWindow' -
Code:
Public Sub HookWindow(ByRef pobjGateway As Gateway)
Dim lngOldWndProc As Long
lngOldWndProc = SetWindowLong(pobjGateway.hWnd, GWL_WNDPROC, AddressOf WndProc)
If lngOldWndProc > 0 Then
pobjGateway.OldWndProc = lngOldWndProc
If mcolItems Is Nothing Then
Set mcolItems = New Collection
End If
mcolItems.Add ObjPtr(pobjGateway), CreateKey(pobjGateway.hWnd)
Else
Err.Raise vbObjectError, App.EXEName, "Unable to hook window."
End If
End Sub
4. Now rename SimpleDemo.exe.manifest as, say, TTSimpleDemo.exe.manifest. Start SimpleDemo again - it works fine
5. Now put SimpleDemo.exe.manifest back again and edit SimpleDemo.vbp to remove the 'Set mobjGateway = New Gateway' statement. Compile and run again - it works fine as well. (By the way, the reason the 'DoesNothing' button is there is simply to show that the manifest is working and doesn't have an error (i.e. you see the XP-style button).
I have no idea why the manifest is screwing up the gateway - I always thought it simply forces use of the 6.0 version of MSCOMCTL (along with InitCommonControls in the code, which I have also stripped out in this test).
Re: New code for simulating multithreading in VB6...
Hi
Im trying to test this code but when i open vbgateway2.vbp then i get this message in vb6:
Unable to set version compatible component: c:/program files/student works/common/compatible/vbgateway2.dll
Re: New code for simulating multithreading in VB6...
Originally Posted by Breathless
Hi
Im trying to test this code but when i open vbgateway2.vbp then i get this message in vb6:
Unable to set version compatible component: c:/program files/student works/common/compatible/vbgateway2.dll
Try using the version in post 46 if the one in post #1 is causing the problem or vice-verse. If the source code of the dll is included recompile it with the version compatibility set to none. Save the project then recompile using "Binary Compatibility" using the previous dll you just created as the reference.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: New code for simulating multithreading in VB6...
Originally Posted by Nightwalker83
Try using the version in post 46 if the one in post #1 is causing the problem or vice-verse. If the source code of the dll is included recompile it with the version compatibility set to none. Save the project then recompile using "Binary Compatibility" using the previous dll you just created as the reference.
Hi thank you for interesting my problem.
The point is this error Message is appearing when i open source code of this dll. There are no compiled dll in this package. Other test projects in this package are opening but they require this dll. If i compile it althought this error message then using it as a reference i get actixeX error.
I done what you suggested but it dosnt help. There are still the same error. What can i else do?
Re: New code for simulating multithreading in VB6...
Make sure you unselect the dll reference in the main projects (project that uses the dll) then save it and re reference the dll again.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: New code for simulating multithreading in VB6...
Good point thanks now i can open and test project from /demo/ folder. It works great. But i still have problems with demos in /Multithreading/ folder.
DemoUi - there are still errors with activex obkect when i click search.
Set objsearch = CreateObject("searchThread.clsNewSearch")
This is highlighten
ThreadUI - no errors, but nothing happens when i Run this project.
Re: Simulating multithreading in VB6 - doesn't work with manifest file
Well - over three years later your post helped me. I had a manifest file which didn't take effect in the IDE so everything worked. Outside the IDE - crash with the same message you mentioned. I can live without the manifest!