Friday, November 11, 2011

ssChkBox

I actually created an ssChkBox before as shown in my TreeView To Do module but I easily got tired of its appearance that it actually was not included in the releases of my classes. Finally though, I think this appearance is really "catchy" that I decided to recreate said class, meaning from my old "dirty" approaches into a cleaner and leaner new class.


This actually works just like ssSwitch but there are those who are comfortable in having a checkbox instead of switchbox being it is very familiar to developers and end users alike.  This class caters to that "familiarization" aspect.

Like ssSwitchBox, this can have a logical value of .F. or .T.; or a numeric value of 0 or 1 (patterned after checkbox class).  Unlike ssSwitchBox though, this only have 1 theme so the parameter that needs to be passed is only two, i.e., its caption and its value.

When it is on the checked status, the caption is bold.

In addition, like an ordinary native VFP Objects, you can use its click event to do something.

Shown is the sample form given to subscribers:




Another new spice to make your forms looks "deliciously tasty".  Enjoy!

ssSwitch

ssSwitch is actually a remake of my old Switchbox class, the very first class I made and where the idea of creating several ssclasses later originated. 

For those who are not familiar with that one, SwitchBox class (as well as this one now) is an attempt to replace a checkbox with something unique.  I called this a switch because the appearance seems to switch on and off.


There really is not much difference with a checkbox and a switchbox (or ssSwitch in this case now).  Both can handle a logical values of .T. or .F., or a numeric values of 0 or 1.  Like a checkbox, you decide what you need to use.

Unlike the old Switchbox class however, this new class is cleaner, leaner and better.  I only got two original themes from Switchbox class and created 2 new themes for this one.  To use it, simple double-click it and in its Init event pass 1, 2 or 3 parameters like this:

This._settings( < Caption to use in the switchbox >, < logical or numeric value to start >, < Theme 1, 2,3 or 4 > )

Example:

This._settings("Show \  && Starts with value 1 or ON status and theme 3

Default value is a logical .F. and Theme is 1.

This is also the first class I decided to finally implement calculating the font width so the class' width can auto-adjust based on the length of the caption without developer specifying the width of the class.

And like my latest _ssclasses now, you can get its current value like this:

llValue = this._ssSwitch1.value
lnValue = this._ssSwitch1.value

when it is in the ON status, caption is bold.

In addition, like an ordinary native VFP Objects, you can use its click event to do something.

This will surely "spice-up" the appearance of your forms.

Tuesday, November 8, 2011

Pisang Bakar Virus Removal


Repost from my old site www.junblogs.com

I believe this has been in circulation for a long time as I think I have glimpsed this before on an internet caffe.  But hey, I am only renting it so I cannot properly “touch” that unit.

Today however, one of my IT guys have inserted his flash drive into one newly formatted unit here that does not have any anti-virus yet so presto, PISANG BAKAR infection.  I called one indonesian Manager and asked him what PISANG BAKAR is because I suspected that the word is indonesian and he confirmed it and said that it means banana; what a name for a virus. Well maybe the one who created this is thinking users will go banana over this one, LOL!

Cleaning this, however, is easy but not simple enough because it touches a lot of things.  Let me explain:

a.  Unlike some viruses that totally hides its components, this one is boastful as its show its presence on root drive c: under the filename pisangbakar.exe.  There is a corresponding text file (info.txt) that when opened show a lot of Indonesian words.  Other files follow:

\Windows\WinSetup.bat
\Windows\control32.ini (internal name is oyaba)
\windows\winampa.exe   (created by control32.ini via copy, the sole purpose is so it can be run later).  Winampa.exe is actually a valid name for Winamp player loader but it is never inside windows folder but in Program Files
\windows\system32\svghost.exe (resides in processes.  Use to infect further, recreates pisangbakar.exe and info.txt plus terminates attempt to run msconfig, regedit and task manager)


The standard way I am teaching here is to kill the virus component that is in the process using Task Manager.  But since this virus detects task manager among the processes and auto-kills it, then we need a 3rd party tool.  You can download DTaskManager here:  http://www.snapfiles.com/get/dtaskmanager.html.  Once you downloaded it, run it and use it to kill SVGHOST.EXE.

After SVGHOST.EXE is killed among the processes, you can then proceed with removing all those files mentioned.

b.  Additionally, it changes exe file association into your default media player.  To restore exe to its normal association, copy the codes below and paste it on a notepad.  Afterwards, rename it to any name with an extension of reg (e.g., FixExe.reg):
Source code   
Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\.EXE]
@="exefile"
"Content Type"="application/x-msdownload"
 
