Error Creating Window Handle

Brain-BulbIt starts with “Can not create Window Handle”… and continuous random crashes. You find out your app reaches the max of 10000 user objects. (Just check the task manager, you’ll see I’m right.)

So, you’ve been using your own usercontrols on a flowlayoutpanel; you add, you remove, you clear… however the user objects count keeps growing and something is leaking somewhere…

You find that .controls.clear() does not work, you have to dispose() of all the objects first. Okay, do that, but it still doesn’t work.
So what’s the trick?
Simply remove first, before the dispose, and do this one at a time.

Just use the following routine:
ClearFlowLayoutPanel(myFlowLayoutPanel)
instead of
myFlowLayoutPanel.Controls.Clear()

Public Sub ClearFlowLayoutPanel(cFlowLayoutPanel As FlowLayoutPanel)
 Do While (cFlowLayoutPanel.Controls.Count > 0)
  Using controltoremove = cFlowLayoutPanel.Controls(0)
   cFlowLayoutPanel.Controls.Remove(controltoremove)
   controltoremove.Dispose()
  End Using
 Loop
 GC.Collect()
 GC.WaitForPendingFinalizers()
 cFlowLayoutPanel.Controls.Clear()
End Sub

Good Luck! …or ask My Brain.

sources or more info:
https://blogs.technet.microsoft.com/markrussinovich/2010/02/24/pushing-the-limits-of-windows-user-and-gdi-objects-part-1/
http://stackoverflow.com/questions/1378668/clearing-controls-from-flowlayoutpanel-not-calling-destructors/

 

Windows 7 SP1 Updates take forever after fresh install

W10disketteFor older computers, Windows 10 simply might not be an option for lack of drivers. (Thanks Intel GMA 500 !)
So back to installing Windows 7 with SP1 fresh, and the next step is to get all the updates…
However this seems to take forever nowadays, runs a high CPU, high memory usage, and doing nothing. After a day of letting the computer sit and run, it was time to find a faster solution. As expected, it is a known problem. The solution is to update the update itself first: See KB3102810.

Microsoft released a new WindowsUpdate Client Update to fix the slow Update searching/Installation. Installing and searching for updates is slow and high CPU usage occurs in Windows 7 – https://support.microsoft.com/en-us/kb/3102810

Download:
32Bit: http://www.microsoft.com/downloads/details.aspx?FamilyId=fcd6bf5d-f004-4ca3-aa7e-1de462b91dd0
64Bit: http://www.microsoft.com/downloads/details.aspx?FamilyId=4fe566bd-31b1-4413-8c4c-412b52533669

After this you might also want to install this SUR: http://windows.microsoft.com/en-us/windows7/what-is-the-system-update-readiness-tool

For me just the KB3102810 update was sufficient and the computer is now trying to install 208 updates; Let’s see how long that takes 🙂

Mailserver Settings NL

A listing of the mail server settings of most Dutch internet providers
To the readers of this page:
Would you like to add something, are you happy with this listing or if you noticed a mistake, please tell us! You can leave a message at the bottom of this page. Thank you!

ABOUT SENDING EMAIL
The IMAP mail protocol is preferred over POP mail nowadays. IMAP is a more recent protocol. When using IMAP, the contents or your email boxes will be synchronized and are therefore the same on all your devices and on your provider’s mail server. So if you delete a message, it is really gone everywhere.
Help me! I can’t send emails anymore! Tip for the outgoing mail server settings on mobile devices. Continue reading Mailserver Settings NL

Display all PHP Errors and Warnings

ctrl-ZVXWhen debugging PHP I find myself searching again and again for this little piece of code to display the PHP errors. So here it is for future reference…
If you wish to see all the PHP errors and warnings in your script, simply include the following bit of code:

error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);

Now, continue to beat your head against the keyboard while you hunt down that missing semicolon or closing parenthesis. Need help, contact My Brain.

Windows 10 Home Add local users disabled?

W10disketteIf you cannot add users to Windows 10, or if ‘Add someone else to this PC’ link in Settings app is not working, then this article will help you to fix that.

This article address a problem in which administrators can’t add new users to Windows. For adding new users or other family members to the system, you’ve to go Settings app > Accounts > Family and other users and then click Add someone else to this PC link. However, we’ve found that many administrators got this link not working. According to them, when they click the link, nothing happens. It’s disabled.

The cause behind this problem may be miscellaneous, depending upon your system usage and availability of crucial factors such as network, dependency services etc. If you’re also victim of this issue, you can try out the ways mentioned below to overcome this.

FIX : Cannot Add Users To Windows 10 – Using NETPLWIZ

1. Press Windows Key + R and put netplwiz in Run dialog box. Click OK or hit Enter key.

2. In the User Accounts window so appeared, click Add button.

3. Then in next screen, type the Microsoft account email address of the person – whom you want to add. The account created by this way will be Microsoft account. So if you want to add new user with Local account, click Sign in without a Microsoft account (not recommended) link.

4. In the next screen, click Local account. If your decision is changed after reading benefits of Microsoft account, you can opt for Microsoft account.

5. Finally, on the next screen as per what you’ve chosen above, you can add the user to the machine by providing required details.

Note by My Brain: to add another user, close the netplwiz completely and start again from 1.

SOURCE: here

VB.Net create mdb with a password

f_3dh_partyWhen developing an application with visual basic, you may want to store data. So you create a database during runtime, for example with the following piece of code, as many websites show on various forums:

Dim strMDBPath As String = "C:\SomePath\MyTestDB.mdb"
Dim cat As New ADOX.Catalog()
 cat.Create(Convert.ToString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=") & strMDBPath)
 cat = Nothing

Next you wish to protect your data, so only your application can open the database. You google again, and find the following solution:

Dim cn As OleDbConnection = New OleDbConnection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strMDBPath & ";Mode=Share Deny Read|Share Deny Write;"
cn.Open()
Dim cmdpw As OleDbCommand = New OleDbCommand
cmdpw.Connection = cn
cmdpw.CommandText = "ALTER DATABASE PASSWORD [MYNEWPASSWORD] null"
cmdpw.ExecuteNonQuery()
cn.Close()

Unfortunately, now you are stuck with an error you can not solve:
You attempted to open a database that is already opened by user ‘Admin’ on machine ‘YOURPCNAME’. Try again when the database is available.
Creating the database seems to keep the connection open and you cannot close it to execute the password change on an exclusive connection.

The answer and solution is simple: Set the password in the connection string in the first piece of code when creating the database! The attempt to ALTER DATABASE PASSWORD is no longer needed and you can forget about that…
So:

Dim strMDBPath As String = "C:\SomePath\MyTestDB.mdb"
Dim cat As New ADOX.Catalog()
cat.Create(Convert.ToString("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=MYNEWPASSWORD;Data Source=") & strMDBPath)
cat = Nothing

Enjoy this free advice from My Brain!