Results for "Author: thefrogprince"
This is an add-in for VB 6 (theoretically should compile in VB5 but not tested) that provides a simple way for you to zip up your project files. I invented this add-in over a year ago now for one sole reason. As a single developer working on multiple projects, I want only 1 copy of my code in source safe... period. No shares. I want to check a module out in one app... change it... and check it back in while working on a different app. I have implemented a standard directory structure and all of my project files use relative addressing for pulling in the other files. The beauty of this add-in is that you can do this, and when it comes time to (as I often do) update a remote code base, such as home, all I have to do is select the peices of the project I want to zip in the treeview, click the button, and presto... a zip file is generated preserving the directory structure and correctly pulling in files from the other directories. =) I decided to post this up here on PSC after reading a recent post by Clint LaFever regarding the issues that affect a lot of the posts here (source safe files, workspace files, and other misc junk) when entire directories are just zipped up via Explorer. My apologies to the fellow who was whining about code people have uploaded here the other day, but while it DOES compile and it DOES work, =) it's ugly as sin. =) I'm sure there's a couple modules in there from the guys over vbAccelerator.com (I believe I left their header files in tact). So if you need a tool to help you when creating zip files of code, then download and compile this add-in. =) Particularly, please, if you plan to upload code. =) A few notes on use: the add-in works together with your existing WinZip. If you don't have it, get it (winzip.com). Originally, I developed the add-in in Windows 98... and built in ZIP dll I found worked. I didn't have to integrate with WinZip until I tried using the add-in on Windows 2000. The dll blew up. So I have omitted it from this post since we can't post dlls anyways and because all I ever use is the external option (will eventually remove that checkbox altogether I guess). Anyways... when you do click on the Use External button, WinZip will launch. Click past the ShareWare screen, and then go back to the add-in and click the ZIP button. That's about it. If you do want to include the compiled version or the compiled compatibility version, just check the appropriate boxes. =)
O.K. This is the debut of both jeffButton and jeffSplitter. =) jeffButton is a custom control replacement for the VB command button. The enhancements it provides are: location of the caption, providing for the "soft button" effect, and most importantly, automatically creating disabled versions of your button icons... just like the standard vb toolbar. However, I must state now that the API calls I use to achieve this are newer, and probably won't work in Win95 and potentially early versions of Win98 and NT. Works fine on current Win98se, WinME, and Win2K. Anyways... the controls also demonstrates the mouse capturing API calls. The button control also supports hot and disabled icons if you so wish to provide them. =) Addditionally, this project post also exhibits my custom splitter control. I think, at the least, you will find my approach unique. Again, this control demonstrates the mouse capturing API calls. You can set the splitter's orientation, and bounds. And event fires every time the bar moves, allowing you to custom resize controls at will... which is what I like to do. Most implementations I have seen of splitter controls that automatically resize controls for you aren't very complicated, or else they end up adding a lot of overhead. jeffSplitter is simply and based on Edanmo's VB5 ocx splitter controls which provide the splitter but allow you the flexability to implement your own resize techniques (useful when a frame or toolbar is resized in the same section along with a grid or treeview). =) Anyways... hope you guys enjoy my latest offering. I cut with my previous policy of distinguishing between public and private code on this project, so additionally, any of you code hounds out there will also find in this project a rich library of base vb functions and API function definitions and constants in the two files: tools6.bas and mapiconstants.bas. =) I use this module base in both work and recreation projects. If you like it or the latest controls, please gimme a vote. ;) (it don't take long to vote, honest)
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.
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
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.
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). =)
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.
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.
OK... not looking to blow away the world with this one, but felt lead to make the post after reading this article. http://www.planet-source-code.com/vb/scripts/showcode.asp?txtCodeId=26999&lngWId=1 At work, I have an app that is an mdi based program... and while the sub forms don't need a menu bar of their own, they do need popup context menus. Since adding even an invisible menu to a mdichild form will cause it to over write the parent mdi's menu bar, I needed a way to create menus for the child forms on the fly. This simple class demonstrates using the API calls to create a popup menu, display it, and return the item that was clicked (if any). It is simple and self-contained, but this will at least get you started on your way to wrapping the API menu functions in VB classes. I can already see I will be expanding this class, since getting this far was actually quite easy. The ultimate goal would be to "InsertMenuItem"s not just in a popup, but in the menu bar of the parent mdi form as well. I'll repost the class when I've taken it that far. (just updated to include .ItemEnabled property for the popup menu)
This is an add-in for VB 6 (theoretically should compile in VB5 but not tested) that provides a simple way for you to zip up your project files. I invented this add-in over a year ago now for one sole reason. As a single developer working on multiple projects, I want only 1 copy of my code in source safe... period. No shares. I want to check a module out in one app... change it... and check it back in while working on a different app. I have implemented a standard directory structure and all of my project files use relative addressing for pulling in the other files. The beauty of this add-in is that you can do this, and when it comes time to (as I often do) update a remote code base, such as home, all I have to do is select the peices of the project I want to zip in the treeview, click the button, and presto... a zip file is generated preserving the directory structure and correctly pulling in files from the other directories. =) I decided to post this up here on PSC after reading a recent post by Clint LaFever regarding the issues that affect a lot of the posts here (source safe files, workspace files, and other misc junk) when entire directories are just zipped up via Explorer. My apologies to the fellow who was whining about code people have uploaded here the other day, but while it DOES compile and it DOES work, =) it's ugly as sin. =) I'm sure there's a couple modules in there from the guys over vbAccelerator.com (I believe I left their header files in tact). So if you need a tool to help you when creating zip files of code, then download and compile this add-in. =) Particularly, please, if you plan to upload code. =) A few notes on use: the add-in works together with your existing WinZip. If you don't have it, get it (winzip.com). Originally, I developed the add-in in Windows 98... and built in ZIP dll I found worked. I didn't have to integrate with WinZip until I tried using the add-in on Windows 2000. The dll blew up. So I have omitted it from this post since we can't post dlls anyways and because all I ever use is the external option (will eventually remove that checkbox altogether I guess). Anyways... when you do click on the Use External button, WinZip will launch. Click past the ShareWare screen, and then go back to the add-in and click the ZIP button. That's about it. If you do want to include the compiled version or the compiled compatibility version, just check the appropriate boxes. =)
O.K. This is the debut of both jeffButton and jeffSplitter. =) jeffButton is a custom control replacement for the VB command button. The enhancements it provides are: location of the caption, providing for the "soft button" effect, and most importantly, automatically creating disabled versions of your button icons... just like the standard vb toolbar. However, I must state now that the API calls I use to achieve this are newer, and probably won't work in Win95 and potentially early versions of Win98 and NT. Works fine on current Win98se, WinME, and Win2K. Anyways... the controls also demonstrates the mouse capturing API calls. The button control also supports hot and disabled icons if you so wish to provide them. =) Addditionally, this project post also exhibits my custom splitter control. I think, at the least, you will find my approach unique. Again, this control demonstrates the mouse capturing API calls. You can set the splitter's orientation, and bounds. And event fires every time the bar moves, allowing you to custom resize controls at will... which is what I like to do. Most implementations I have seen of splitter controls that automatically resize controls for you aren't very complicated, or else they end up adding a lot of overhead. jeffSplitter is simply and based on Edanmo's VB5 ocx splitter controls which provide the splitter but allow you the flexability to implement your own resize techniques (useful when a frame or toolbar is resized in the same section along with a grid or treeview). =) Anyways... hope you guys enjoy my latest offering. I cut with my previous policy of distinguishing between public and private code on this project, so additionally, any of you code hounds out there will also find in this project a rich library of base vb functions and API function definitions and constants in the two files: tools6.bas and mapiconstants.bas. =) I use this module base in both work and recreation projects. If you like it or the latest controls, please gimme a vote. ;) (it don't take long to vote, honest)
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.
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
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.
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). =)
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.
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.
OK... not looking to blow away the world with this one, but felt lead to make the post after reading this article. http://www.planet-source-code.com/vb/scripts/showcode.asp?txtCodeId=26999&lngWId=1 At work, I have an app that is an mdi based program... and while the sub forms don't need a menu bar of their own, they do need popup context menus. Since adding even an invisible menu to a mdichild form will cause it to over write the parent mdi's menu bar, I needed a way to create menus for the child forms on the fly. This simple class demonstrates using the API calls to create a popup menu, display it, and return the item that was clicked (if any). It is simple and self-contained, but this will at least get you started on your way to wrapping the API menu functions in VB classes. I can already see I will be expanding this class, since getting this far was actually quite easy. The ultimate goal would be to "InsertMenuItem"s not just in a popup, but in the menu bar of the parent mdi form as well. I'll repost the class when I've taken it that far. (just updated to include .ItemEnabled property for the popup menu)
This is an add-in for VB 6 (theoretically should compile in VB5 but not tested) that provides a simple way for you to zip up your project files. I invented this add-in over a year ago now for one sole reason. As a single developer working on multiple projects, I want only 1 copy of my code in source safe... period. No shares. I want to check a module out in one app... change it... and check it back in while working on a different app. I have implemented a standard directory structure and all of my project files use relative addressing for pulling in the other files. The beauty of this add-in is that you can do this, and when it comes time to (as I often do) update a remote code base, such as home, all I have to do is select the peices of the project I want to zip in the treeview, click the button, and presto... a zip file is generated preserving the directory structure and correctly pulling in files from the other directories. =) I decided to post this up here on PSC after reading a recent post by Clint LaFever regarding the issues that affect a lot of the posts here (source safe files, workspace files, and other misc junk) when entire directories are just zipped up via Explorer. My apologies to the fellow who was whining about code people have uploaded here the other day, but while it DOES compile and it DOES work, =) it's ugly as sin. =) I'm sure there's a couple modules in there from the guys over vbAccelerator.com (I believe I left their header files in tact). So if you need a tool to help you when creating zip files of code, then download and compile this add-in. =) Particularly, please, if you plan to upload code. =) A few notes on use: the add-in works together with your existing WinZip. If you don't have it, get it (winzip.com). Originally, I developed the add-in in Windows 98... and built in ZIP dll I found worked. I didn't have to integrate with WinZip until I tried using the add-in on Windows 2000. The dll blew up. So I have omitted it from this post since we can't post dlls anyways and because all I ever use is the external option (will eventually remove that checkbox altogether I guess). Anyways... when you do click on the Use External button, WinZip will launch. Click past the ShareWare screen, and then go back to the add-in and click the ZIP button. That's about it. If you do want to include the compiled version or the compiled compatibility version, just check the appropriate boxes. =)
O.K. This is the debut of both jeffButton and jeffSplitter. =) jeffButton is a custom control replacement for the VB command button. The enhancements it provides are: location of the caption, providing for the "soft button" effect, and most importantly, automatically creating disabled versions of your button icons... just like the standard vb toolbar. However, I must state now that the API calls I use to achieve this are newer, and probably won't work in Win95 and potentially early versions of Win98 and NT. Works fine on current Win98se, WinME, and Win2K. Anyways... the controls also demonstrates the mouse capturing API calls. The button control also supports hot and disabled icons if you so wish to provide them. =) Addditionally, this project post also exhibits my custom splitter control. I think, at the least, you will find my approach unique. Again, this control demonstrates the mouse capturing API calls. You can set the splitter's orientation, and bounds. And event fires every time the bar moves, allowing you to custom resize controls at will... which is what I like to do. Most implementations I have seen of splitter controls that automatically resize controls for you aren't very complicated, or else they end up adding a lot of overhead. jeffSplitter is simply and based on Edanmo's VB5 ocx splitter controls which provide the splitter but allow you the flexability to implement your own resize techniques (useful when a frame or toolbar is resized in the same section along with a grid or treeview). =) Anyways... hope you guys enjoy my latest offering. I cut with my previous policy of distinguishing between public and private code on this project, so additionally, any of you code hounds out there will also find in this project a rich library of base vb functions and API function definitions and constants in the two files: tools6.bas and mapiconstants.bas. =) I use this module base in both work and recreation projects. If you like it or the latest controls, please gimme a vote. ;) (it don't take long to vote, honest)