PDA

View Full Version : Application.Exit Question



NitLions
03-22-2007, 07:47 AM
What I would like to do is to determine if a system is a 64-bit OS and display a message, if so, indicating that our application is not supported on a 64-bit OS at this time.

I have the following in an OnShow script of our Welcome Page...

if System.Is64BitOS() then
Dialog.Message("Our App Support", "Our App is not supported on 64-bit Operating Systems.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
Application.Exit();
end

This seems to work OK in that a 64-bit OS is detected and the message displays immediately after our Welcome Page appears. What I would like to happen, if possible, is to have just the message display without seeing the Welcome Page in the background.

I tried the snippet above in the Preload script, but what happens there is the message is displayed without the Welcome Page appearing. Once the message dialog is closed, the Welcome Page then flashes, but is closed.

Let me know if displaying the message without seeing the Welcome page is possible.

THANKS in advance!

:lol

bule
03-22-2007, 07:51 AM
Add this as a first line in project's OnStartUp script:
Application.SetRedraw(false);

Then in the first page's OnShow script add:
Application.SetRedraw(true);

And yes, move your OS check to the Project's OnStartUp script.

It will help a bit since page content should not be shown.

Worm
03-22-2007, 08:01 AM
Here's what I've used in the past. Throw the code in the Preload of your first page.



if System.Is64BitOS() then
Dialog.Message("Our App Support", "Our App is not supported on 64-bit Operating Systems.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
-- set the window to flat style
nResult = DLL.CallFunction(_SystemFolder.."\\User32.dll", "SetWindowLongA", Application.GetWndHandle()..",-16,-1811415040", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
-- hide the window
Window.SetSize(Application.GetWndHandle(),0,0);
--exit the app
Application.Exit();
end

NitLions
03-22-2007, 08:28 AM
Both seem to work OK. The first proposed solution still has a bit of a page flash after I close the displayed message dialog. You can't really see the graphics of the page, but the outline of it flashes.

The second solution seems to be more what I was after, but I have a concern. The use of _SystemFolder.., could this potentially cause problems on 64-bit systems due to the System32 and SysWOW64 folders, or is AutoPlay smart enough to handle this?

Worm
03-22-2007, 08:32 AM
I don't have a 64 bit system to try it on, but a simple

Dialog.Message("System Folder", _SystemFolder)

should show you where the variable points.

NitLions
03-22-2007, 08:46 AM
It worked on our 64-bit test system, so I'm probably OK. Even if this chokes at times, we don't support 64-bit for this app anyway.

I'll check where its pointing though as you suggest.

Thanks all for the help and guidance!

Eagle
03-22-2007, 09:09 AM
fyi:

64 bit OSs redirect calls from 32 bit proggies, for system resources, to the WoW64 folder,
so references - coding in IR runtimes to _SystemFolder are redirected to the wow64 folder
(behind the scenes) but show in coding returns as: system32

so as long as the function call is supported in the 32bit(Wow64) system resource,
then eg: _SystemFolder.."\\targetfile.ext" should behave as expected under 64 bit OSs

hth