Author Topic: "Of The Bay" Version 2.00  (Read 48567 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" (Official logo + OTB icon + minor changes)
« Reply #30 on: November 15, 2008, 07:44:56 PM »
Updated to version 1.23
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Emil Weiss

  • Guest
Re: "Of The Bay" (Official logo + OTB icon + minor changes)
« Reply #31 on: November 15, 2008, 09:04:34 PM »
Updated to version 1.23
fantastic work Patrice i love it..
one problem i have found ;)
Dialog too deep

should be over the Bar.

greets Emil
« Last Edit: November 15, 2008, 09:10:10 PM by Emil Weiss »

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
Re: "Of The Bay"
« Reply #32 on: November 15, 2008, 10:26:21 PM »
Quote
should be over the Bar.
That's another difference between XP and VISTA, i shall fix it in the next build.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" version 1.24 (Center common dialog in multiple display mode)
« Reply #33 on: November 16, 2008, 07:23:54 PM »
I have been able to work arround the Microsoft bug that exists in all Windows version, when trying to set the location of a common FileOpen/FileSave dialog on a second monitor in multiple display mode.

You can't imagine what i had to do to solve this "simple" problem ...

By the way i have also added a new GDImage function named "ZI_CenterDialog" to center the dialog to the display instead of the default GDImage's parent window.

If ever you have a multiple display and a slower PC than mine, you can adjust in the main WndProc the dlgSleep parameter to a longer delay (millisecond), see below:
Code: [Select]
'   // This is to force a correct placement of the FileOpen/FileSave common dialog
'   // when using multiple display mode and working on the second display.
    STATIC dlgWnd, dlgX, dlgY AS LONG, dlgSleep AS DWORD
    IF dlgWnd THEN
       IF GetTickCount() > dlgSleep THEN
          CALL SetWindowPos(dlgWnd, dlgWnd, dlgX, dlgY, 0, 0, %SWP_NOZORDER OR %SWP_NOSIZE)
          dlgWnd = 0: dlgSleep = 0
       END IF
    END IF

    SELECT CASE LONG Msg

    CASE %ZM_CENTER_DIALOG
         dlgWnd = wParam: dlgX = LO(INTEGER, lParam): dlgY = HI(INTEGER, lParam)
         dlgSleep = GetTickCount() + 10 ' 100
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" version 1.25 (WindowAnimate + new text location)
« Reply #34 on: November 17, 2008, 08:42:59 PM »
Updated to version 1.25

With new open/close WindowAnimate effect, and new icon text location.

By the way, did you see that somebody is sitting on the dock  ;D

...
 
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
Re: "Of The Bay"
« Reply #35 on: November 18, 2008, 07:16:49 PM »
For those experiencing Doctor Watson on XP when closing "OfTheBay" using the AnimateWindow

Try changing
Code: [Select]
         CASE %IDM_CLOSE ' %ID_CLOSE
              CALL AnimateWindow(hWnd, 500, %AW_CENTER OR %AW_HIDE)
              CALL SendMessage(hWnd, %WM_CLOSE, 0, 0)

to this
Code: [Select]
         CASE %IDM_CLOSE ' %ID_CLOSE
              CALL AnimateWindow(hWnd, 500, %AW_CENTER OR %AW_HIDE)
              CALL apiSleep(500)
              CALL PostMessage(hWnd, %WM_CLOSE, 0, 0)

Other solution "move on to VISTA"... or remove AnimateWindow ;)
« Last Edit: November 18, 2008, 07:19:26 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" version 1.30 (major revision)
« Reply #36 on: November 19, 2008, 08:00:43 PM »
Version 1.30 is a major revision.

  • The DockBar doesn't use anymore the WS_EX_TOPMOST style, to be less invasive.
  • If the DockBar is dropped behind the taskbar, then it is moved just above it, to always enable the use of the popup contextual popup menu.
  • If the Dockbar is hidden behind another window, clicking anywhere on the desktop will bring it up in the foreground.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Emil Weiss

  • Guest
