Well that fixed one problem, But...
Erel, the fix worked - to the extent that I can create an optimized .exe file. The unoptimized file is 176KB and the optimized file is 48K. Unfortunately, it seems that optimization removed some functionality!? The first problem. The app is frmClock with pnlFace and txtTime imposed on pnlFace. Here's the the start-up code:
Sub App_Start
fmod.New1
frmClock.Show
TimeFormat("HH:mm")
txttime.Text=Time(Now)
pnlface.Focus
tmrupdatetime.Enabled=true
End Sub
As you can see, after it loads up, the focus is set to the panel to remove the blinking cursor from txttime.text On the unoptimized version it works perfectly. The optimized version, the focus stays in txttime. The timer only updates txttime.text once per minute - (i.e. Interval=60000) so I wouldn't think that that would be the culprit?
The second problem is that when the alarm time is reached, the unoptimized version plays the selected sound, the optimized version does not. From the Main Help file>Backword Issues:
External libraries (Optimized compiler only) - Objects must have a referenced desktop library.
So I tried adding the FMod.dll as an object to the desktop and I get an error saying 'could not load fmod.dll or one of its dependencies. The Module was expected to contain an assembly manifest.'
Lastly, when the alarm time is reached, a button pops up to shut off the alarm. Again, after the button is pressed, it disappears and the focus is supposed to go back to the panel to keep the blinking cursor out of txttime.
The only thing I changed was the FMODDesktop.dll. Both versions were compiled using the same code, but the optimized one doesn't work properly. So, either I'm not coding this properly, for optimization - or Murphy done got ahold of your optimizing routine! What do you reckon?
Attached is a zip file with everything in the application directory. Includes the source code, OAlarmClock.exe - optimized version and AlarmClock.exe - unoptimized version. Never mind that it can be done cleaner, I just threw this together quick and once I get it working right I'll clean it up!