ok Si_the_geek I will try it without so many controls. The problem is I need it as it is because this app is used to control remote pc's and we want to offer functionality (start session, stop,...) for 250 pc's.
Is there an apparent reason why it should be ok with win 2k/xp byt not win 9x. How can identify why it is working on win 2k and not the others?.
I still have the same problem eventhough I reduced the arrays down to 50 instances.
What I have is the following:
* A sub main:
Option Explicit
Private Sub Main()
SplashScreen.Show ' Show the splash screen.
Call SurfForm.LoadData 'load form and its data
Unload SplashScreen
SurfForm.Show ' Show the main form and unload the splash screen.
End Sub
*Declarations in the SurfForm code:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer
Private Declare Function GetDesktopWindow Lib "User32" () As Long
Private Declare Function GetWindow Lib "User32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetParent Lib "User32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowTextLength Lib "User32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetCapture Lib "User32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "User32" () As Long
Private Declare Function GetCapture Lib "User32" () As Long
Private frmDet As ConfirmDialog
Private frmDet1 As ConfirmWithCanteenDialog
Private fFrmDetCol As New Collection
Private fFrmDetCol1 As New Collection
Dim licenceProbl As Boolean
Dim PCNbr As String
Dim reportErr As Boolean
Dim intMax As Long
Dim thatPath As String, thatPath1 As String, thatPath2 As String
Dim bAcked As Boolean ' send acknowledged
Dim FileN As Long
Dim UniqueID As Integer
Dim lclHost As String
Dim SerialNumber As Long
Dim msg As String, Title As String, Style As String
Dim blnState As Boolean
Dim scndState As Boolean
Dim fisrtCh1 As String
Dim fisrtCh2 As String
Dim fisrtCh3 As String
Private stopWatch() As New CStopWatch
Dim isClosed As Boolean
Dim homeP As String
Dim tempstr As String
Dim costsStr() As String
Dim pauseStat() As Boolean
Dim firstSecnd() As Boolean
Dim menuOrder() As Boolean
Dim haveStop() As Boolean
Dim costMode As String
Dim CLocale As CLocale1 'new object to get locale settings
Dim strSql As String
Dim dateSlsh1 As String
Dim myDbCon As New ADODB.Connection
Dim myDb As Database
Dim ConnectDB$
Dim MenuTable As DAO.Recordset
Dim OrdersTable As DAO.Recordset
Dim EventsTable As DAO.Recordset
Dim SessionsTable As DAO.Recordset
Dim ccyStr As String
Public ActivePrinter As EventVB.ApiPrinter
Public WithEvents apiLink As EventVB.APIFunctions
* And some functions I call in Load_Data:
Public Function LoadData()
Dim h As Integer
On Error GoTo ErrTrap
'Set apiLink = New EventVB.APIFunctions
reportErr = False
PCNbr = "0"
Call checkIsrunning 'checking the app is not already running
Call checkPSWD
Call CheckLcce
Call CheckCurr
Call CheckPC
ErrTrap:
If Err.Number <> 0 Then
Call SurfForm.insertIntoEvents(CStr(Format(Now, "mm/dd/yyyy hh:mm:ss")), CStr(0), Err.Description, Err.Number, "Svr-Srffm2")
End If
End Function
...and this is really bugging me. I use some dll I found on the net called EventVB.dll. Maybe this is the problem ???
I have done the reverse method, by adding the controls to the blank form and yes it will only allow me to put in 40 instances of the 12 control arrays before crashing. This is against 250 under W2k/XP. I wonder what makes it impossible for Win95/98/Me to take more.
Does anyone know as there might be a work around somehow?!?
Declare Function SetThreadPriority Lib "kernel32" Alias "SetThreadPriority" (ByVal hThread As Long, ByVal nPriority As Long) As Long
its parameters are
· hThread
Identifies the thread whose priority value is to be set.
Windows NT: The handle must have the THREAD_SET_INFORMATION access right associated with it. For more information, see Thread Objects.
· nPriority
Specifies the priority value for the thread. This parameter can be one of the following values:
THREAD_PRIORITY_ABOVE_NORMAL
Indicates 1 point above normal priority for the priority class.
THREAD_PRIORITY_BELOW_NORMAL
Indicates 1 point below normal priority for the priority class.
THREAD_PRIORITY_HIGHEST
Indicates 2 points above normal priority for the priority class.
THREAD_PRIORITY_IDLE
Indicates a base priority level of 1 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 16 for REALTIME_PRIORITY_CLASS processes.
THREAD_PRIORITY_LOWEST
Indicates 2 points below normal priority for the priority class.
THREAD_PRIORITY_NORMAL
Indicates normal priority for the priority class.
THREAD_PRIORITY_TIME_CRITICAL
Indicates a base priority level of 15 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 31 for REALTIME_PRIORITY_CLASS processes.
See if you can load more, if not all, by setting a higher priority to your app's thread. Logically, if your app has the highest priority possible it should be able to access the maximum resources that can be marshalled.
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
Private Declare Function SetThreadPriority Lib "Kernel32" (ByVal hThread As Long, ByVal nPriority As Long) As Long
Private Declare Function SetPriorityClass Lib "Kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
Private Declare Function GetThreadPriority Lib "Kernel32" (ByVal hThread As Long) As Long
Private Declare Function GetPriorityClass Lib "Kernel32" (ByVal hProcess As Long) As Long
Private Declare Function GetCurrentThread Lib "Kernel32" () As Long
Private Declare Function GetCurrentProcess Lib "Kernel32" () As Long
In Form_Load, i have:
'retrieve the current thread and process
hThread = GetCurrentThread
hProcess = GetCurrentProcess
'set the new thread priority to "lowest"
SetThreadPriority hThread, THREAD_PRIORITY_HIGHEST
'set the new priority class to "idle"
SetPriorityClass hProcess, HIGH_PRIORITY_CLASS
Something i forgot is that when in Visual Studio, I try to load the form by clicking on it, the compiler itself goes haywire and I get an hourglass. I then cannot get back to çwindows. Then, if I do ctrl-alt-del, Windows crashes.
This is really bizarre to the extreme, how Win9x is left really wanting like this.
First: I am advised by my colleague (who was shoulder surfing, as usual) to avoid setting up priorities manually without really knowing how it will affect the OS. System Crashes are more liable.
That apart...
Try having DoEvents or the Sleep() function between loading controls. It will delay the whole thing a lot, but if it works, it should be worth it. I can not think of anything else now. Got to go home and hit the hay!
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
Thanks. I know there could be a number of alternative ways, but the look and feel of our interface is a big plus for our customers. We could have used a listview with a right hand side mouse click submenu like other products but we decided to go for a full-on interface with all the buttons right there on the interface. We only were dealing with up to 50 pc's before and there were no problems. We use W2k to do the dev work. It's only yeasterday when we ported the code on Win9x that we hit a wall there with so many controls on Win9x.
I'm still puzzled as to why Win9x seems to behave in such a different way than w2k when all I do is simply boot up on WMe on my multi-boot machine. It's the same machine, different OS.
Win95/Me are different from Win NT/2000 - they look & work in similar ways, but under the bonnet they are different beasts... 95/Me are designed for simple desktop use, whereas NT/2000 are for (more stable) buisness use.