Re: "Of The Bay"
« Reply #37 on: November 20, 2008, 05:24:36 AM »
you are a hard working Developer
thanks for the update patrice...

nothing crash here on XP when close the Bar ;)
all work fine now.

nice Effect :)

greets Emil
« Last Edit: November 20, 2008, 05:27:27 AM by Emil Weiss »

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
Re: "Of The Bay"
« Reply #38 on: November 20, 2008, 09:08:36 AM »
Emil,

Thank you for the feedback.

Next step i plan to add the hability to customize the dockbar with a shorcut list (kind of playlist) on the same model i have done for the *.zsk file but with the *.OTB extension.

In this OTB file you will be able to specify the icon you want to use, either 32x32 or 48x48, and the shorcut properties.
If there is already an existing shortcut (same target) then the OTB properties will take preseance.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
Version 1.50 - Another major revision with full customization (OTB file).
« Reply #39 on: November 20, 2008, 09:25:29 PM »
This one is another big step forward with the introduction of the "OfTheBay.OTB" file, that allows you to fully customize the dockbar.

OfTheBay.OTB is a plain ASCII text file that looks like this:

Code: [Select]
'+--------------------------------------------------------------------------+
'|                               Of The Bay                                 |
'|                                                                          |
'|                         User shorcut definition                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                                                                          |
'|                         Author Patrice TERRIER                           |
'|                            copyright(c) 2008                             |
'|                           www.zapsolution.com                            |
'|                         support@zapsolution.com                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                  Project started on : 11-20-2008 (MM-DD-YYYY)            |
'|                        Last revised : 11-20-2008 (MM-DD-YYYY)            |
'+--------------------------------------------------------------------------+

'Use @PATH@ to match either the OfTheBay.EXE path or the ShellTo target path

'Icon:
'Use either 32x32 or larger (will be converted to 48x48)
'in case of 32x32 the program adds the active icon background else not.

'"ShellTo, UseLabel, IconName, WorkDir, CmdLine"

'"C:\travail\sdk\template\BassBox24\BassBox.exe, BassBox24, @PATH@UserIcon\Solid edge.png,     @PATH@,  "
"C:\travail\sdk\template\BassBox24\BassBox.exe, BassBox24, @PATH@UserIcon\Woofer256x256.png,   @PATH@,  "
"C:\travail\sdk\template\MovieBox2\MovieBox.exe, MovieBox, @PATH@UserIcon\MovieProjector.png,  @PATH@,  "


Each line defines a specific shortcut with five parameters:
1 - "ShellTo" is the shorcut target.
2 - "UseLabel" is the name to display below the icon.
3 - "IconName" is the full path name to the image you want to use as icon (any supported graphic format).
4 - "WorkDir" is the working directory to use for the shortcut, @PATH@ means use EXE's folder.
5 - "CmdLine" an optional command line to pass to the shortcut.

About the image being used to create the icon, PNG is the best format because it has built-in alpha channel.
You can use image of any size, but the rule is:
IF the size of the image is larger than 32x32 then
   it will be resized to 48x48 and shown without the icon frame background.
ELSE IF the size is 32x32 then
   it will be drawn the standard way with a frame background.

The program allows you to redefine a shorcut that already exists on the Windows desktop, then it will use the parameters of the OTB file.

NOTE: Better to put all the image you want to use into a dedicated folder, i am using myself a subfolder named: UserIcon

Here is an example of the result you can get:



As you can see, i have replaced both the "BassBox" and "MovieBox" icon with larger one, that are stored in the "UserIcon" folder.

The OTB file could also be used as "super menu" to navigate between the different popup windows of a large project.

That's all for now.

...
 
 
« Last Edit: November 21, 2008, 08:26:50 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" has a new menu option to change the desktop wallpaper
« Reply #40 on: November 21, 2008, 07:12:28 PM »
Under request of Emil Weiss,

I have added a new menu option to change the desktop wallpaper.

The background image will be resized to match the primary desktop size, while preserving the ratio aspect of the original picture.

