BPSoftware.com
Home   Utilities   Purchase   FAQ   Support   Contact        
Shareware Utilities
 APrintDirect
 AIconExtract
 AFile Attribute Manager
Freeware Utilities
 AddrMon
 AFileSync
 ASysIcon
 B&P Table Utilities
 BPACLer
 BPSNMPMon
 BPSNMPUtil
 CharCount
 Delphi® Components
 MacAddr
Miscellaneous
 BPSoftware Blog
 Purchase Shareware
 Support

 


Thursday, December 29, 2005
Plug Me In

Recently I had an interesting conversation with someone regarding plug-ins and the custom expansion of application features. Plug-ins basically allow for the extension of an application to allow for additional features and functionality. One place that I have often utilized pseudo-plug-ins is for custom reports.
I found that having a ‘custom report directory’ where option forms with reports in dlls can be dropped works out well. An application can scan the directory for valid reports to list in some sort of report menu. A simplified version of loading a form is as follows:

In the main app:
type
DisplayFormDLL = function (reportdir:pchar): integer;stdcall;

var
h: THandle;
displayform: DisplayFormDLL;
libfilename: string;
result: integer;
begin
libfilename:= 'thedll.dll';
h := LoadLibrary(PChar(libfilename));
if h <> 0 then
try
@displayform := GetProcAddress(h,'DisplayForm');
if @displayform <> nil then
result:= displayform('New Caption');
finally
FreeLibrary(h);
end;
end;

In the DLL:
//Uses
//ActiveX;

function DisplayForm(mycaption:PChar):integer;stdcall;
begin
//CoInitialize(nil);
Form2:= TForm2.Create(nil);
try
Form2.Caption:= mycaption;
Result := Form2.ShowModal;
finally
Form2.Free;
//CoUninitialize;
end;
end;


Exports
DisplayForm;


If you want to use MDIChildren form it is more complicated, unless you use Runtime packages, then the above works well.

Labels: , ,

posted by Brad Prendergast at 9:57:00 AM (2 comments)
Links to this post
Permalink
Tuesday, December 27, 2005
Feed Me

Really Simple Syndication (RSS) was a nice advancement of technology. The ability to ‘subscribe’ to feeds and dynamically have access to content definitely simplifies keeping up to date with different sites. Sites that have a RSS feed available typically display or with a link to the site feed.

There are many different RSS clients available for the viewing or monitoring RSS feeds. I have been using Mozilla Firefox® for a web browser since its inception. There is a lot to be said about tabbed browsing, but the Live Bookmarks take it over the top and they are a great way monitor RSS feeds. The ability to monitor feeds from within a browser and without the need to install yet another application is wonderful.

Borland® has set up a number of feeds for their products and sites, the ones that I set up Live Bookmarks for are:
Borland® Delphi® BDN - http://news.borland.com/bdn_delphi.xml
Borland® Delphi® Code Central - http://news.borland.com/codecentral_delphi.xml
Borland® Delphi® Quality Central - http://news.borland.com/qualitycentral_delphi.xml
Delphi® Team Blogs - http://blogs.borland.com/MainFeed.aspx?Team=delphi

Some other feeds of note that I monitor (I won’t bore you with all of them):

Delphi related -
http://www.delphifeeds.com/blogs.rss
http://blog.marcocantu.com/blog_rss.xmldata
http://www.indyproject.org/Sockets/blogs/Kudzu/rss.xml

Non-Delphi-
http://www.infoworld.com/rss/news.xml
http://www.computerworld.com/news/xml/10/0,5009,,00.xml
http://feeds.lockergnome.com/rss/windows.xml
http://slashdot.org/index.rss
http://www.techweb.com/rss/all.jhtml
http://rss.news.yahoo.com/rss/tech

If you have any suggestions for additional feeds please let me know.

Labels: , ,

posted by Brad Prendergast at 6:47:00 PM (0 comments)
Links to this post
Permalink
Saturday, December 24, 2005
Santa Did Come

After ordering ‘early’ and being placed on the backorder list, I received a special delivery this week. I guess the elves worked overtime this year. I haven’t had much opportunity to play with the addition to the desktop, however what I have played with so far it is leaps and bounds above its predecessor. Why didn’t they change the icon?

Labels: , ,

posted by Brad Prendergast at 8:03:00 AM (0 comments)
Links to this post
Permalink
Thursday, December 22, 2005
Resource Basket