[HKEY_CLASSES_ROOT\.EXE\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"
 
[HKEY_CLASSES_ROOT\exefile]
@="Application"
"EditFlags"=hex:38,07,00,00
"FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\
00,6f,00,6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,\
32,00,5c,00,73,00,68,00,65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,\
00,2c,00,2d,00,31,00,30,00,31,00,35,00,36,00,00,00
 
[HKEY_CLASSES_ROOT\exefile\DefaultIcon]
@="%1"
 
[HKEY_CLASSES_ROOT\exefile\shell]
 
[HKEY_CLASSES_ROOT\exefile\shell\open]
"EditFlags"=hex:00,00,00,00
 
[HKEY_CLASSES_ROOT\exefile\shell\open\command]
@="\"%1\" %*"
"IsolatedCommand"="\"%1\" %*"
 
[HKEY_CLASSES_ROOT\exefile\shell\runas]
 
[HKEY_CLASSES_ROOT\exefile\shell\runas\command]
@="\"%1\" %*"
"IsolatedCommand"="\"%1\" %*"
 
[HKEY_CLASSES_ROOT\exefile\shellex]
 
[HKEY_CLASSES_ROOT\exefile\shellex\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"
 
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.exe\UserChoice]

Double-click that newly created registry info so it can restore the exe association back to normal.

c.  This virus creates some more registry entries so it can load itself on boot.  Open regedit and navigate to these entries:

My Computer\HKEY_Local_Machine\SOFTWARE\Microsoft\Shared Tools\MsConfig\Startupreg (delete SVGHOST entry there)

My Computer\HKEY_Local_Machine\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell

Under Shell, entry is this:

Explorer.exe c:\windows\system32\SVGHOST.EXE

Double-click it and just retain Explorer.exe  Do that also on HKEY_USERS (every user’s own settings).

The number of HKEY_USERS entry depends on the number of users you set in your unit.  So navigate to Winlogon of each HKEY_USERS as shown above.

Tip:  If you are getting lazy, just search SVGHOST.EXE inside registry.  Also look for Winsetup.bat.

and that is it!  Reboot your computer and work normally again.

ssEditBox

Since textbox can only hold a limited maximum number of characters and will hide some entries from our eyes if it goes beyond the textbox's current width, then for longer entries we normally use an editbox. However, one thing that I don't like about editboxes is those "eat" space and sometimes it is harder to design the appearance of our forms because we have to give allowance to those.  See image below:


Solution?  Create a dropdown editbox.


This class I called ssEditBox is designed to cater for longer entries that normally requires an editbox. This class appears like an ordinary textbox and consumes space on the form much like an ordinary textbox as well.  The difference is that this can handle longer entries as once the textbox reached the nMaxChar property value (default is 15 characters) then the dropdown editbox will appear and focus will be transferred there so you can continue typing as if you really are typing there in the first place.

You may want to change the value of nMaxChar property other than 15 characters if you have resized the class (made it wider or narrower) so you can estimate the number of characters user will type before it reaches the end of the current textbox width and make it appear that suddenly the dropdown edit box will popup.

Aside from letting the class reach the nMaxChar property for dropdown editbox to appear, you can likewise force the dropdown portion to appear "any time" via pressing down arrow when the class has the focus.  Hiding it back is done either via pressing Esc key, up arrow key or when you click outside of the dropdown editbox.

By default, the dropdown editbox is wider than the textbox.  But when you drag the right edge of the class making it wider than the dropdown editbox portion, the class will auto-compensate adjusting the dropdown portion to be of equal width with the textbox portion.

So there you are, again a very simple yet unique and appealing new class added to the list of growing ssclasses family.

Enjoy!

ssGridLock

I never liked horizontal scrolling capabilities of grids because I wanted everything to be seen outright without the need to scroll.  So I never used grid column locking before and most of my classes that deals with grids is designed without horizontal scrollbar in mind like ssAnchorSizer.

But, taste and need changes and in one of my modules I am forced to put a grid where some columns are hidden and the need to scroll horizontally cannot be avoided.  And since I don't want to guess "where" I am when I scroll to the right, I need to lock columns on the left.  And with that need arises ssGridLock class.





Using it is very easy like my ssGridSorter class.  Just bind the grid you wanted to attach to that column locking capability like this (on class Init event):

This._GridName = "Grid1"

By default, it will lock the 1st column of the grid but you can adjust it to initially show more than one column locked also via init event like this:

This.Value = 2  && locks 2 columns initially

Or via its value property on the PEM window.

This class will create a lock image on the column of your grid so you will know which column is currently locked.

And since it is included with a spinner, you can change locking dynamically on run by changing the spinner value up or down or by manually keying in the  number of columns to be locked.

Like my other grid classes, the class and the grid should be on the same container.  So a grid in the form must have that class on the form as well.  If the grid is inside a container object, then the class should also be inside that container.  If the grid is inside a page, the class should also be in that same page.

Monday, October 24, 2011

Convert external document files to PDF via ShellExecute()

Originally posted in www.junblogs.com

The easiest way to convert a report into a pdf file is via using a pdfprinter.  There are lots of pdf printers outside there which you can use.  You can check these sites:

to name a few.  Converting the report is as easy as these:

SET PRINTER TO NAME('PrimoPDF') && or something like that or a variable that contains the name of the PDF printer

REPORT FORM YourReport TO PRINTER NOCONSOLE


SET PRINTER TO DEFAULT && This is essential to instruct VFP to return back to its default printer

Friday, October 21, 2011

IEXPLORE.EXE virus Manual Removal


This is actually an old infection and this can be easily killed so I ignored sharing this one before.  However, some units here in our office has been again infected by this virus that is why I have to manually kill those again as our antivirus seems to not recognize this one.

What is IEXPLORE.EXE?

This is actually the executable filename of Microsoft Internet Explorer.  But since some virus propagator decides to be a little naughty, they named the process the same name.  If I am creating a virus, I might name a virus with a certain Microsoft processes as well so it can fool a lot of people thinking it is legal.

Since this virus has the same processes’ name with that of Internet Explorer, how will we know if what you are seeing in the Task Manager is the virus or the real Internet Explorer?  Simple, if there is no open Internet Explorer, then it is a virus.  If there is an open Internet Explorer, close it. After closing Internet Explorer and there still is an instance of IEXPLORE.EXE, then that is a virus.

What does this virus do?