The attached Form demonstrates how to retrieve and format for display purposes the amount of time an application (or any process) has been running.
![Name: AppUpTime.png
Views: 29
Size: 2.5 KB]()
↧
[VB6] Application Up Time
↧
[VB6] Clone ListView
The attached project shows how to duplicate the textual contents of another ListView control, even if it's from another process.
![Name: Clone ListView.png
Views: 28
Size: 23.1 KB]()
↧
↧
VB6 - Quizzer: Multiuser LAN Quiz
This project demonstrates that a single VB6 program can be used on several PCs on the same LAN without a separate server program or database in common. This sort of thing is much easier to write and the product is less confusing to maintain if done as two separate client and server programs though.
Pure TCP is used and a UDP discovery technique is implemented so the PCs do not need to be members of the same Workgroup or Domain, no name service is required, and yet no IP addresses need to be entered either.
Preparation
Multiple PCs on a LAN together will need the compiled program installed. You could create a formal installer - the P&D Wizard is good enough. Or an XCopy deployment package could be created using Reg-Free COM tools like the popular MMM ("Make My Manifest") though this requires experience most VB6 programmers don't have.
Nothing stops you from testing by running two copies of Quizzer.exe on your development PC for testing though.
Both MSHFLXGD.OCX and MSWINSCK.OCX (in addition to ADO 2.5, already in Windows) are used by this demo program.
Operation
Some user must play "proctor" and administer the quiz. This person puts his Quizzer.exe into "proctor mode" which opens an extra Form, and from there chooses a quiz file for the quiz to run. After that the proctor starts the quiz and fires each question and then "calls time" when all submitted answers get scored. The proctor can also end the quiz early.
The proctor can also take the quiz himself or just act as an observer/administrator.
Other users won't get the second admin Form, and once someone has taken on the proctor role the "Become Proctor" button will disappear from their quiz Form.
All participants (including the proctor if he chooses to be a participant) must register with a unique name when they first run Quizzer.exe, which they are prompted for. User can leave out this name and just choose to be an observer as well.
Once the proctor has taken charge and picked a quiz he can wait for participants to register. Then he can start the quiz, and begin sending questions. The proctor sends each question, waits the allotted time, and then "calls time" on the question. This scores the submitted answers and reports back to everyone's scoreboard.
Participants wait for questions which are presented along with a multiple-choice list of answers. The pick an answer and click Submit to send their answer to the proctor. Once the proctor calls time, score updates are reported back and the correct answer is pointed out to all particpants and observers.
Once the quiz is finished everyone is left with the scores and rankings to look at until they close Quizzer. The proctor can also optionally save the scores to a CSV file before quitting Quizzer.
![Name: sshot.png
Views: 31
Size: 35.7 KB]()
Here "Mr. Bill" is acting as proctor. He has just clicked the "Call Time" button,
which has become the "Next Question" button.
Just A Demo
Quizzer isn't perfect.
There are many features that might be added. There may be some features that are not needed that could be ripped out.
The question file format is a bit rough (see the comments in Globals.InitProctor). This discovery protocol's UDP port is hard-coded (see Globals.PROCTOR_UDP_PORT). And so on and so on...
And of course there may still be any number of bugs in it yet, as well as plenty of imperfect exception handling. Not everything has been thoroughly tested.
How Quizzer Works
Without going into detail (though I'll admit the code itself can be rough to follow)...
There are two Forms, one called MainForm and the other ProctorForm.
MainForm is basically a user interface for displaying the scoreboard, displaying questions, and accepting answers.
ProctorForm is a sort of "reverse TCP server." It tracks everything, runs the quiz, maintains the "database" in memory using a pair of ADO Recordsets, and manages TCP connections to all of the MainForm instances on the LAN.
ADO Stream objects are heavily used for serializing and deserializing messages sent both ways over the TCP connections.
Discovery is accomplished by having each MainForm send UDP broadcasts out to the LAN containing the registration name of the user, his IP address, and the TCP port he is listening on. Once there is a ProctorForm running and it sees such a broadcast database entries are made and then ProctorForm connects back to the remote MainForm. When MainForm gets the connection established it stops broadcasting its announcements and is ready for the quiz to begin.
Large amounts of code and data used by both Forms is kept in Globals.bas in an attempt to make the code in the two Forms a little less cluttered.
There are also two other Forms: RegisterDlg and ProctorDlg. These are used as simple dialogs for getting information before carrying on with the business of the bigger Forms.
Pure TCP is used and a UDP discovery technique is implemented so the PCs do not need to be members of the same Workgroup or Domain, no name service is required, and yet no IP addresses need to be entered either.
Preparation
Multiple PCs on a LAN together will need the compiled program installed. You could create a formal installer - the P&D Wizard is good enough. Or an XCopy deployment package could be created using Reg-Free COM tools like the popular MMM ("Make My Manifest") though this requires experience most VB6 programmers don't have.
Nothing stops you from testing by running two copies of Quizzer.exe on your development PC for testing though.
Both MSHFLXGD.OCX and MSWINSCK.OCX (in addition to ADO 2.5, already in Windows) are used by this demo program.
Operation
Some user must play "proctor" and administer the quiz. This person puts his Quizzer.exe into "proctor mode" which opens an extra Form, and from there chooses a quiz file for the quiz to run. After that the proctor starts the quiz and fires each question and then "calls time" when all submitted answers get scored. The proctor can also end the quiz early.
The proctor can also take the quiz himself or just act as an observer/administrator.
Other users won't get the second admin Form, and once someone has taken on the proctor role the "Become Proctor" button will disappear from their quiz Form.
All participants (including the proctor if he chooses to be a participant) must register with a unique name when they first run Quizzer.exe, which they are prompted for. User can leave out this name and just choose to be an observer as well.
Once the proctor has taken charge and picked a quiz he can wait for participants to register. Then he can start the quiz, and begin sending questions. The proctor sends each question, waits the allotted time, and then "calls time" on the question. This scores the submitted answers and reports back to everyone's scoreboard.
Participants wait for questions which are presented along with a multiple-choice list of answers. The pick an answer and click Submit to send their answer to the proctor. Once the proctor calls time, score updates are reported back and the correct answer is pointed out to all particpants and observers.
Once the quiz is finished everyone is left with the scores and rankings to look at until they close Quizzer. The proctor can also optionally save the scores to a CSV file before quitting Quizzer.
Here "Mr. Bill" is acting as proctor. He has just clicked the "Call Time" button,
which has become the "Next Question" button.
Just A Demo
Quizzer isn't perfect.
There are many features that might be added. There may be some features that are not needed that could be ripped out.
The question file format is a bit rough (see the comments in Globals.InitProctor). This discovery protocol's UDP port is hard-coded (see Globals.PROCTOR_UDP_PORT). And so on and so on...
And of course there may still be any number of bugs in it yet, as well as plenty of imperfect exception handling. Not everything has been thoroughly tested.
How Quizzer Works
Without going into detail (though I'll admit the code itself can be rough to follow)...
There are two Forms, one called MainForm and the other ProctorForm.
MainForm is basically a user interface for displaying the scoreboard, displaying questions, and accepting answers.
ProctorForm is a sort of "reverse TCP server." It tracks everything, runs the quiz, maintains the "database" in memory using a pair of ADO Recordsets, and manages TCP connections to all of the MainForm instances on the LAN.
ADO Stream objects are heavily used for serializing and deserializing messages sent both ways over the TCP connections.
Discovery is accomplished by having each MainForm send UDP broadcasts out to the LAN containing the registration name of the user, his IP address, and the TCP port he is listening on. Once there is a ProctorForm running and it sees such a broadcast database entries are made and then ProctorForm connects back to the remote MainForm. When MainForm gets the connection established it stops broadcasting its announcements and is ready for the quiz to begin.
Large amounts of code and data used by both Forms is kept in Globals.bas in an attempt to make the code in the two Forms a little less cluttered.
There are also two other Forms: RegisterDlg and ProctorDlg. These are used as simple dialogs for getting information before carrying on with the business of the bigger Forms.
↧
Converting amount in words to figures in excel
Dear Friends,
Can anyone help me on converting amount in words to figures in excel 2007.
(Ex: Twenty thousand three hundred and fifty - 20,350.00)
Can anyone help me on converting amount in words to figures in excel 2007.
(Ex: Twenty thousand three hundred and fifty - 20,350.00)
↧
SizeGrip Control
This is a UserControl for simulating a SizeGrip.
It is only drawn themed when the app is linking to version 6.0 (or higher) of the comctl32.dll.
The SizeGrip is hidden when the form is maximized.
![Name: SizeGripSamplePic.png
Views: 27
Size: 7.1 KB]()
Attachment: Sample project with the sizegrip (user)control.
It is only drawn themed when the app is linking to version 6.0 (or higher) of the comctl32.dll.
The SizeGrip is hidden when the form is maximized.
Attachment: Sample project with the sizegrip (user)control.
↧
↧
VB6 (ActiveX-Exes and selfhosted Threading)
Here's an example for a simple AX-Exe-Threaded-Selfhosting-approach (calculating a Mandelbrot-Set on two worker-threads -
reflecting the results "row-by-row" in the GUI-MainThread then per normal cross-thread-COM-events).
http://vbRichClient.com/Downloads/MBSetAxThreaded.zip (<-- this zip contains also the compiled executable - whilst the other download at the bottom contains only the sources)
Would really like to see a .NET-version which does the same thing in the same performance (just try in the compiled Executable, and not in the IDE for "full-threaded-speed").
(the VB6-code is a bit rusty, it's already a few years old - but still working as it seems - just put it here as a reference).
Olaf
reflecting the results "row-by-row" in the GUI-MainThread then per normal cross-thread-COM-events).
http://vbRichClient.com/Downloads/MBSetAxThreaded.zip (<-- this zip contains also the compiled executable - whilst the other download at the bottom contains only the sources)
Would really like to see a .NET-version which does the same thing in the same performance (just try in the compiled Executable, and not in the IDE for "full-threaded-speed").
(the VB6-code is a bit rusty, it's already a few years old - but still working as it seems - just put it here as a reference).
Olaf
↧
VB6 3D-Surface-Plotting (based on RichClient5)
Just another Demo, which applies antialiased and semitransparent Drawing-commands in a somewhat similar way as the "Bezier-Art"-Demo here:
http://www.vbforums.com/showthread.p...ezier-Art-quot
But in a perhaps more useful (or practical) fashion...
The implementation allows for a few nice things as rotation around the Z-axis (Azimuth) - as well as changing the Altitude per Mouse (the height above the x-y-plane).
There's a few predefined Formulas in the appropriate Combo-Box, but you can type in your own stuff as well.
To support symmetrical Surfaces as e.g. spheres or "donuts", the Plotter allows also the formula: z² = f(x,y) (as an alternative to the usual z = f(x,y)).
But here's a few screen-shots which are far more telling I assume:
![]()
This is the wellknown "saddle":
![]()
And this is the same saddle-plot. but now with an altitude of 90 degrees (full Top-View):
![]()
Here a few more shots, but only as "normal links", to not clutter the posting with too many images:
http://vbRichClient.com/Downloads/3dSrfPlot1.jpg
http://vbRichClient.com/Downloads/3dSrfPlot4.jpg
http://vbRichClient.com/Downloads/3dSrfPlot5.jpg
http://vbRichClient.com/Downloads/3dSrfPlot6.jpg
Ok, finally the Source-code-link (as said, dependent on the RC5-libs which one can download from vbRichClient.com):
(only 7KB, so it's a pretty small code-base to study).
Have fun with it.
Olaf
http://www.vbforums.com/showthread.p...ezier-Art-quot
But in a perhaps more useful (or practical) fashion...
The implementation allows for a few nice things as rotation around the Z-axis (Azimuth) - as well as changing the Altitude per Mouse (the height above the x-y-plane).
There's a few predefined Formulas in the appropriate Combo-Box, but you can type in your own stuff as well.
To support symmetrical Surfaces as e.g. spheres or "donuts", the Plotter allows also the formula: z² = f(x,y) (as an alternative to the usual z = f(x,y)).
But here's a few screen-shots which are far more telling I assume:

This is the wellknown "saddle":

And this is the same saddle-plot. but now with an altitude of 90 degrees (full Top-View):

Here a few more shots, but only as "normal links", to not clutter the posting with too many images:
http://vbRichClient.com/Downloads/3dSrfPlot1.jpg
http://vbRichClient.com/Downloads/3dSrfPlot4.jpg
http://vbRichClient.com/Downloads/3dSrfPlot5.jpg
http://vbRichClient.com/Downloads/3dSrfPlot6.jpg
Ok, finally the Source-code-link (as said, dependent on the RC5-libs which one can download from vbRichClient.com):
(only 7KB, so it's a pretty small code-base to study).
Have fun with it.
Olaf
↧
VB6 - RicherLabel UserControl
Sometimes you need to use one or more Labels on a Form that just need to offer a little bit "richer" options.
Maybe you need to have some of the text bold or underlined. Maybe you need a superscript or subscript. Maybe you need to use a symbol from one of the symbol fonts like Windings. Maybe you need a second color to highlight a word or a symbol.
RicherLabel offers a way to do this without a lot of trouble. It basically accepts a Caption property with a simple markup syntax and renders the Caption according to the markup instructions.
You can even do simple "color blinking" as shown in the demo.
Some limitations:
If you need some with a border and some without, make another copy of the UserControl and name it something like RicherLabelB and then set the UserControl's BorderStyle. Or you might rework RicherLabel to draw its own border and add a BorderStyle property to it.
You could also work out a scheme for it and then implement word-wrap and multiline labels.
The RicherLabel markup consists of instructions of one character escaped using the ` (accent grave) character. You could easily change this yourself to something else, or maybe change the way the color table works, etc. You can also strip out functions you don't need pretty easily to reduce the compiled size of programs using RicherLabels.
![Name: sshot1.png
Views: 38
Size: 8.9 KB]()
Demo: Design Time
![Name: sshot2.png
Views: 48
Size: 16.7 KB]()
Demo: Run Time
Maybe you need to have some of the text bold or underlined. Maybe you need a superscript or subscript. Maybe you need to use a symbol from one of the symbol fonts like Windings. Maybe you need a second color to highlight a word or a symbol.
RicherLabel offers a way to do this without a lot of trouble. It basically accepts a Caption property with a simple markup syntax and renders the Caption according to the markup instructions.
You can even do simple "color blinking" as shown in the demo.
Some limitations:
- It doesn't support a BorderStyle.
- No multiline support.
- No word-wrap.
- No justification (always left-justified).
If you need some with a border and some without, make another copy of the UserControl and name it something like RicherLabelB and then set the UserControl's BorderStyle. Or you might rework RicherLabel to draw its own border and add a BorderStyle property to it.
You could also work out a scheme for it and then implement word-wrap and multiline labels.
The RicherLabel markup consists of instructions of one character escaped using the ` (accent grave) character. You could easily change this yourself to something else, or maybe change the way the color table works, etc. You can also strip out functions you don't need pretty easily to reduce the compiled size of programs using RicherLabels.
Demo: Design Time
Demo: Run Time
↧
VB6 Simple Async-Download-Ctl for multiple Files
Just a simple demonstration of the AsyncDownload-Feature, any VB-Usercontrol has already built-in.
It supports http- and ftp-downloads for files up to 2GB.
What's perhaps interesting from a Control-Design-point, is the organization of the whole thing.
There's a Host-Control: ucAsyncDLHost which only ensures Scrolling and Event-Delegation of the
separate Download-Entries it manages and visualizes.
The AsyncDownload itself is performed within another (Child-)Control: ucAsyncDLStripe,
which is a windowless-Control (containing a simple Progress-Bar and a simple Stop/Resume-Button).
So, those windowless-"Stripe-entries" make up the "Rows" within the outer ucAsyncDLHost Control.
Here's the usual Screenshot and the Download-Link:
http://vbRichClient.com/Downloads/As...nloadDemo2.zip
Olaf
It supports http- and ftp-downloads for files up to 2GB.
What's perhaps interesting from a Control-Design-point, is the organization of the whole thing.
There's a Host-Control: ucAsyncDLHost which only ensures Scrolling and Event-Delegation of the
separate Download-Entries it manages and visualizes.
The AsyncDownload itself is performed within another (Child-)Control: ucAsyncDLStripe,
which is a windowless-Control (containing a simple Progress-Bar and a simple Stop/Resume-Button).
So, those windowless-"Stripe-entries" make up the "Rows" within the outer ucAsyncDLHost Control.
Here's the usual Screenshot and the Download-Link:
http://vbRichClient.com/Downloads/As...nloadDemo2.zip
Olaf
↧
↧
MCOULTER876 - My Entire Code Bank
Here is my entire code bank (too long for vbforums.com to accept):
<removed by moderator>
<removed by moderator>
↧
MCOULTER876 - My Entire Code Bank
↧
Animated Spinner Class [vbRichClient5]
After contributing to the following thread (http://www.vbforums.com/showthread.p...Wheel-Spinning), I thought others might be interested in an animated spinner, so I packaged my code into a class and added a simple demo form that allows you to play around with the parameters in real-time.
Demo Screenshot:
![Name: Spinner5.png
Views: 14
Size: 24.4 KB]()
Samples:
![Name: Spinners.png
Views: 26
Size: 47.1 KB]()
Source code:
AnimatedSpinner.zip
Features:
Clockwise/Counter-Clockwise animation
Adjustable Speed of spin in, normal spin, and spin out frames
Number of segments to draw
Size of the spinner
Padding between the edge of the spinner box and the spinner
Base Color of the spinner
Background color of the spinner (including transparent background)
Size of the hole in the middle of the spinner
Total Degrees that the spinner should span
Degrees of margin between segments
Gaussian Blur, optionally clipping blurred edges
NOTE: This demo requires the vbRichClient5 framework to be registered on your development system: http://www.vbrichclient.com/#/en/Downloads.htm
This code is free to use for any purpose. No warranties, not extensively test.
Enjoy!
Demo Screenshot:
Samples:
Source code:
AnimatedSpinner.zip
Features:
Clockwise/Counter-Clockwise animation
Adjustable Speed of spin in, normal spin, and spin out frames
Number of segments to draw
Size of the spinner
Padding between the edge of the spinner box and the spinner
Base Color of the spinner
Background color of the spinner (including transparent background)
Size of the hole in the middle of the spinner
Total Degrees that the spinner should span
Degrees of margin between segments
Gaussian Blur, optionally clipping blurred edges
NOTE: This demo requires the vbRichClient5 framework to be registered on your development system: http://www.vbrichclient.com/#/en/Downloads.htm
This code is free to use for any purpose. No warranties, not extensively test.
Enjoy!
↧
Hidden Conversations V1
Ever wonder who might be listening to your online conversations. Aside from all the
possibilities with Social Media sites, your email is anything but private. And it
doesn't matter if you are using SSL (Secure Sockets Layer) or TLS (Transport Layer
Security). These security systems are only for the transport layer, and do not cover
storage. And even if the messages get stored encrypted, guess who controls the
Encryption/Decryption. Your only way around it is to encrypt the message before you
send it, and the person at the other end must have the decryption key. And if you are
using central storage for your messages (AKA Cloud computing), the encrypted message
is always available for someone to try and figure out the key.
Hidden Conversations is a 2 part private messaging system with built in
encryption/decryption. Version 1.0 uses Symmetric keys that start with a shared secret,
and change with every record sent. Because shared secrets are relatively easy to crack,
Version 2.0 will use 2048 bit Public/Private keys to start the conversation. Version
1.0 works for relatively short messages, but long messages that get broken up into
multiple packets will cause problems. Therefore, Version 2.0 packets will be structured
with a record length.
The 2 programs (Host & Client) are self contained, and do not require any additional
controls. Although the Cryptographic calls will probably work on most Windows operating
systems, the TCP/IP calls require a dual stack operating system that supports both IPv4
and IPv6. This more or less restricts it to Windows Vista or later. Because of the lack
of a full IPv6 network, IPv6 has not been tested yet.
J.A. Coutts
possibilities with Social Media sites, your email is anything but private. And it
doesn't matter if you are using SSL (Secure Sockets Layer) or TLS (Transport Layer
Security). These security systems are only for the transport layer, and do not cover
storage. And even if the messages get stored encrypted, guess who controls the
Encryption/Decryption. Your only way around it is to encrypt the message before you
send it, and the person at the other end must have the decryption key. And if you are
using central storage for your messages (AKA Cloud computing), the encrypted message
is always available for someone to try and figure out the key.
Hidden Conversations is a 2 part private messaging system with built in
encryption/decryption. Version 1.0 uses Symmetric keys that start with a shared secret,
and change with every record sent. Because shared secrets are relatively easy to crack,
Version 2.0 will use 2048 bit Public/Private keys to start the conversation. Version
1.0 works for relatively short messages, but long messages that get broken up into
multiple packets will cause problems. Therefore, Version 2.0 packets will be structured
with a record length.
The 2 programs (Host & Client) are self contained, and do not require any additional
controls. Although the Cryptographic calls will probably work on most Windows operating
systems, the TCP/IP calls require a dual stack operating system that supports both IPv4
and IPv6. This more or less restricts it to Windows Vista or later. Because of the lack
of a full IPv6 network, IPv6 has not been tested yet.
J.A. Coutts
↧
↧
VB6 Png-Alpha-Rendering (using WIA)
So, yeah - this Demo is not dependent on vbRichClient for a change ;), but on a System-lib instead (wiaaut.dll),
which comes pre-installed on newer systems.
The Demo-Code contains two Classes:
cPngCache (showing how to read Pngs per WIA, copying Alpha-Channel-ByteArray-content - premultiplying it - converting it into a 32bpp-VB-StdPicture)
cButton (makes use of the Class above, then dealing appropriately with Multi-State PNG-content ... ButtonNormal, ButtonPressed, Hovered, etc.)
Well, not much more to say, the Demo is small and the classes do not contain much code ... here's a screenshot:
![]()
And here the Download-Link: http://vbRichClient.com/Downloads/PngAlphaRendering.zip (~200KB, containing a few Image-Resources)
Olaf
which comes pre-installed on newer systems.
The Demo-Code contains two Classes:
cPngCache (showing how to read Pngs per WIA, copying Alpha-Channel-ByteArray-content - premultiplying it - converting it into a 32bpp-VB-StdPicture)
cButton (makes use of the Class above, then dealing appropriately with Multi-State PNG-content ... ButtonNormal, ButtonPressed, Hovered, etc.)
Well, not much more to say, the Demo is small and the classes do not contain much code ... here's a screenshot:

And here the Download-Link: http://vbRichClient.com/Downloads/PngAlphaRendering.zip (~200KB, containing a few Image-Resources)
Olaf
↧
VB6 Png-Alpha-Rendering with GDI+ (alternatively per WIA)
So, yeah - this Demo is not dependent on vbRichClient for a change ;), but on a System-lib instead,
which comes pre-installed on newer systems.
The Demo-Code contains two Classes:
cPngCache (showing how to read Pngs per GDI+ (alternatively per WIA), copying premultiplied Alpha-Channel-content - and converting (caching) it into a 32bpp-VB-StdPicture)
cButton (makes use of the Class above, then dealing appropriately with Multi-State PNG-content ... ButtonNormal, ButtonPressed, Hovered, etc.)
Well, not much more to say, the Demo is small and the classes do not contain much code ... here's a screenshot:
Edit: Changed the Demo to use GDI+ as a default now, since the WIA-libs are not on each and every XP-system (though GDI+ usually is).
The older WIA-class is still contained in the *.vbp though.
![]()
And here the Download-Link: http://vbRichClient.com/Downloads/PngAlphaRendering.zip (~200KB, containing a few Image-Resources)
Olaf
which comes pre-installed on newer systems.
The Demo-Code contains two Classes:
cPngCache (showing how to read Pngs per GDI+ (alternatively per WIA), copying premultiplied Alpha-Channel-content - and converting (caching) it into a 32bpp-VB-StdPicture)
cButton (makes use of the Class above, then dealing appropriately with Multi-State PNG-content ... ButtonNormal, ButtonPressed, Hovered, etc.)
Well, not much more to say, the Demo is small and the classes do not contain much code ... here's a screenshot:
Edit: Changed the Demo to use GDI+ as a default now, since the WIA-libs are not on each and every XP-system (though GDI+ usually is).
The older WIA-class is still contained in the *.vbp though.

And here the Download-Link: http://vbRichClient.com/Downloads/PngAlphaRendering.zip (~200KB, containing a few Image-Resources)
Olaf
↧
Fuzzy Search Demo [VB6/vbRichClient5]
The vbRichClient5 library for VB6 includes support for the SQLite database engine, and acts as a wrapper for the user defined collation (sort) and user-defined functions features of SQLite. Thanks to the work of Olaf Schmidt, it is really easy to create standard VB6 classes that extend the functionality of SQLite.
I've been experimenting with some "fuzzy" search routines using my own custom collation and ranking code (modified Metaphone), intertwined with the vbRC5 ranking code (RatCliff), and have put together a little demo here:
RC5SearchDemo.zip
Before you can use this demo, you will need to download and register the vbRichClient5 library from http://www.vbrichclient.com/#/en/Downloads.htm
"Search" is a really interesting (and constantly evolving) area of human>computer interaction, and I think VB6 is somewhat lacking (no native regex, no built-in fuzzy algorithms like metaphone, ratcliff, etc...). I'm really hoping for some input from the community on how to make this fuzzy matching better, under more search/language scenarios - for the benefit of all. Please feel free to hack away with the above demo and report back with your results, and let's see if we can create a search algorithm (or suite of algorithms) that produce consistently useful results.
I've been experimenting with some "fuzzy" search routines using my own custom collation and ranking code (modified Metaphone), intertwined with the vbRC5 ranking code (RatCliff), and have put together a little demo here:
RC5SearchDemo.zip
Before you can use this demo, you will need to download and register the vbRichClient5 library from http://www.vbrichclient.com/#/en/Downloads.htm
"Search" is a really interesting (and constantly evolving) area of human>computer interaction, and I think VB6 is somewhat lacking (no native regex, no built-in fuzzy algorithms like metaphone, ratcliff, etc...). I'm really hoping for some input from the community on how to make this fuzzy matching better, under more search/language scenarios - for the benefit of all. Please feel free to hack away with the above demo and report back with your results, and let's see if we can create a search algorithm (or suite of algorithms) that produce consistently useful results.
↧
DNS Filter
Our DNS server was being used as an attack vector against primarily Chinese servers. DNS by preference uses UDP packets instead of TCP packets. The UDP protocol is much faster than TCP, but unlike TCP it does not perform a handshake. It is essentially one way communication with no confirmation of receipt. Because of that, it is possible to fake the sender IP address, and this is what the attackers were doing. A 128 byte request was causing a 388 byte invalid response to be sent to the target server. By enlisting many hacked computers, the attackers could overwhelm the target. Because the hackers were sending false source information to legitimate DNS servers, it was difficult to track the actual source.
Our DNS server has the capability to block source addresses that send too many requests per second, but it was getting to be a pain to update the list, and the list itself was getting quite long. So I set about to design a filter. For this purpose I am using the Windows Packet Filter Kit from NT Kernel Resources. This high performance packet filtering framework hooks the NDIS (Network Driver Interface Specification) driver in your Windows Operating System. This allows me to inspect each packet and only target incoming Port 53 UDP packets for further processing. A 20 element cache is maintained with the Source IP Address, the Question Type, the Question, and a Timeout. When a DNS request is received, the program checks the cache and if does not exist or is timed out, it is added with the maximun timeout. If it already exists, the timeout is reset to the maximum and the record dropped. A timer decrements the timeout values every second.
I had considered building this progam some time ago because some abusive DNS servers were using brute force by sending multiple requests for the same thing. The worst offender was Yahoo, which not only sent multiple requests from the same server, but also used multiple servers for the same thing. These hackers only served to elevate the priority.
This program is a work in progress, and once it has proven itself, I will convert it to run as a Service. To run as a Service, I must ensure that the program makes no attempt to display to the Desktop, as this can cause the operating system to get into an endless loop when the user is logged off and the desktop is not available. All potential errors must be trapped, and logged to the Event or other log.
J.A. Coutts
Edit: When the filter was put into production, a bug was discovered that caused Overflow errors in the PacketRead routine. The problem was caused by Message Types greater than 32,767, which got interpreted as negative numbers. The problem was resolved by changed the data type to long integer from integer. To facilitate this resolution, Error Trapping and a logging function was added.
Our DNS server has the capability to block source addresses that send too many requests per second, but it was getting to be a pain to update the list, and the list itself was getting quite long. So I set about to design a filter. For this purpose I am using the Windows Packet Filter Kit from NT Kernel Resources. This high performance packet filtering framework hooks the NDIS (Network Driver Interface Specification) driver in your Windows Operating System. This allows me to inspect each packet and only target incoming Port 53 UDP packets for further processing. A 20 element cache is maintained with the Source IP Address, the Question Type, the Question, and a Timeout. When a DNS request is received, the program checks the cache and if does not exist or is timed out, it is added with the maximun timeout. If it already exists, the timeout is reset to the maximum and the record dropped. A timer decrements the timeout values every second.
I had considered building this progam some time ago because some abusive DNS servers were using brute force by sending multiple requests for the same thing. The worst offender was Yahoo, which not only sent multiple requests from the same server, but also used multiple servers for the same thing. These hackers only served to elevate the priority.
This program is a work in progress, and once it has proven itself, I will convert it to run as a Service. To run as a Service, I must ensure that the program makes no attempt to display to the Desktop, as this can cause the operating system to get into an endless loop when the user is logged off and the desktop is not available. All potential errors must be trapped, and logged to the Event or other log.
J.A. Coutts
Edit: When the filter was put into production, a bug was discovered that caused Overflow errors in the PacketRead routine. The problem was caused by Message Types greater than 32,767, which got interpreted as negative numbers. The problem was resolved by changed the data type to long integer from integer. To facilitate this resolution, Error Trapping and a logging function was added.
↧
↧
Changing The Shape of your Form and Showing Transparent animation on the Desktop
This is a simple Form transparency demo. It simply demonstrates how you can make your Form any shape you want and show pictures and animation on the desktop in the shape of your Form. It basically shows you how to change the shape of your Form to almost anything or shape you would want and to show animation (using animated gif) on the desktop
Left mouse down to move the Form
Right mouse down for options
Left mouse down to move the Form
Right mouse down for options
↧
DNS Filter Service
This is the Service Version of the Filter program previously posted. The Service version of DNS Filter not only requires the WinpkFilter from NT Kernel Resources (free for personal use) but also the NT Service Control from Microsoft (freely available). So far it has been tested on Server 2000 and Windows Vista.
It consists of 2 programs; one is the actual service, and the other to load and manage the Service. Although the service can install itself, the management program is needed to store a couple of parameters. Because the Service runs in Session 0, the Registry values must be placed in the Registry in a location that allows System access. Because the management program runs in Session 1 or more, it has no actual interaction with the service. It deals entirely with the Service Manager (services.msc). I used to use the System Tray for interaction between a service and the desktop, but that is now difficult to do with Session Isolation. I also used to use the Dart Service Control (which I prefer), but that requires the user to purchase a license.
J.A. Coutts
Note: DNSFilSvc was designed to be run in Development mode as well as a Service. To compile the service, change the IsService flag to True. In order to get the logging routine to function on Server 2000, I had to manually create the DNS sub-directory in the Logfiles directory. Server 2000 would not automatically create it.
Addendum: I finally got the low level filtering in WinpkFilter working. This allowed me to only process Port 53 UDP requests, thereby reducing the amount of code needed and theoretically reducing system resources required. The problem turned out to be bad type declarations in the sample code provided.
Bug Fix 11/12/2013: A bug was discovered that randomly allowed some duplicated queries to get through the filter. A fixed length buffer (128 bytes) was maintained to receive incoming query names. This string information was of variable length, but always ended in a null character. When the name was added to the string array, VB only recognized up to the null character. If the previous query was longer than the current one, extra characters got left behind in the fixed length buffer. For example, if "12345678.com" was followed by "123456.com", what was shown in the buffer was "123456.com m", which of course did not compare to what was already in cache. This was corrected by clearing the fixed length buffer after every query. At the same time, table updates were sped up by maintaining an end of cache pointer.
It consists of 2 programs; one is the actual service, and the other to load and manage the Service. Although the service can install itself, the management program is needed to store a couple of parameters. Because the Service runs in Session 0, the Registry values must be placed in the Registry in a location that allows System access. Because the management program runs in Session 1 or more, it has no actual interaction with the service. It deals entirely with the Service Manager (services.msc). I used to use the System Tray for interaction between a service and the desktop, but that is now difficult to do with Session Isolation. I also used to use the Dart Service Control (which I prefer), but that requires the user to purchase a license.
J.A. Coutts
Note: DNSFilSvc was designed to be run in Development mode as well as a Service. To compile the service, change the IsService flag to True. In order to get the logging routine to function on Server 2000, I had to manually create the DNS sub-directory in the Logfiles directory. Server 2000 would not automatically create it.
Addendum: I finally got the low level filtering in WinpkFilter working. This allowed me to only process Port 53 UDP requests, thereby reducing the amount of code needed and theoretically reducing system resources required. The problem turned out to be bad type declarations in the sample code provided.
Bug Fix 11/12/2013: A bug was discovered that randomly allowed some duplicated queries to get through the filter. A fixed length buffer (128 bytes) was maintained to receive incoming query names. This string information was of variable length, but always ended in a null character. When the name was added to the string array, VB only recognized up to the null character. If the previous query was longer than the current one, extra characters got left behind in the fixed length buffer. For example, if "12345678.com" was followed by "123456.com", what was shown in the buffer was "123456.com m", which of course did not compare to what was already in cache. This was corrected by clearing the fixed length buffer after every query. At the same time, table updates were sped up by maintaining an end of cache pointer.
↧
Alphablending - A Simple Demo
This small demo shows you how you can alpha blend one picture onto another. In this demo only part of the target picture is alpha blended.
↧