Added:
The Wallpaper icon was missing from the zip file, it has been added to the resource folder.

...

« Last Edit: November 21, 2008, 07:21:03 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
Re: "Of The Bay"
« Reply #41 on: November 22, 2008, 11:25:38 AM »
While working on the problem to center a common DIALOG OPEN/SAVE on multiple display,
i found that the best solution to detect the size of the monitor hover by the hMainWindow application is to use this code:

Code: [Select]
LOCAL hMonitor AS LONG, tmi AS MONITORINFO
hMonitor = MonitorFromWindow(hMainWindow, %MONITOR_DEFAULTTONEAREST)
tmi.cbSize = SIZEOF(tmi)
IF GetMonitorInfo(hMonitor, tmi) THEN
   msgbox str$(tmi.rcWork.nLeft)+str$(tmi.rcWork.nRight)+str$(tmi.rcWork.nTop)+str$(tmi.rcWork.nBottom)
END IF
« Last Edit: November 22, 2008, 11:27:37 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" version 1.54 (with custom icon set)
« Reply #42 on: November 23, 2008, 03:09:11 PM »
Updated to version 1.54

This one allows you to substitute your own icon set, to replace the default extracted from the shorcut targets.

Note: My custom icon set is stored in the "UserIcon" subfolder.

To use a custom icon set, you must have a valid OTB file in the same folder than "OfTheBay.exe", and it must be named "OfTheBay.OTB".

Here is an example of OTB file, that must be customized according to your own shortcuts:

Code: [Select]
'+--------------------------------------------------------------------------+
'|                               Of The Bay                                 |
'|                                                                          |
'|                         User shorcut definition                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                                                                          |
'|                         Author Patrice TERRIER                           |
'|                            copyright(c) 2008                             |
'|                           www.zapsolution.com                            |
'|                         support@zapsolution.com                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                  Project started on : 11-20-2008 (MM-DD-YYYY)            |
'|                        Last revised : 11-20-2008 (MM-DD-YYYY)            |
'+--------------------------------------------------------------------------+

'Use @PATH@ to match either the OfTheBay.EXE path or the ShellTo target path

'Icon:
'Use either 32x32 or larger (will be converted to 48x48)
'in case of 32x32 the program adds the active icon background else not.

'"ShellTo, UseLabel, IconName, WorkDir, CmdLine"

