I thought the 3 was minutes vs. seconds, but still had the same picture after 5 mins.
Since you were single stepping through the editor, you displayed the dialog the dialog took focus so your subsequent F8 press fell on the dialog rather than the editor. you never got to the wait>3 line which is wait three seconds.
Your script works as expected for me. I suspect it is working for you but you have different expectations.
Lets examine the script one section at a time.
- Your first line sets variables "w" and "h" to the width and height of your screen.
- Next you create a dialog. All looks good so far.
- First line after the dialog block sets the variable "Style" to 0.
- Now we get to the fun stuff, your windows API calls.
SetWindowLongA "Changes an attribute of the specified window." (Quote from Microsoft) The window being altered is your dialog and the attribute being altered is the "GWL_STYLE" attribute. (The "-16" in the SetWindowLongA line.) The "GWL_STYLE" attribute is being changed to zero. In other words you are removing all style settings from the dialog. It will become a plain grey box with no border, no icons and no title bar.
- The next API call is for
ShowWindow. ShowWindow... well...er...um... shows a window. But it allows you to show the window with specified settings. In your case you have set it to "3". Looking that up on the
Microsoft page for ShowWindow we find that if the "nCmdShow" parameter is 3 your window will be maximized.
- Your next line is Show> which is normally how we would display a dialog but since your previous line was the ShowWindow API your dialog is already displayed making this line extraneous.
- Your last line waits 3 seconds and seems to do that flawlessly.
If we revisit the "Image" line in the dialog block we can see that you have called a jpg file. "Image" will display either jpeg (jpg) or Windows bitmap (bmp) files. In My Opinion, one is not more desirable than the other for simple display. Next you set the upper left corner of the Image display to be the 0,0 position within the working area of the dialog. Last you set the width and height of the Image display area to be equal to the size of your screen as determined by the GetScreenRes> function. All in all this script works exactly as I would expect. But I've done this trick quite often.
To address your questions.
1) Jpgs and Bmps are equally reliable for display.
2) The desired image size is up to you. What do you want to see? This script should display any jpg or bmp image from 1 pixel by 1 pixel up to whatever your screen resolution is set to.
3) I'm not certain I understand the question but I do understand what happpened. Occasionally, if you use taskmanager to shut down mshed.exe, your macros.dat file will be erased. Macros.dat is where all of the settings are kept that display on the Macro Scheduler main menu. My suggestion is to back up the folder that contains your macros.dat file every day.
4) All you did was display a full sized window on the screen. Unfortunately the window does not have the icon for closing a window. Fortunately the key combination ALT+F4 will close the window.
5) Enhancement requests are more noticeable in the
Enhancement Suggestions forum
PS
In version 12 this can be done without the API calls.
The following will display the specified image file in a autosized, borderless dialog that will center itself on the screen.
Code: Select all
Dialog>Dialog2
object Dialog2: TForm
AutoSize = True
BorderStyle = bsNone
Position = poScreenCenter
object MSImage1: tMSImage
Left = 0
Top = 0
AutoSize = True
end
end
EndDialog>Dialog2
SetDialogProperty>Dialog2,msImage1,LoadImage,q:data\images\brightlight.jpg
Show>dialog2
Wait>3
Edit - script snippet above modified to prevent "lockup" per jpuziano's suggestion.