I haven’t the foggiest idea why, but ‘A Tisket a Tasket a resource in a basket’ is echoing through my head.
December is usually a pretty hectic month. The period between Thanksgiving and Christmas leaves little time to do anything more than the bare minimum a.k.a. only what is absolutely necessary. Over the past week I had the opportunity to delve into resources a bit. Fortunately, I am not talking system resources, rather the additional files that are compiled into executables and libraries. To be more specific, my venture was initiated by cursors. As usual I’ll try to keep this brief, to the point and intuitive.
For those that are unaware, Cursors and Icons are basically the same type of files. The IconInfo structure contains the information about icons and cursors. The difference between the two is so slight that most of the time you can get away with renaming the .ico to .cur and vice versa. Within Delphi® you can easily extract an icon or cursor resource from a file and reference it with a TIcon Class.
The TIcon Class has a nice SaveToFile method that will allow you to save your extracted resource as its own file. This works fine, well, most of the time. Occasionally I noticed that I would get a ‘Bitmap is invalid error’. I had Google’d the newsgroups to see if anyone else had shared this mind numbing experience. I did find a few threads, however I didn’t come across any that discussed a solution or work around.
After pulling what I have left of my hair out I noticed a trend. I would consistently get this error with black and white (monochrome) cursors. Color cursors seemed to save properly. I loaded up and viewed the IconInfo. hbmMask and IconInfo. hbmColor bitmaps in a TImage and they looked valid. My next idea was to create a new cursor IconInfo and fill it with the IconInfo for the cursor that I had retrieved with the GetIconInfo function. I then created a TIcon with that information and then saved that to a file. To my pleasure it worked like a charm.
This is the quick function that I had come up with:

var
iconwidth, iconheight : integer;
iconinfo: TIconInfo;
bmpColor,
bmpMask: TBitmap;
TransparentColor: TColor;
tempicon: TIcon;
begin
bmpColor:= TBitmap.Create;
bmpMask:= TBitmap.Create;
tempicon:= TIcon.Create;
try
iconwidth:= GetSystemMetrics(SM_CXICON);
iconheight:= GetSystemMetrics(SM_CYICON);

bmpColor.Width:= iconwidth;
bmpColor.Height:= iconheight;
// DrawIconEx(bmpColor.Canvas.Handle,0,0,icon.Handle,0,0,0,0,DI_IMAGE);
DrawIconEx(bmpColor.Canvas.Handle,0,0,icon.Handle,0,0,0,0,DI_NORMAL);

bmpMask.Width:= iconwidth;
bmpMask.Height:= iconheight;
DrawIconEx(bmpMask.Canvas.Handle,0,0,icon.Handle,0,0,0,0,DI_MASK);

GetIconInfo(icon.Handle, iconinfo);
iconinfo.fIcon:= isIcon;
iconinfo.hbmMask:= bmpMask.MaskHandle;
iconinfo.hbmColor:= bmpColor.Handle;
tempicon.Handle:= CreateIconIndirect(iconinfo);
tempicon.SaveToFile(filename);
DestroyIcon(tempicon.Handle);
DeleteObject(iconinfo.hbmMask);
DeleteObject(iconinfo.hbmColor);
finally
tempicon.Free;
bmpMask.Free;
bmpColor.Free;
end;
end;


Of course, this can be improved (formatting and code wise, does anyone know of a good Delphi® html formatter? I tend to lose my formatting when I post these); in fact I did something like this in the latest update of AIconExtract. The latest version includes cursor resources. Who, knows one day I may one day add the ability to edit resources....

Labels: , ,

posted by Brad Prendergast at 5:17:00 AM (1 comments)
Links to this post
Permalink
Friday, December 09, 2005
Where’s my briefcase? (Part 2)

In Part 1 I discussed how you can use a ‘Briefcase’ to synchronize files with a storage device. If you are running Windows® XP Professional you have another option for synchronizing your files. This feature is appropriately named ‘Offline Files’. Offline files are primarily geared towards network file synchronization with you local storage. This is ideal for laptop users who travel and need to work as if they were in the office.

I have used both Briefcase and Offline Files extensively and overall, I prefer the briefcase method. One huge benefit of offline files is that this can be set for automatic synchronization. Sort of ‘set it and forget it’ type thingamajig. One additional thing to note about offline files is that this can be managed via Group Policy so a network administrator may disallow their use or preset the options.

I had intended on writing the steps for enabling offline files but I found a nice link that perfectly describes the process; making it a whole lot easier for me. Click HERE for the steps.

Labels: , ,