"Ordinateur, Ordinateur, @PATH@UserIcon\Computer_48x48.png, , "
"C:\program files\cc hyper file\cc120hf.exe, Centre de Contrôle HF, @PATH@UserIcon\Control_48x48.png, @PATH@, "
"C:\Program Files\Google\Picasa3\Picasa3.exe, Picasa 3, @PATH@UserIcon\Picasa48x48.png, @PATH@,  "
"D:\SED\SED_116.exe, PBWin9, @PATH@UserIcon\PowerBASIC_48x48.png, @PATH@, "
"D:\Disque_P\AssignDsk.bat, Promotech, @PATH@UserIcon\Param1_48x48.png,  D:\Disque_P,  "
"C:\Program Files\Phoenix\Bin\PHOENIX.EXE, Phoenix, @PATH@UserIcon\Phoenix_48x48.png, , "
"C:\travail\sdk\template\BassBox24\BassBox.exe, BassBox24, @PATH@UserIcon\Woofer48x48.png,   @PATH@,  "
"C:\Program Files\HP\QuickPlay\QP.exe, QuickPlay, @PATH@UserIcon\QuickPlay_48x48.png, @PATH@, "
"D:\wd11-us\programs\windev11.exe, WD11 US, @PATH@UserIcon\WD11_48x48.png, @PATH@, "
"C:\travail\sdk\template\MovieBox2\MovieBox.exe, MovieBox, @PATH@UserIcon\MovieProjector.png,  @PATH@,  "
"C:\windev 12\programmes\windev12.exe, WinDev 12, @PATH@UserIcon\WD12_48x48.png, @PATH@, "
"C:\program files\vahelp\vahelp73.exe, HelpMaker, @PATH@UserIcon\Vizacc_48x48.png, @PATH@, "
"C:\windev 12\zoleigest.bat, Z oleigest, @PATH@UserIcon\Run_48x48.png, @PATH@, "
"Corbeille, Corbeille, @PATH@UserIcon\Trash_48x48.png, , "
"C:\windows\installer\{e4ddba93-769b-49d8-ba33-8814e45ed0c1}\_40c4cb6f6690400fa04ba2.exe, HP Help and Support, @PATH@UserIcon\HP_48x48.png, C:\Windows\Help\OEM\scripts\, "
"C:\windev 10\programmes\windev10.exe, WinDev 10, @PATH@UserIcon\WD10_48x48.png, @PATH@, "
"C:\windev11\programmes\windev11.exe, WinDev 11, @PATH@UserIcon\WD11_48x48.png, @PATH@, "
"C:\WinDev 10\disquez.bat, Disque Z, @PATH@UserIcon\HD_48x48.png, C:\WinDev 10,  "
"C:\Windows\System32\cmd.exe, Prompt, @PATH@UserIcon\Prompt_48x48.png, C:\travail,  "
"Son - Raccourci, Son - Raccourci, @PATH@UserIcon\Sound_48x48.png, , "
"C:\Windows\installer\{5c82dae5-6eb0-4374-9254-be3319ba4e82}\skype.ico, Skype, @PATH@UserIcon\Skype_48x48.png, C:\Program Files\Skype\,  "
"C:\VS2005\zMoviePlayer\bin\Debug\zMoviePlayer.exe, zMoviePlayer, @PATH@UserIcon\MediaPlayer_48x48.png, @PATH@, " 
"C:\program files\acronis\trueimagehome\trueimage.exe, Acronis True Image Home 10.0, @PATH@UserIcon\Acronis_48x48.png, @PATH@, "
"C:\Program Files\FileZilla Client\filezilla.exe, FileZilla, @PATH@UserIcon\FileZilla_48x48.png, @PATH@, "
"C:\travail\PhotoComposer\PhotoCompo.exe, PhotoComposer, @PATH@UserIcon\PhotoComposer_48x48.png, @PATH@, "
"C:\program files\blender foundation\blender\blender.exe, Blender, @PATH@UserIcon\Blender_48x48.png, @PATH@, "
"C:\travail\sdk\template\goldfish\xpaero\ofthebay\ofthebay.exe, Of The Bay, @PATH@UserIcon\OTB_48x48.png, @PATH@, "
"D:\Photosetup\PhotoSetup.exe, PhotoSetup, @PATH@UserIcon\PhotoSetup48x48.png,  @PATH@,  "


And here is the result of the customization:



...
« Last Edit: November 23, 2008, 06:49:07 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
Re: "Of The Bay"
« Reply #43 on: November 27, 2008, 11:13:46 AM »
Version 1.55

A new parameter has been added to the OTB file:
'"ShellTo, UseLabel, IconName, WorkDir, CmdLine, EnableShortcutTrueFalse"

EnableShortcutTrueFalse = 0, means do not show this shortcut.
EnableShortcutTrueFalse = 1, means show this shortcut.
EnableShortcutTrueFalse = 2, means this shortcut refers to the "Recycle Bin"

"Recycle Bin" is a special shortcut case, because the icon can represent a full or empty recycle bin, thus you must provide two custom icons for it, and they must be named "RecycleBinEmpty.png" and "RecycleBinFull.png".

Example of version 1.55 custom OTB file:

Code: [Select]
'+--------------------------------------------------------------------------+
'|                               Of The Bay                                 |
'|                                                                          |
'|                         User shorcut definition                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                                                                          |
'|                         Author Patrice TERRIER                           |
'|                            copyright(c) 2008                             |
'|                           www.zapsolution.com                            |
'|                         support@zapsolution.com                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                  Project started on : 11-20-2008 (MM-DD-YYYY)            |
'|                        Last revised : 11-20-2008 (MM-DD-YYYY)            |
'+--------------------------------------------------------------------------+

