Monday, September 27, 2010

Detect 64-Bit Windows

This code shows how to Detect if you are using 64-Bit Edition of Windows in VB6.

[Download]

Disable DEP

DEP (Data Execution Prevention) is a new feature that was introduced with Windows XP SP2 and above, to prevent running of malicious codes, it marks certain memory locations as non-executable. But sometimes it creates problem with applications that are not doing anything harmful and they crashes. In XP SP3 and above Microsoft introduced new APIs that allow us to disable or enable DEP on our applications. This code shows how you can disable or enable DEP at runtime for your applications.

'API In General Declaration Section
Private Declare Function SetProcessDEPPolicy Lib "Kernel32.dll" (ByVal dwFlags As Long) As Long

'To Disable DEP
SetProcessDEPPolicy(0)

'To Enable DEP
SetProcessDEPPolicy(1)

'Note: Once Enabled Using API you cannot disable it Again
More on MSDN
SetProcessDEPPolicy Function [Visit]

New NX APIs added to Vista SP1, XP SP3 and Server 2008 [Visit]

Sunday, September 26, 2010

Draw Text with Shadow

This code shows how you can draw text with shadow. It uses DrawShadowText function in ComCtl32.dll to draw the text with shadow. Only works on Windows XP+ with manifest file.



[Download]

Saturday, September 25, 2010

Add Bitmap to Menus

This code shows how you can add Bitmap to Menus. It works on all versions of Windows. On Windows 95-XP the bitmap size is limited to 13x13 pixels and on Vista, 7 we can use 16x16 pixel bitmap. i have taken this code from MS KB Article 298144.



[Download]

Sunday, September 19, 2010

Cool Form Closing Effect

Just a snippet I wrote. Put this code in Form Unload event to test.

'---
Dim i As Long
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
For i = Me.Left To (Screen.Width / 2) Step 10
Me.Height = Me.Height - 15
Me.Width = Me.Width - 20
Me.Left = Me.Left + 100
DoEvents
Next
Unload Me
'---

Friday, September 17, 2010

SOAP Controls for VB6

SOAP is a protocol for accessing Webservices.

PocketSoap
It is a SOAP client COM component for the Windows family
[Visit Website]

Microsoft SOAP Toolkit 3.0
[Visit Website]

Microsoft SOAP Toolkit 3.0 Redistributable
[Visit Website]

Saturday, September 11, 2010

Thursday, September 9, 2010

Tools: List of useful VB6 Add-Ins

Here is a list of few very useful VB6 Addins which provides many features.

vbAdvance
vbAdvance is a Visual Basic Add-In which gives access to advanced build features and many IDE convenience features. You can create Console Applications, Exports Function from VB6 DLLs, Create Resource-Only DLLs and more.
[Visit Website]

Visual Basic 6.0 Procedure Sort Add-In
[Visit Website]

Smart Indenter v3.5
Smart Indenter is a utility to tidy up VBA code by rebuilding the indentation of each line.
[Visit Website]

Sunday, September 5, 2010

System Folder Locations

  • Windows 95, 98, ME
    • System Folder
      • c:\windows\system\ = 32-Bit System Folder
  • Windows NT4, 2000, XP, Vista, 7
    • 32-Bit Windows
      • System Folder
        c:\windows\system\ = old 16-bit system folder
        c:\windows\system32\ = 32-bit system folder
      • Program Files
        c:\program files\ = Program Files
    • 64-Bit Windows
      • System Folder
        c:\windows\system32\ = 64-bit System Folder
        c:\windows\SysWOW64\ = 32-bit System Folder
      • Program Files
        C:\Program Files\ = 64-Bit program files folder
        C:\Program Files (x86)\ = 32-bit program files folder
Really confusing and complicated. This is for information purpose only, the location should never be hard coded.

Hello

Would try to update this blog from now. many links are broken like platnet source code and many websites shutdown.