posted by Brad Prendergast at 10:12:00 PM (0 comments)
Links to this post
Permalink
Thursday, December 08, 2005
Did you say TitleCase?

Well, I came to inherit a bunch of malformed (malformatted if it were a word) phrases (strings). These phrases were a mix of lower and uppercase letters, with the latter being predominant. I for one can not stand all UPPERCASE text and strive to achieve some sort of aesthetically appealing display. IMHO. the usage of these phrases is best suited by a TitleCase format. Briefly, for those that do not know what TitleCase is, it is basically the capitalization of the first letter of each word in a phrase or sentence.

I threw together two functions (one for WIN32 and the other for .NET) to satisfy my short-term need to convert a phrase to TitleCase.

{Version for .NET}
uses
System.Globalization;

function MyTitleCase(const thetext: string): string;
var
gbCulture: System.Globalization.CultureInfo;
gbTextInfo: System.Globalization.TextInfo;
begin
gbCulture:= CultureInfo.Create('en-US');
gbTextInfo:= gbCulture.TextInfo;
Result:= gbTextInfo.ToLower(thetext);
Result:= gbTextInfo.ToTitleCase(Result);
end;


{Version for WIN32}
function MyTitleCase (const s: string):string;
var
flag: Boolean;
i: integer;
begin
flag:= True;
for i := 1 to Length(s) do
begin
if flag then
AppendStr(Result, UpperCase(s[i]))
else
AppendStr(Result, LowerCase(s[i]));
flag := (s[i] = ' ');
end;
end;

Labels: , , ,

posted by Brad Prendergast at 8:07:00 PM (0 comments)
Links to this post
Permalink
Tuesday, December 06, 2005
Where’s my briefcase? (Part I)

In this hectic world of ours one may find themselves frequently traveling from place to place. With computers an integral part of every day life, how do you work with your files while you’re away from your main workstation? Do you simply copy and replace them when you return? What if you need to do this often? What if there are many files edited, added and/or deleted?

Fortunately there are two quick ways to accomplish this sort of thing built right into Microsoft® Windows®. You have a choice of a Briefcase or using Offline files. Both of these options allow you to synchronize your files with copies on another storage device. You can edit either version and synchronize them bringing the contents in sync. This is also a nice method of a sort of quasi-backup of your beloved files. The USB flash drives are perfect for offline storage. They are compact and capable of holding large amounts of data. I personally use Briefcase with my 1GB SanDisk Cruzer mini.

The creation of a Briefcase is fairly simple. Open up Windows® Explorer and browse to the location where you would like to store you briefcase (this is where your synchronized copy will be kept, not the original location). After browsing to the desired location select File --> New --> Briefcase from the menu items. A new briefcase object will appear on your device. Rename the newly created briefcase to something meaningful or appropriate. .Next find the files/folders that you would like to keep synchronized. Select those objects and copy them. Browse to your newly create briefcase and copy these files/folders inside. Tada! This is pretty much all that is necessary to set up your files for synchronization.

Once you have a briefcase set up you can take your storage device with you and work on your files while you are away. When you return to your main workstation you simply need to synchronize your files. To synchronize your files open up your briefcase and select Briefcase --> Update All from the main menu. A dialog will appear showing you the changes that are about to take place. You can keep the results as is, or change the direction of synchronization or even skip synchronization changes.

At first glance, to some, this may seem complicated. However, once you start using briefcases (yes, you can have multiple on one device for different locations, I use many. I even have one to synchronize my bookmarks on all the different computers that I use.) you’ll quickly become comfortable with them. They’re a great way to ensure you can access your files while you are away from you main workstation. It is also a nice way to keep a backup of those must have files.

Labels: , ,

posted by Brad Prendergast at 8:21:00 AM (0 comments)
Links to this post
Permalink
Recent Posts
 Command Line: Visual Source Safe
 SQL: Remove / Delete Orphan Users
 SQL Delete/Drop a User from each Database
 Is there an 'I' in phone?
 SQL Optimization: Am I missing any indexes? - Part...
 Meaningful Signature File Quotes
 My Shared RSS Items
 Edit those XML files
 A little System.Diagnostics
 Wi-Fi Detector Shirt


Labels



Archives
 October 2005
 November 2005
 December 2005
 January 2006
 February 2006
 March 2006
 April 2006
 May 2006
 June 2006
 July 2006
 August 2006
 September 2006
 December 2006
 January 2007
 February 2007
 March 2007
 September 2007
 October 2007
 November 2007
 July 2008
 November 2008
Powered by Blogger