'Use @PATH@ to match either the OfTheBay.EXE path or the ShellTo target path

'Icon:
'Use either 32x32 or larger (will be converted to 48x48)
'in case of 32x32 the program adds the active icon background else not.

'"ShellTo, UseLabel, IconName, WorkDir, CmdLine, EnableShortcutTrueFalse"
'EnableShortcutTrueFalse = 2 '// To inform OTB that this one refers to the "Recycle Bin"

"Ordinateur, Ordinateur, @PATH@UserIcon\48x48\Computer.png, , ,1"
"C:\program files\cc hyper file\cc120hf.exe, Centre de Contrôle HF, @PATH@UserIcon\48x48\Control.png, @PATH@, ,1"
"C:\Program Files\Google\Picasa3\Picasa3.exe, Picasa 3, @PATH@UserIcon\48x48\Picasa.png, @PATH@, ,1"
"D:\SED\SED_116.exe, PBWin9, @PATH@UserIcon\48x48\PowerBASIC.png, @PATH@, ,1"
"D:\Disque_P\AssignDsk.bat, Promotech, @PATH@UserIcon\48x48\Param1.png, @PATH@, ,1"
"C:\Program Files\Phoenix\Bin\PHOENIX.EXE, Phoenix, @PATH@UserIcon\48x48\Phoenix.png, , ,1"
"C:\travail\sdk\template\BassBox24\BassBox.exe, BassBox24, @PATH@UserIcon\48x48\Woofer.png, @PATH@, ,1"
"C:\Program Files\HP\QuickPlay\QP.exe, QuickPlay, @PATH@UserIcon\48x48\QuickPlay.png, @PATH@, ,1"
"D:\wd11-us\programs\windev11.exe, WD11 US, @PATH@UserIcon\48x48\WD11.png, @PATH@, ,1"
"C:\travail\sdk\template\MovieBox2\MovieBox.exe, MovieBox, @PATH@UserIcon\48x48\MovieProjector.png, @PATH@, ,1"
"C:\windev 12\programmes\windev12.exe, WinDev 12, @PATH@UserIcon\48x48\WD12.png, @PATH@, ,1"
"C:\program files\vahelp\vahelp73.exe, HelpMaker, @PATH@UserIcon\48x48\Vizacc.png, @PATH@, ,1"
"C:\windev 12\zoleigest.bat, Z oleigest, @PATH@UserIcon\48x48\Run.png, @PATH@, ,1"
"Corbeille, Corbeille, @PATH@UserIcon\48x48\RecycleBinEmpty.png, , ,2" '// This one refers to the "Recycle Bin"
"C:\windows\installer\{e4ddba93-769b-49d8-ba33-8814e45ed0c1}\_40c4cb6f6690400fa04ba2.exe, HP Help and Support, @PATH@UserIcon\48x48\HP.png, C:\Windows\Help\OEM\scripts\, ,1"
"C:\windev 10\programmes\windev10.exe, WinDev 10, @PATH@UserIcon\48x48\WD10.png, @PATH@, ,1"
"C:\windev11\programmes\windev11.exe, WinDev 11, @PATH@UserIcon\48x48\WD11.png, @PATH@, ,1"
"C:\WinDev 10\disquez.bat, Disque Z, @PATH@UserIcon\48x48\HD.png, C:\WinDev 10, ,1"
"C:\Windows\System32\cmd.exe, Prompt, @PATH@UserIcon\48x48\Prompt.png, C:\travail, ,1"
"Son - Raccourci, Son - Raccourci, @PATH@UserIcon\48x48\Sound.png, , ,1"
"C:\Windows\installer\{5c82dae5-6eb0-4374-9254-be3319ba4e82}\skype.ico, Skype, @PATH@UserIcon\48x48\Skype.png, C:\Program Files\Skype\, ,1"
"C:\VS2005\zMoviePlayer\bin\Debug\zMoviePlayer.exe, zMoviePlayer, @PATH@UserIcon\48x48\MediaPlayer.png, @PATH@, ,1" 
"C:\program files\acronis\trueimagehome\trueimage.exe, Acronis True Image Home 10.0, @PATH@UserIcon\48x48\Acronis.png, @PATH@, ,1"
"C:\Program Files\FileZilla Client\filezilla.exe, FileZilla, @PATH@UserIcon\48x48\FileZilla.png, @PATH@, ,1"
"C:\travail\PhotoComposer\PhotoCompo.exe, PhotoComposer, @PATH@UserIcon\48x48\PhotoComposer.png, @PATH@, ,1"
"C:\program files\blender foundation\blender\blender.exe, Blender, @PATH@UserIcon\48x48\Blender.png, @PATH@, ,1"
"C:\travail\sdk\template\goldfish\xpaero\ofthebay\ofthebay.exe, Of The Bay, @PATH@UserIcon\48x48\OTB.png, @PATH@, ,0" ' <-- Hide OTB
"D:\Photosetup\PhotoSetup.exe, PhotoSetup, @PATH@UserIcon\48x48\PhotoSetup.png, @PATH@, ,1"

