MilesAhead Posted October 11, 2008 Posted October 11, 2008 I wrote an ActiveX Control several years ago to do standard Windows MessageBox type Dialogs with custom background colors and drawing styles. Unfortunately the optional Help Button doesn't fire the event properly in interpreters but you can still use the control to provide an unusual but consistent look to your dialogs with various programming languages. It should work with interpreters that support COM such as AutoIt3 and PythonWin. I've been using it quite a bit with compiled languages such as VC++ 6, VB 6, C# and Delphi 5 and I think I've gotten all the bugs out of it over the years. Anyway you can mess around with it for free if you like. Here's an example script to display a few dialogs from AutoIt3. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: MilesAhead Script Function: simple example usage of GradDlgX ActiveX Control Install Control: download Faves Trial from http://www.favessoft.com/favestrial.zip and run the setup program. Uninstall: Uninstall Faves using Add/Remove Programs Docs: You can download a rudimentary .chm file from http://www.favessoft.com/GradDlgHelp.zip Note 1 : if you don't want to use Faves you can try installing it twice, then uninstall it. This may leave the ActiveX Control on your system registered(may or may not work but I seem to remember doing it successfully.) To remove manually run regsvr32 /u GradDlgXControl1.ocx from an administrative command prompt in your system directory (usually it's C:\Windows\system32) Note 2 : I removed the design-time license from the ActiveX Control partly so that it can be created dynamically by interpreters that support COM. Since the control is now unprotected I figured I might as well make it available. Note that if you have Faves Free installed on your system it uses the GradDlg ActiveX Control with the license. So you want to uninstall it before installing the Faves Trial. (After you uninstall double check it removed the .ocx from the system folder.) Note 3 : When plugging color1 and color2 into the control for the Execute() method, many times you will get mud, but there are probably a dozen or more color combinations that look really cool. It's just an algorithm I came up with when messing around with user draw for message dialogs. I used the same algorithm for the backgroud of this utility: http://www.favessoft.com/FileCRC32Shot.html just to give you an idea. #ce ---------------------------------------------------------------------------- $grad = ObjCreate("GradDlgXControl1.GradDlgX") $grad.GradStyle = 1; use 0 for metalic gradient look ;background colors light pink and white $grad.Color1 = 0xC186FF $grad.Color2 = 0xFFFFFF ;red font $grad.FontColor = 0x0000FF ;draw horizontally $grad.GradDirect = 1 ;using GradDlg Execute function where you can customize ;background and font colors. Canned dialogs are provided ;with set color schemes but Execute lets you experiment $grad.Execute("This is Execute!",0,-1) ;always use -1 as help context(last param) with interpreters since ;the event won't fire until after the dialog closes. With compiled ;languages;such as VC++,Delphi,VC,C# pressing the Help button on the ;dialog will fire an event with help context as param while the dialog ;is still showing. An easy handler would be to use ShellExecute ;to open a readme file or you can even nest invocations of GradDlg ;dialog boxes. The dialogs are independent of each other but read ;properties from the base control so it's advised to save and restore ;to and from local vars if you change properties of the ActiveX Control. ;like MsgBox, if you have CRLFs in the message text, the dialog will expand ;to accommodate the message. If $grad.ConfirmDlg("Sure you want to do this?", True, 1, -1) = 1 Then $grad.InfoDlg("You Pressed OK", True, 0, -1) EndIf $grad.ErrorDlg("Example Error Message!",True,1,-1) $grad.WarnDlg("Warning: Example Warning Message!",True,1,-1) $grad = 0 My Freeware Page
MilesAhead Posted January 8, 2009 Author Posted January 8, 2009 (edited) I updated the Help Filefor this control. The zip file has a small AutoIt example script showing how to seta few of the dialog styles. The last param of every dialog display method shouldbe -1 so that no Help Button will be displayed in the dialog. The help button eventswork in true compiled languages but are of no use in AutoIt.Still if you mess around you can create some interesting background color schemes.Plus you can easily give the same look to message box dialogs if you are codingin VB, VC++ .. C# Delphi AutoIt or ActivePython for Windows etc..Hope somebody enjoys using it. I've been messing around with it for 7 years orso. edit: btw I included the .ocx in the just updated help zip file with instructions to install it directly Edited January 8, 2009 by MilesAhead My Freeware Page
yehia Posted January 8, 2009 Posted January 8, 2009 gave me an error line 42 $grad.GradStyle = 1 var must be of type "object" My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine
MilesAhead Posted January 8, 2009 Author Posted January 8, 2009 yehia said: gave me an error line 42$grad.GradStyle = 1var must be of type "object"One line of code is useless.Please post code where you successfully dynamically create the object,then get an error. My Freeware Page
yehia Posted January 8, 2009 Posted January 8, 2009 sry was mistaken nice one really My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine
cowmoo Posted January 8, 2009 Posted January 8, 2009 It would be nice if it wouldn't require to install that.
MilesAhead Posted January 8, 2009 Author Posted January 8, 2009 yehia said: sry was mistaken nice one reallyThat's ok. After I posted I figured it's prolly just ObjCreate() got an error.The Gradient style will work with just about anything. The stlAverage issomething I found sort of by accident while messing with a Paint handler.I just added the colors and shifted bits around until I got some that lookedgood. There's probably only a couple of dozen really cool ones that come out.On my site there's FileCRC32 checksum program that you can use as a sort ofquick and dirty trial of the colors. If you change the colors in the .ini file andrestart it paints using those. Unfortunately there are a bunch of combinationsthat come up mud and many end up some flavor of purple. But there's a fewnuggets if you mess around with it. My Freeware Page
MilesAhead Posted January 8, 2009 Author Posted January 8, 2009 cowmoo said: It would be nice if it wouldn't require to install that.I know what you mean. When I do a Delphi program I just use the control. But to use with other languages you need the ActiveX. Actually the install and uninstall is pretty easy with Inno Setup. I took the design time licensing off since C# express was a pita about installing in the toolbox. It seems to install in C# ok in XP but Visual Studio Express 2008 didn't like Vista last time I tried installing the IDE.There are some properties that are stored in the control. I did that to reduce the number of params in the dialg calls. Some of them do need to be saved and restored across calls. But the nice thing about the design is that the dialog is created dynamically. So the handler for the Help Button can even be another dialog from the control. I'm working on a small C# demo since that's a free IDE that at least works in XP. It will show using both the TellTail one instance control, and the dialog control.The gradient paint uses straight Jedi VCL Gradient line drawing code. Maybe in a bit I'll release the Delphi source for the stlAverage paint.I'll be uploading the help zip again soon and it will have the C# demo if anyone does C#. With that I can show some of the event handling. My Freeware Page
ptrex Posted January 9, 2009 Posted January 9, 2009 @MilesAheadNo need for installing any ActiveX DLL if you use the MS SxS Manifest approachRegardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
MilesAhead Posted January 9, 2009 Author Posted January 9, 2009 (edited) ptrex said: @MilesAheadNo need for installing any ActiveX DLL if you use the MS SxS Manifest approachRegardsptrexThat may be valuable if you have code that is >=XP only. My .ocx controlswork on Win98 on up so there'd really be no value in my doing that. Copying the .ocx and registering it, unregistering and deleting, are taken careof quite easily using Inno Setup. One line in the Files section for each .ocx does it.The .exe generated by Inno Setup is a vanilla 32 bit exe program so that spansWin98 on up too at least for 32 bit stuff.If you really don't like doing an installer you can always call the DllRegisterServer()functions with your code.As it is, my controls are of limited utility in AutoIt and Python anyway. Just thoughtsome of the programmers here may dabble in other languages with IDEs where they'dbe more useful. They were more fun before MS messed up Visual Studio. In VB 6and VC++ 6 Dialog editors the GradDlg control had a custom property page witha color picker dialog to set the colors and built in help. Press F1 when it had thefocus in the dialog editor and .hlp help came up. Somewhere along the wayMS broke all that support. Oh well, at least the code works in VS2008 edit: apparently the property page still works in this control.If in Visual Studio after you drop on the form if you right clickand select Properties the form will come up. If you click onone of the color buttons the color picker dialog comes up.I don't have the help with it since it's old style .hlp. Justuse the .chm help from the zip file. Edited January 9, 2009 by MilesAhead My Freeware Page
ptrex Posted January 10, 2009 Posted January 10, 2009 @MilesAhead Quote My .ocx controlswork on Win98 on up so there'd really be no value in my doing that.I am sorry to say that MS SxS has nothing to do with coding ?!Only a way of distributing DLL / OCX files without registring them.You don't have to change a comma in your code to do that.Regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
MilesAhead Posted January 10, 2009 Author Posted January 10, 2009 ptrex said: @MilesAheadI am sorry to say that MS SxS has nothing to do with coding ?!Only a way of distributing DLL / OCX files without registring them.You don't have to change a comma in your code to do that.Regards,ptrexSo download it and do it. Why are you waiting on me? My Freeware Page
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now