Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all 1304 articles
Browse latest View live

Pinboard (plus bonus - 100 free pushpins!)

0
0
This project was made per a request by a member who needed an application that user could load an image and push pins into it and have a descriptive label for the pins.
Attached Files

VB6 - ThinDavApi, Cloud Storage for the Masses

0
0
ThinDavApi

ThinDavApi is a small DAV client API based on MSXML.

Its main limitations are:

  • No support for DAV resource locking.
  • No partial-resource reading or writing, it deals with whole resources.
  • No chunked transfer support, so it is better suited for smaller resources or situations where your application can afford the memory to hold a medium sized resource in memory.
  • Only supports a few common resource properties, does not support modifying properties of existing resources.


ThinDavApi refers to resources as "files" and collection resources as "directories" but this is merely an abstraction since they are really BLOBs of data. ThinDavApi can read/write binary data or UTF-8 text, handling text translation to and from Windows Unicode (UTF-16LE) via MSXML's facilities.


Purpose

ThinDavApi is meant to offer programmers a simple way to implement "cloud storage" within applications. There are many inexpensive and even free WebDAV hosting services you might use for a number of purposes. Examples might include submitting and/or retrieving updated data, remote logging, error reporting, and contact requests. This allows you to completely replace the use of SMTP email or FTP, both of which can suffer from insecure data transfer and firewall or ISP blocking problems. Very few firewalls will block WebDAV traffic over standard HTTP (port 80) or HTTPS (port 443).

ThinDavApi does not require any "web folder" setup and doesn't use any of the Microsoft WebDAV filesystem redirectors. When used with MSXML 3.0 which is perfectly adequate ThinDavApi can work on any version of Windows as far back as Windows 95. On an older OS you'd need to deploy MSXML 3.0 unless it was already installed by another product (e.g. IE 5.x). It is installed on every OS from a fully patched Win2k SP4 installation on up and is patched with bug fixes via Windows Update.

Some limited testing has been done using MSXML 6.0 but considering its deployment issues any advantages it offers probably don't warrant its use. However there might be a small performance boost in doing so as long as you only target systems where MSXML 6.0 is preinstalled or you are willing to deploy it (Win2K SP4 through WinXP SP2).


Aync Operation

Since the main reason for your programs to use WebDAV is to access a remote datastore over the Internet, synchronous operations aren't really practical. Because of this ThinDavApi does not support them.

All requests you make through ThinDavApi calls end by raising a Complete event. You can determine success or failure and retrieve results in your event handler.

Timeouts should be handled in your program using a timer of some kind. When a request takes too long you can call AbortRequest, and when Complete is subsequently raised you can test for the Aborted property.


Thin Wrapper

DAV is an XML-based protocol on top of HTTP.

ThinDavApi is a fairly thin wrapper on the MSXML library. Because of this request completion status information is reported as HTTP results (status code and status text) and some requests provide HTTP response headers after minimal parsing.

You don't need any XML knowledge to use ThinDavApi unless you need to do some advanced debugging or to add or modify features of ThinDavApi. Your best reference on DAV is probably RFC 2518, which covers all of the things ThinDavApi supports (and more).


Supported Resource Properties

ThinDavApi will make a PROPFIND request through its GetDir() method which returns:

  • Name - simple name of a file or directory. String.
  • FullName - fully qualified path of a file or directory below the ThinDavApi BaseURL property. String.
  • LastModified - timestamp. Date.
  • ContentType - MIME type (only files). String.
  • Length - in bytes at the server (only files). Long.
  • IsFile - False for a directory and True for a file. Boolean.


The returned XML is parsed into a Variant property DirEntries. DirEntries is an array of Variant arrays, one row for the file or directory queried on and one row for each "child" resource unless the call specifies ChildInfo = False. Each column in these inner "DirEntry" arrays corresponds to one of the supported properties, translated to an appropriate Automation type (e.g. Date, Long, Boolean, or String in VB terms).

ThinDavApi also accepts an optional ContentType to use when creating a file by calling PutFileBytes() or PutFileText(), or if none is supplied a default is used.


Source Code, Usage

The ThinDavApi.cls module contains a block of comments describing its properties, methods, and events.

It has been provided here as part of a demo Project "ThinDAVMan" which makes use of most of its supported operations. In particular I've tried to show how to handle the async method calls and implement request timeouts using a Timer control. The ThinDAVMan.zip archive is attached to this post.


From Here

ThinDavApi 1.0 posted here was taken from another WebDAV client class that is at version 3.1, so it has had a lot of testing and debugging done already. However it may still have flaws including some that won't show up until somebody tries to use it with some server I haven't used yet. Despite the WebDAV standard I have found variations out there which required subtle workarounds.

The goal with ThinDavApi was to make a basic client that can be compiled into a VB6 program or used from VBA. This could also be the basis for a more complete WebDAV client that adds locking and other features, though at that point you may want to look at 3rd party commercial libraries that do a great job.
Attached Files