Note: If there is no "OfTheBay.OTB" file into the EXE's folder, then the program uses the default 32x32 icon embedded into the shorcut target.

The "UserIcon" folder has a subfolder named "48x48" to store large icon, but you can add a new "32x32" subfolder to store your custom icons if you want them to be surrounded with the icon frame background.

I have attached to this post the latest public version 1.55.
It is provided with a "OfTheBay.OTB.txt" file, that must be renamed "OfTheBay.OTB" after it has been customized to match your own need.

.

 
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
"Of The Bay" source code utility to create a custom OTB file
« Reply #44 on: November 27, 2008, 07:06:40 PM »
Here is the DoOTB utility that creates a default OTB file that you can customize to match your specific needs.


Source code:

Code: [Select]
'+--------------------------------------------------------------------------+
'|                                 DoOTB                                    |
'|                                                                          |
'|   Create a "Default.OTB" to be used as template to create a customized   |
'|                          "OfTheBay.OTB" file.                            |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                                                                          |
'|                         Author Patrice TERRIER                           |
'|                            copyright(c) 2008                             |
'|                           www.zapsolution.com                            |
'|                        pterrier@zapsolution.com                          |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                  Project started on : 11-27-2008 (MM-DD-YYYY)            |
'|                        Last revised : 11-27-2008 (MM-DD-YYYY)            |
'+--------------------------------------------------------------------------+

#COMPILE EXE "DoOTB.exe"

#INCLUDE "Win32API.inc"
#INCLUDE "GDImage.inc"
#INCLUDE "OfTheBay.inc"

'------------------------------------------------------------------------------------------
' LOCAL section
'-----------------------------------------------------------------------------------------

TYPE gSpriteArrayStruct
    ShellTo   AS ASCIIZ * 260
    IconPath  AS ASCIIZ * 260
    WorkDir   AS ASCIIZ * 260
    UseLabel  AS ASCIIZ * 128
    CmdLine   AS ASCIIZ * 260
    ShowCmd   AS LONG
END TYPE

''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''

SUB WriteOTB(BYVAL sMsg AS STRING) STATIC
    DIM szFileName AS ASCIIZ * %MAX_PATH
    DIM hDebug AS LONG
    DIM NeverBeenThere AS LONG
    IF hDebug AND LEN(sMsg$) = 0 THEN
       CALL zsFClose(hDebug)
       NeverBeenThere = 0
       EXIT SUB
    END IF
    IF NeverBeenThere = 0 THEN
       NeverBeenThere = -1
       szFileName = "Default.OTB"
       CALL zsKillFile(szFileName)
       CALL zsFOpen(szFileName, 2, 4, hDebug)
    END IF
    CALL zsFPut(hDebug, sMsg + $CRLF)
END SUB

