Advertisement

Results for "Author: thefrogprince"

7_2009-2012 #225307
jeffLabel - true transparent label control with drop shadow effect

jeffLabel is a replacement usercontrol for the standard Visual Basic label control. The control started out simply as a usercontrol containing two labels (for creating a simple drop shadow effect). Things got a bit more involved when it came time for the new label to be a transparent label. The solution was, while in transparent backstyle mode, for the label shadow and text to be drawn directly onto the device context of the parent control. While in transparent mode, this label demonstrates advanced usage of the DrawText API call, specifically, drawing text in any font regardless of the current font in the device context. Additionally, the GetTextFace, GetTextMetrics, GetTextColor, SetTextColor, SelectObject, and CreatFontIndirect functions are demonstrated for converting standard vb font objects into logical fonts, and device context font metrics into standard vb font objects. This is version .1 of this control, so there are some bugs I am aware of already including: transparent user controls have no .hWnd and so do not capture mouse and keyboard events (will need to subclass the parent to trap these events), when in .AutoSize mode (as the test project will demonstrate) the control has a curious effect of growing when the .Caption value is repeatedly changed (this is most likely related to my use of the standard VB controls to do the initial text sizing; this method will need to be dropped in version 1). However, despite these current bugs, if you've been looking for a label with built in drop shadow effect, or you've been trying to figure out how to create genuine transparent usercontrols in vb, this project should sufficiently jump start you on your way. =) Not many examples can be found on Planet Source Code of creating true transparent usercontrols (usercontrol.backstyle = vbTransparent), and since this certainly is still a work in progress, your comments or suggestions below would be much appreciated.

7_2009-2012 #225308
MP3 Player ActiveX (xAudio) Control - no more Windows Media player

This download contains an ActiveX control project created in Visual Basic that implements a simple MP3 player using the xAudio library. The quick story on xAudio is, last year the software was purchased by InterTrust, and since then, the SDK for the library has been unavailable. While I eventually did find an older copy of the SDK, my work that you see here is based on a post I found in Planet Source Code. http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=24534&lngWId=1 The zip contains a couple of dlls. The xAnalyze, xAudio, and apigid32 dlls are all static DLLs and are placed in the \Windows\System directory of your computer. The file jeffActiveXStaticDLL.dll is an ActiveX dll that must be registered with RegSvr32.exe. While I am not making the source code available for this dll, I can tell you that all it contains is the subclasser and hook modules from vbAccelerator. Subclassing is required for the implementation of the player, so you could use the subclassing approach used in Gene's article, but I think you will find vbAccelerator's approach to subclassing (and my approach in this control) much better and easier to work with and debug. At the time of this posting, I've tested the control in VB, FrontPage, and Visual Interdev. It is a simple player, offering up a handful of what I consider to be critical events from a player. The control has a .Play method that accepts either a filename or a url. The position slider is working, as are pause and stop. I've tested it pretty thoroughly thus far. However, there are a couple of items I should mention. First, the volume and mixer have not been implemented yet. You can use the PSC project to see how these items are to be implemented. Second, I'm having some difficulty detecting an error when a bad mp3 file is sent to the player. Doing this does not generate any errors currently, the player simple starts then stops as soon as a Play command is issued. I haven't yet been able to detect whether the library is sending any kind of file format error notification or not. That said, this is a basic, stable player... and it will free your app from any dependencies on Windows Media player stuff. Since from this point forward, I will be including additional dependencies in this control, here's where I've decided to break off a chunk to share. So download a copy today... and get started on your own custom MP3 player control. =) Don't forget to VOTE if you like this. =) http://www.vbaccelerator.com/codelib/ssubtmr/ssubtmr.htm http://www.vbaccelerator.com/codelib/hook/vbalhook.htm

7_2009-2012 #225309
jeffFrame (enhanced VB Frame control)

This user control is my own personal replacement for the VB frame control. It more closely emulates the "panels" found in many 3rd party control libraries. It is an excellent example of using the DrawEdge API function. The control exposes 3 properties to this affect: BorderWidth, BorderEdges, and BorderStyle. The sample app visually demonstrates how these properties affect the control. In all of my personal code, I maintain 2 base modules: 1 for declaring constants and API stuff, and the other for containing generic function. Thus, the sample project includes a subset of those 2 files, plus the UserControl... and a test harness screen that allows you to set the frame properties on the fly. For the current versions of this control, or other cool controls or code, hit my web page:                                                                                                          http://members.tripod.com/thefrogprince/                                                                                                          If you are not currently involved in the coding contest, I WOULD REALLY APPRECIATE YOU VOTING FOR MY CODE. Will only take a minute or two to make an account, and while it won't make me any money... =) it will encourage me to keep posting good quality code and controls like this one.

7_2009-2012 #225310
clsFile / colFiles (File search and File properties API classes) FAST!!!