Push Pin Board

0
0
This project was made per a request by a member who needed an application that user could load an image and push pins into it and have a descriptive label for the pins.
Attached Files

VB6 - Test Crypto Functions

0
0
As promised, I have attached a VB6 Cryptography Test program originally developed in C++ by:
Michael Jung 2004
Juan Lang 2006
Vijay Kiran Kamuju 2007
The original C++ code is included as TestC++.txt.

Not all functions behave exactly the same as predicted, and much of that I attribute to the fact that Encryption and Decryption routines are done using strings rather than byte arrays. The reason for doing this is that in VB6, data is usually sent and received as string information.

The Test NULL Provider routine has not been implemented at all. Of the first 4 tests that I converted, 3 of them did not behave as predicted. The bulk of the routine seemed to be based on testing for failures rather than productive code, so I abandoned the effort.

I also made no attempt to provide support for XP and older operating systems as the original authors did. There were a lot of system calls that just were not supported by these older systems, and I had no way of testing them.

Most of the system calls have built in error trapping, and would not be present in this format in final working code. But these routines are built as demonstration test code, and a full description of the error is useful. A full list of the 0x80090000 level errors is included in the module.

I am by no means a Cryptographic expert, but I will attempt to address any questions.

J.A. Coutts
Attached Files

Round Colorful Forms

0
0
Ok in its raw form this is really quite useless but it contains several interesting parts that can be put to greater use

With this code you can create a round, color changing form that can be moved freely.

Thank you SamOscarBrown for your circle code and Microsoft for helping me get the form movable

you will need a form with a text box and a timer. I named the form frmRound

seeing it work really blew my mind! :eek2:

Code:

Private Declare Function SendMessage Lib "User32" _
                        Alias "SendMessageA" (ByVal hWnd As Long, _
                                              ByVal wMsg As Long, _
                                              ByVal wParam As Long, _
                                              lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()

      Const WM_NCLBUTTONDOWN = &HA1
      Const HTCAPTION = 2

    Option Explicit
    Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
    Private Declare Function SetWindowRgn Lib "User32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
 

   
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, _
                                X As Single, Y As Single)
        Dim lngReturnValue As Long

        If Button = 1 Then
            Call ReleaseCapture
            lngReturnValue = SendMessage(frmRound.hWnd, WM_NCLBUTTONDOWN, _
                                        HTCAPTION, 0&)
        End If
      End Sub

    Private Sub Form_DblClick()
      Unload Me
    End Sub
    Private Sub Form_Load()
        Dim lngRegion As Long
        Dim lngReturn As Long
        Dim lngFormWidth As Long
        Dim lngFormHeight As Long
        Me.Width = Me.Height
       
        lngFormWidth = Me.Width / Screen.TwipsPerPixelX
        lngFormHeight = Me.Height / Screen.TwipsPerPixelY
        lngRegion = CreateEllipticRgn(0, 0, lngFormWidth, lngFormHeight)
        lngReturn = SetWindowRgn(Me.hWnd, lngRegion, True)
Label1.Left = (Me.Width / 2) - (Label1.Width / 2)
Label1.Top = (Me.Height / 2) - (Label1.Height / 2)
    End Sub
    Private Sub Label1_Click()
      Unload frmRound
    End Sub
    Private Sub Timer1_Timer()
  Static iColor As Integer
  Select Case iColor
  Case 0: Me.BackColor = RGB(255, 0, 0)  ' Red
  Case 1: Me.BackColor = RGB(255, 165, 0) ' Orange
  Case 2: Me.BackColor = RGB(255, 255, 0) ' Yellow
  Case 3: Me.BackColor = RGB(0, 128, 0)  ' Green
  Case 4: Me.BackColor = RGB(0, 0, 255)  ' Blue
  Case 5: Me.BackColor = RGB(128, 0, 128) ' Purple
  End Select
  iColor = iColor + 1
  If iColor > 5 Then iColor = 0
End Sub

VB6 - Jet UserRoster, Connection Control, Backup

0
0
Background

When Jet 4.0 came out it offered many new features that go beyond those in Jet 3.x and the Jet 4.0 OLEDB Provider exposes many of them through ADO and a few more through JRO.

Some of these can be useful in getting a Jet database closed so you can back it up, as well as another way to do the backup that runs a compact and repair operation to reclaim space and fix up indexes.


User Roster

It is possible for programs to retrieve a list of active connections open on a database. Since this even shows which computer each connection comes from on a shared database it can be useful in getting persistent opens closed.


Connection Control

A program can invoke Connection Control to prevent new connections to a database from being established. The idea is to get the database closed for backup or other maintenance through attrition, without interfering with existing activity.

Invoke this and put the word out. As connections are closed eventually you can perform the database maintenence once the last man standing... sits.


