|
Wednesday, 13 September 2006
Here’s a quick way to run a spellcheck on any data stream from within your VB6 application:
Function SpellCheck(Stream As String) As String
On Error Resume Next
Dim W As Object
Set W = CreateObject("Word.Basic")
SpellCheck = Stream
With W
.AppMinimize
.FileNewDefault
.EditSelectAll
.EditCut
.Insert Stream
.StartOfDocument
.ToolsSpelling
.EditSelectAll
If Mid(.Selection, Len(.Selection), 1) = Chr(13) Then
.Selection = Mid(.Selection, 1, Len(.Selection) - 1)
End If
If Len(.Selection) > 1 Then
SpellCheck = .Selection
End If
.FileCloseAll 2
.AppClose
End With
Set W = Nothing
End Function
It will only work on those PC’s that have Microsoft Word already installed. You may want to modify the error handling logic to suit your taste. I’ve simply chosen to return the original text if the function encounters any serious errors with the spellcheck library.
Friday, 21 April 2006
One of the first problems a VB6 developer encounters when migrating to VB.NET is that the way forms are loaded has changed completely. Although this (typical) VB6 method of loading the main application form is syntactically correct, it will definitely not produce the desired result:
Read more >>
Friday, 10 March 2006
If you’re a software developer, string concatenation is something you do regularly, irrespective of the programming language you use. While languages such as C, C++, Perl and PHP all support the very useful sprintf() function, the VB/VBScript developers have traditionally had to resort to using a combination of single and double quotes, escape characters, text, line continuation characters and ampersands (&) to get the job done.
Read more >>
Monday, 20 February 2006
Displaying “mailto” links in web pages is much less widespread than it used to be in the good old days, largely thanks to the proliferation of web scraping spam harvesters.
The email obfuscator uses a simple trick to effectively camouflage an email address which may be embedded in a web page. Considering that HTML supports character encoding (decimal and hex) in web pages, it’s possible to make text just a little more difficult to decipher for spambots, while still making it meaningful for humans.
Read more >>
Tuesday, 1 November 2005
It doesn’t happen all that often but when it does, it’s worth the wait.
You see, I’m one of those insubordinate software developers who has for many years insisted that Hungarian notation is crap because not even Hungarians find it useful. I was one of the obnoxiously vocal minority who just refused to conform to variable naming conventions, Microsoft-style.
Read more >>
|