I use these two classes to encapsulate a whole host of file oriented API calls... allowing me treat files as objects in my code and with the speed that is gained by going through the API. The clsFile class wraps around a single file, and exposes a whole host of properties of a file (and the volume it is on) including: 16 bit equivalent path, parsed filename, size, attributes (readonly, system, archive, etc), dates (created, accessed, and modified) and volume properties: label, serial no., is a cdrom, fixed disk, remote, network path, unc info, etc. (see the screen shot for the full list). Besides being a read only property class, I have modified the .Attributes enum and the .DateLastModified properties to allow changes... so that when you change the properties on the class, the corresponding properties on the file are modified. Eventually, this class could also be modified to extend functions such as Rename, Delete, Copy and Move that would work through the Windows Shell. I have the code to do this, but never bothered patching it in since in my coding, I never ran into the situation where I needed to do these actions with the file object by itself. The colFiles class acts as a collection for the clsFile class. In addition to the methods you would expect from a collection, this class also encapsulates the API functions for file searching (including recursive directory searches). If you EVER intend to use a file search in your applications, going through the API is the ONLY way to achieve this in my opinion. You'll find many examples that try to use directory list boxes to perform file scans, but these examples will be painfully slow. The API, on the other hand, is extremely fast. As fast as the built in Find/Search screen in Windows Explorer. Plus... you are able to search through paths other than your mapped drives. This covers the entire Windows Explorer directory tree (network drives, namespace extensions, etc). Don't judge this class by the screen shots before knowing that in the screen shot example, I was searching across my network which consists of a slow 10Mb hub. You'll have to try it for yourself on your set up to see why I swear by these two classes when performing seek and file property operations. For updates to this or other cool vb code or controls, check my web page:                                                                                                          http://members.tripod.com/thefrogprince/                                                                                                          If you are not currently involved in the coding contest, I WOULD REALLY APPRECIATE YOU VOTING FOR MY CODE. Will only take a minute or two to make an account, and while it won't make me any money... =) it will encourage me to keep posting good quality code and controls like this one. (check out my other posts too). =)

7_2009-2012 #225316
jeffMaskedEdit (enhanced vb masked edit control)

This control is my replacement for the standard VB masked edit control. It came about by my need to add a .Locked property to the masked edit control... and my utter disgust with the colors and performance of the masked edit controls available in the 3rd party libraries. For the most part, I was pleased with the performance of the MS masked edit control, but it needed some tweaking (in addition to the .Locked property). For starters, I needed an alignment property because I wanted to use the masked edit with numeric and money fields. Then, for the purpose of money fields, I wanted to be able to apply a .Format, and then programmatically block certain keystrokes (alpha characters, for instance). And referring to fields, yes, it had to be data bindable. I accomplished all of these things, while retaining the MS masked edit control at the heart of my user control. This preserved the flexibility that was generally lost in the 3rd party controls... and spared me from the much more difficult chore of trying (like other examples I have seen) to implement a masked edit control using a plain ol' text box. In my research, I came across several examples, and none had gone so far as to perfectly preserve the flexibility of the masked edit. Anyway, this user control adds the following properties to the standard masked edit control: .Alignment, .AutoSelectAll, .Locked, and .AllowedKeys (a clever and easy to enhance enum; check it out). For updates to this or other useful VB stuff, check my page:                                                                                                          http://members.tripod.com/thefrogprince/                                                                                                          If you are not currently involved in the coding contest, I WOULD REALLY APPRECIATE YOU VOTING FOR MY CODE. Will only take a minute or two to make an account, and while it won't make me any money... =) it will encourage me to keep posting good quality code and controls like this one.

7_2009-2012 #225317
Securing Your IIS Web With User Login Security (Easy Yet Comprehensive)

Securing Your IIS Web & Content With Access MDB Based User Security (Simple Yet Comprehensive) This past week, I sat down to tackle the chore of securing my personal IIS web server... specifically, my web app I previously posted here (MP3Tool.Web).  It was a learning experience to say the least, and so I thought I'd zip up my work and share that experience with the rest of you. The Chore: secure an IIS web or entire server via user logins. The Solution: the magic of my security approach is achieved by making use of the Global.ASA file and sessions.  As it's name implies, it functions as something of a global over all the other asp pages on a web site.  You can find documentation on the global.asa posted here on psc, so I won't repeat those details here (and the rest of this assumes you know what global.asa is).  My security approach makes use of the Session_OnStart on event.  It is triggered the first time a user tries to hit an ASP page on your site... and occurs BEFORE the target asp page is served up by the server.  This is key to making this approach work.  When a session is first started, a number of activities take place.   1) a connection to the database is established (held as an object in the session at the top of the page) 2) the "hit" is logged in the database by IP # and date 3) we test to see if the IP # has been "banned".  If it has, I came up with a pretty slick way to implement the ban.  Attached in this zip is a VB project for my ResponseHelper com object (my solution to my problem expressed in my previous post, MP3Tool.web, about streaming back binary data back directly on the asp response).  In this case, we're not streaming back a binary persay, but an HTML page that looks and works exactly (with 1 smiling exception) to the Server Not Found page IE serves up.  Because I use the com object to stream the file back, rather than a .Redirect, the end user is none the wiser (their browser location never changes).  =) 4) this part is probably optional, but then I put in a browser check to ensure that IE is being used by the client. =) 5) we test to see if a specifically named cookie exists on the client.  This cookie is used to "persist" a user's login... much the same way your developer login is persisted (if you so choose for it to be) here on psc. 6) if no cookie was detected, then we test to see if the Login.htm form is being posted.  While the "target" of the Login.htm page is the Login.ASP page, we actually intercept and process all logins in the Global.asa file.  Login.asp file theoritically should never actually be hit.

Languages
Top Categories
Global Discovery