CompactDatabase

A method of the JRO.JetEngine object you can call to compact an existing database into a new database. Useful as a backup step because it reclaims unused "holes" in the MDB file created by lots of updates and deletes, compacts indexes, and repairs some kinds of internal broken links.


Backup Demo

This demo has two programs:


DbDemo

A small program that opens a database (creating it if necessary) and does some simple queries and updates. It can be run passing a database folder on the command line if you want to test access over the network to a database on a file share.


BackupDemo

A small program that opens the database (creating it if necessary) and sets Jet Connection Control to prevent new connections. Then it polls the database for a list of current users/connections and displays them. Once the connection count is one (just this program) it closes the current database, copies it as a backup, and uses JRO to compact the backup to create a new "current" database.


Running The Demo

Open each Project and compile (Make) it.

Run DbDemo and create a few records.

Name:  sshot0.png
Views: 38
Size:  9.8 KB

Run a second copy of DbDemo.

Run BackupDemo. Observe the users list.

Name:  sshot1.png
Views: 48
Size:  11.3 KB

In the second screenshot there are three connections listed. One of these is an instance of DbDemo running on another computer (ATOMANT in this case). Two more connections show from the first computer (SNITZ), one being a local instance of DbDemo and the other being BackupDemo itself.

All of them show as the user "Admin" since this isn't a secured Jet database. Jet User/Group security is beyond the scope of this writeup.

Close a copy of DbDemo and the list shown in BackupDemo should change to reflect this.

Close the other copy of DbDemo.

Name:  sshot2.png
Views: 34
Size:  10.7 KB

Try starting a new DbDemo copy. It should fail with an error message describing the database's state, which currently blocks attempts to open or lock it.

Name:  sshot4.png
Views: 33
Size:  10.0 KB

When the last DbDemo is gone, BackupDemo should enable its "Back Up MDB" button. Click on this to start the compact & backup process.

Name:  sshot3.png
Views: 38
Size:  18.1 KB

At this point BackupDemo is done. Users can start running DbDemo again, using the compacted database. The original database has been renamed and can be copied off to archival storage as desired.


Remarks

This is a demonstration providing sample code. For a real application you might do things differently, such as creating backup MDB names with timestamps in them. You might create a backup utility with no user interface that can be scheduled to run via Task Scheduler and just "takes off" and does the backup once all other users have closed out.

You might even add some mechanism to send messages from your backup utility to any running copies of the database client application. These could warn the users to finish up and close out for a while, and let them know when the backup is complete.

Don't try to back up directly to a slow network share. It is also best to run your backup utility directly on the box hosting the database. You can't always do this, but it makes the process much quicker and more reliable when possible.
Attached Images
     

[VB6] Application Up Time

0
0
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: 35
Size:  2.5 KB
Attached Images
 
Attached Files

[VB6] Clone ListView

0
0
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: 35
Size:  23.1 KB
Attached Images
 
Attached Files

VB6 - Quizzer: Multiuser LAN Quiz

0
0
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: 32
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.
Attached Images
 
Attached Files

Converting amount in words to figures in excel

0
0
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)

SizeGrip Control

0
0
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: 16
Size:  7.1 KB

Attachment: Sample project with the sizegrip (user)control.
Attached Images
 
Attached Files

VB6 (ActiveX-Exes and selfhosted Threading)

0
0
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
Attached Images
 
Attached Files

VB6 3D-Surface-Plotting (based on RichClient5)

0
0
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
Attached Files

VB6 - RicherLabel UserControl

0
0
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:

  • 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.

Name:  sshot1.png
Views: 15
Size:  8.9 KB

Demo: Design Time


Name:  sshot2.png
Views: 25
Size:  16.7 KB

Demo: Run Time
Attached Images
  
Attached Files

VB6 Simple Async-Download-Ctl for multiple Files

0
0
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
Attached Images
 

MCOULTER876 - My Entire Code Bank

Animated Spinner Class [vbRichClient5]

0
0
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:  Spinner7.png
Views: 23
Size:  23.1 KB


Samples:

Name:  Spinners.png
Views: 63
Size:  47.1 KB


Source code:

AnimatedSpinner.zip


Features:
Antialiased
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
Optionally fade segments
Optional animated fade on spin in/out
Optional animated zoom on spin in/out


NOTES
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! This code has not been extensively tested, nor is it currently used in any production environment. It is also my first attempt at using the vbRC5 Cairo graphics methods, so there may well be bugs/inefficiencies.

Enjoy!
Attached Images
  
Attached Files

Hidden Conversations V1

0
0
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
Attached Files

VB6 Png-Alpha-Rendering (using WIA)

0
0
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

VB6 Png-Alpha-Rendering with GDI+ (alternatively per WIA)

0
0
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
Viewing all 1304 articles
Browse latest View live




Latest Images