This action might not be possible to undo. Are you sure you want to continue?
Group Members: M.Saad Siddiqui (s110.06) Syed Mohammed Ali (s062.06) Saim Pasha (s.06)
The Virtual Screensaver System is a windows based program designed purely on Winasm Studio. The primary design of the Screensaver was based on Windows Application Programming Interface (Windows API) which is Microsoft’s core Application Programming Interface. The basic idea which was implemented was to construct a program that when installed, would, after a basic pc-idle time (no keyboard or mouse movement), would begin to display images on the screen until any pc- activity is done. Any keyboard or mouse movement would then turn off the images being displayed, restoring the previous view of the computer, But the program would still be resident in memory, waiting to be executed again when a certain pc-idle time is reached. It will keep on doing this till it is uninstalled from memory. Winasm and Winapi were used because they easily facilitated the use of loading/unloading graphics and bitmaps and gave easy access to functions like dialog boxes, windows, splash screens etc which greatly helped us in completing our program.
Firstly we started to design our project using 32-bit programming but realized that it did not have interrupts. Interrupts were vital to our program so we switched to 16-bit programming. We were successful in making a skeleton program, but it was becoming very difficult to debug and make it operational so in the end we decided to use 32-bit Windows Programming using the Winasm studio. We found out that Windows Programming gave us a lot of freedom in implementing our ideas and functions. With its API services and help tutorials, we were sure this would work for our screensaver.
After deciding the programming medium, we started studying windows programming using assembly language. How the functions were called and how they worked. How API calls were used how they client applications to invoke specific operations at runtime to perform different tasks. We were also introduced to the functions and uses of dynamically linked libraries(DLL) files and how important they were to the function of a basic program. The syntax of windows-based programming was very tough to get accustomed to. We got extensive help from the tutorials present within the Winasm Studio package and they can also be viewed at www.win32assembly.online.fr
We started off with designing the basic startup screen a person would see once he runs our Program. This would enable him to either exit the program, or press “continue” to install the program into memory. This was done by creating a dialog box. A bitmap image was uploaded on the startup screen and 2 buttons were added which provided the basic function. The following procedure was used for that purpose. invoke CreateDialogParam,hInstance,ADDR DlgName,NULL,NULL,NULL The buttons were added using the resource editor of Winasm Studio.
A picture of most Modern Assembler - WinAsm Next we designed the tray icon. System tray is the rectangular region in the taskbar where several icons reside. Normally, you'll see at least a digital clock in it. This was programmed so that once the User presses the “continue” button, the startup screen would vanish and the program would reside itself in the tray icon displaying the image of an “application icon”. By this way the user can easily close the program via the popup menu which appears on the right mouse click over that icon. Or another way being that the user can double click on the icon to restore the startup screen and then exit the program. This task was done doing the following:
NOTIFYICONDATA was defined which has the following members: o cbSize The size of this structure. o hwnd Handle of the window that will receive notification when a mouse event occurs over the tray icon. o uID A constant that is used as the icon's identifier. You are the one who decides on this value. In case you have more than one tray icons, you will be able to check from what tray icon the mouse notification is from. o uFlags Specify which members of this structure are valid NIF_ICON The hIcon member is valid. NIF_MESSAGE The uCallbackMessage member is valid. NIF_TIP The szTip member is valid. o uCallbackMessage The custom message that Windows will send to the window specified by the hwnd member when mouse events occur over the tray icon. You create this message yourself. o hIcon The handle of the icon you want to put into the system tray o szTip A 64-byte array that contains the string that will be used as the tooltip text when the mouse hovers over the tray icon. o Shell_NotifyIcon was called which is defined in shell32.inc. This function has the following prototype:
Shell_NotifyIcon PROTO dwMessage:DWORD ,pnid:DWORD dwMessage is the type of message to send to the shell. NIM_ADD adds an icon to the status area. NIM_DELETE deletes an icon from the status area. NIM_MODIFY modifies an icon in the status area. pnid is the pointer to a NOTIFYICONDATA structure filled with proper values. While defining the functions of the tray icon a problem was faced that the program would minimize itself to the tray but won’t restore itself in a popup fashion. After intensive debugging the problem still could not be solved so help was taken from the tutorial files which showed that we had missed some code lines which when added made the tray icon function work perfectly. We then proceeded to create a splash screen that would act as the actual screensaver. A splash screen is a window that has no title bar, no system menu box, no border that displays a bitmap for a while and then disappears automatically. We modified the splash screen so that it would keep on displaying till either a keypress or a mouse movement/press related activity was done.
SPLASH SCREEN SAMPLE The first step was to include the bitmap in the resource file. A *resource* DLL which contains the bitmap and has the sole purpose of displaying the splash screen was created as it was considered an efficient practice. This way, a DLL would be loaded when we want to display the splash screen and unload it when it's not necessary anymore. So we will have two modules: the main program and the splash DLL. We will put the bitmap into the DLL's resource. The general scheme was as follows: 1. 2. 3. 4. Put the bitmap into the DLL as a bitmap resource The main program calls LoadLibrary to load the dll into memory The DLL entrypoint function of the DLL is called. When the specified action ie keypress or mouse movement occurred the splash screen would vanish.
We then started to work on a basic timer. The Function of the timer being that after the “continue” button was pressed, a timer would start which would run till a particular length, (which can be user defined) and after that if there has been no pc activity, the screensaver would be seen on the monitor screen. If after the “continue” button was pressed, there was some pc related activity, then the timer would be reset and it will again start as soon as the pc becomes idle. For this task we made use of various functions for detecting keyboard and mouse activity like: WM_MOUSEMOVE WM_NCMOUSEMOVE WM_MOUSEWHEEL WM_KEYDOWN WM_SYSKEYDOWN We faced several problems while programming this as we had trouble in defining an event which would keep on activating the timer, as pressing the “continue” button was just going to be done once. We tried various methods like using notification messages(UMsg) which we got by applying WM_ACTIVE or WM_NCACTIVE etc to get some event which would constant for the timer to run.
Final Stage: (Debugging mode)
We then moved on to adding .gif library to the program. We tried to do this because BITMAPS are static images whereas .GIF could be animated and would serve better the purpose of the Screensaver (reference to – Phosphorus Burn) as moving images are required. For this we located the .gif libraries and include files and studied various tutorials which gave information on adding .gif images to programs. We made attempts at adding these codes to our program and were successful in compiling and linking our program but for some reason the code wasn’t functioning properly, and because there was no error in the compilation, we were unable to locate the error. However there was one constant issue we faced that the screensaver was not vanishing when the mouse was moved. It was working perfectly with keypress and mouse button clicks and even the scroll wheel button. We tried nearly all mouse related functions in the Winasm Library like: WM_MOUSEMOVE WM_NCMOUSEMOVE WM_GETMOUSE WM_MOVE WM_MOUSEACTIVATE WM_MOUSEHOVER and others also.
Till the end of the program development we could not design a solution to this issue as we were unable to get mouse movements outside our design window, and our design window was only resting in the tray icon. So this is one limitation of our program.
This is a user guide which will enable you to use our Virtual Screensaver System: 1. Copy the program .exe file from USB or CD-ROM to desktop or any other location. 2. Double Click the .exe file to install the program. 3. You will be greeted with a dialog box which would ask you “would you like to continue’. Press “Continue” to install the screensaver in memory. Press “exit” to close program. 4. After pressing “continue” you will see the dialog box will vanish and an icon will appear in the system tray (where the clock is). This is the Screensaver program running in the background. 5. Now whenever the pc is idle the screensaver will activate itself and deactivate when there is any activity. Upon deactivation it will still remain in the memory and the icon will be present in the system tray. 6. If you wish to exit our screensaver you can click the right-mouse button on the tray icon and press exit, OR you can double click on the tray icon, you will again see the dialog box, and press exit there.
Thank you for Using Our Virtual Screensaver System.
API functions & Their Usage Research Dialog-box Creation Splash Screen Creation Tray Icon Creation Worked on 16-bit program
API functions & Their Usage Research TSR Research Timer Handling Events Handling Worked on 16-bit program
API functions & Their Usage Research GIF & JPG File Format Research Resourse Files Handling DLL File Handling
The Main Dialog Box
The Screen-Saver the appears
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.