'// Main entry point
FUNCTION WINMAIN (BYVAL hInstance     AS LONG, _
                  BYVAL hPrevInstance AS LONG, _
                  BYVAL lpCmdLine     AS ASCIIZ PTR, _
                  BYVAL iCmdShow      AS LONG) AS LONG

    DIM gS(1 TO 1) AS gSpriteArrayStruct

    LOCAL hProgMan, hListView AS DWORD
    LOCAL K, nCount, nItemCount AS LONG, sLink, sEnableShortcutTrueFalse AS STRING

    hProgMan  = FindWindow("Progman", "Program Manager")
    hListView = FindWindowEx(hProgMan, 0, "SHELLDLL_DefView", "")
    hListView = FindWindowEx(hListView, 0, "SysListView32", "FolderView")
    nItemCount = SendMessage(hListView, %LVM_GETITEMCOUNT, 0, 0)
    IF nItemCount THEN
       LOCAL dwProcessId, hProcess, dwSize, lpData AS DWORD
       CALL GetWindowThreadProcessId(hListView, dwProcessId)
       hProcess = OpenProcess(%PROCESS_VM_OPERATION OR %PROCESS_VM_READ OR %PROCESS_VM_WRITE, %FALSE, dwProcessId)
       IF hProcess THEN
          '// Compute the size of our reserved memory buffer
          dwSize = SIZEOF(POINTAPI) + SIZEOF(LVITEM) + %MAX_PATH * 2

          lpData = VirtualAllocEx(hProcess, BYVAL %NULL, dwSize, %MEM_COMMIT, %PAGE_READWRITE)
          IF lpData THEN

             LOCAL pWsh AS IWshShell
             pWsh = NEWCOM "WScript.Shell"
             LOCAL pLnk AS IWshShortcut

             LOCAL sDeskTopPub, sDeskTopAdm AS STRING
             sDeskTopAdm = zsFolderGet(%CSIDL_DESKTOP)
             sDeskTopPub = zsFolderGet(%CSIDL_COMMON_DESKTOPDIRECTORY)
             '// Setup pointers
             LOCAL lpPosition, lpItem, lpText AS LONG
             lpPosition = lpData
             lpItem = lpData + SIZEOF(POINTAPI)
             lpText = lpData + SIZEOF(POINTAPI) + SIZEOF(LVITEM)

             LOCAL lvi AS LVITEM
             LOCAL szTxt AS ASCIIZ * 128, szLnk AS ASCIIZ * (%MAX_PATH * 2)  ' Allow room for unicode
             LOCAL DoLnk AS LONG
             FOR K = 0 TO nItemCount - 1
                 '// Init LVITEM structure and copy it to our reserved memory buffer
                 lvi.mask       = %LVIF_TEXT
                 lvi.iItem      = K
                 lvi.iSubItem   = 0
                 lvi.pszText    = lpText
                 lvi.cchTextMax = %MAX_PATH * 2
                 CALL WriteProcessMemory(hProcess, lpItem, lvi, sizeof(LVITEM), 0)
                 '// Get text label and x,y location
                 CALL SendMessage(hListView, %LVM_GETITEMTEXT, K, lpItem)
                 CALL SendMessage(hListView, %LVM_GETITEMPOSITION, K, lpPosition)
                 '// Copy from process memory to local variables
                 szTxt = ""
                 CALL ReadProcessMemory(hProcess, lpText, szTxt, SIZEOF(szTxt), 0)
                 LOCAL p AS POINTAPI
                 CALL ReadProcessMemory(hProcess, lpPosition, p, SIZEOF(POINTAPI), 0)
                 IF LEN(szTxt) THEN szLnk = szTxt + ".lnk"

                 IF ISFILE(sDeskTopAdm + szLnk) THEN
                    sLink = sDeskTopAdm + szLnk
                 ELSEIF ISFILE(sDeskTopPub + szLnk) THEN
                    sLink = sDeskTopPub + szLnk
                 ELSE
                    sLink = ""
                 END IF

                 sTarget$ = ""
                 IF LEN(sLink) THEN
                    DoLnk = -1
                    pLnk = pWsh.CreateShortcut(UCODE$(sLink))
                    sTarget$ = RTRIM$(ACODE$(pLnk.TargetPath))
                    IF LEN(sTarget$) = 0 THEN sTarget$ = ResolveLnk((sLink))
                 ELSE
                    DoLnk = 0
                    sTarget$ = ResolveShortcutName(szTxt)
                 END IF
                 IF LEN(sTarget$) THEN
                    INCR nCount
                    REDIM PRESERVE gS(1 TO nCount)
                    gs(K).IconPath = "@PATH@UserIcon\48x48\????.png"
                    IF DoLnk THEN gS(nCount).ShellTo = LCASE$(ACODE$(pLnk.TargetPath))
                    IF DoLnk THEN gS(nCount).WorkDir = ACODE$(pLnk.WorkingDirectory)
                    gS(nCount).UseLabel = szTxt
                    IF DoLnk THEN gS(nCount).ShowCmd = pLnk.WindowStyle
                 END IF
             NEXT

             '// Freeup memory
             CALL VirtualFreeEx(hProcess, lpData, 0, %MEM_RELEASE)

          END IF

          '// Close process
          CALL CloseHandle(hProcess)
         
          LET pWsh = NOTHING
         
       END IF
    END IF
   
    IF nCount THEN
   
       WriteOTB "'+--------------------------------------------------------------------------+"
       WriteOTB "'|                               Of The Bay                                 |"
       WriteOTB "'|                                                                          |"
       WriteOTB "'|                         User shorcut definition                          |"
       WriteOTB "'|                                                                          |"
       WriteOTB "'+--------------------------------------------------------------------------+"
       WriteOTB "'|                                                                          |"
       WriteOTB "'|                         Author Patrice TERRIER                           |"
       WriteOTB "'|                            copyright(c) 2008                             |"
       WriteOTB "'|                           www.zapsolution.com                            |"
       WriteOTB "'|                         support@zapsolution.com                          |"
       WriteOTB "'|                                                                          |"
       WriteOTB "'+--------------------------------------------------------------------------+"
       WriteOTB "'Use @PATH@ to match either the OfTheBay.EXE path or the ShellTo target path"
       WriteOTB "'"
       WriteOTB "'Icon:"
       WriteOTB "'Use either 32x32 or larger (will be converted to 48x48)"
       WriteOTB "'in case of 32x32 the program adds the active icon background else not."
       WriteOTB "'"
       WriteOTB "'""ShellTo, UseLabel, IconName, WorkDir, CmdLine, EnableShortcutTrueFalse"""
       WriteOTB "'EnableShortcutTrueFalse = 2 '// To inform OTB that this one refers to the ""Recycle Bin"""
       WriteOTB "'"
       WriteOTB "'Replace ""@PATH@UserIcon\48x48\????.png"" with a custom PNG file."
       WriteOTB "'"
       FOR K = 1 TO nCount
           sEnableShortcutTrueFalse = ", 1"""
           IF LEN(gS(K).ShellTo) = 0 THEN
              gS(K).ShellTo = gS(K).UseLabel
           ELSE
              IF INSTR(gS(K).ShellTo, "ofthebay.exe") THEN sEnableShortcutTrueFalse = ", 0""" ' Don't show it
              IF PATHNAME$(PATH, gS(K).ShellTo) = RTRIM$(LCASE$(gS(K).WorkDir), "\") + "\" THEN gS(K).WorkDir = "@PATH@"
           END IF
           WriteOTB """" + gS(K).ShellTo + ", " + gS(K).UseLabel + ", " + gs(K).IconPath + ", " + gS(K).WorkDir + ", " + gS(K).CmdLine + sEnableShortcutTrueFalse
       NEXT
       WriteOTB "'"
       WriteOTB "'End of file."
       WriteOTB ""
    END IF

    MsgBox """Default.OTB"" file, has been created." + $cr + $cr + _
           "You must edit and save it under the name of:" + $cr + _
           """OfTheBay.OTB""", , "Of The Bay"

END FUNCTION

Instructions for use are provided into the resulting OTB file.
...
« Last Edit: November 28, 2008, 11:55:57 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com