Convert Huruf Besar -> Huruf Kecil


Gunakan StrConv untuk mengubah huruf besar menjadi huruf kecil contohnya,

Text=”Visual Basic, VB”

Print StrConv(text, vbProperCase)’ “Visual Basic, VB”

Advertisements

Common Dialog File Properties Called With API


‘Description: Invokes the File Explorer “Properties” dialog without OCX

‘Type SHELLEXECUTEINFO
‘       cbSize As Long
‘       fMask As Long
‘       hwnd As Long
‘       lpVerb As String
‘       lpFile As String
‘       lpParameters As String
‘       lpDirectory As String
‘       nShow As Long
‘       hInstApp As Long
‘       lpIDList As Long ‘Optional parameter
‘       lpClass As String ‘Optional parameter
‘       hkeyClass As Long ‘Optional parameter
‘       dwHotKey As Long ‘Optional parameter
‘       hIcon As Long ‘Optional parameter
‘       hProcess As Long ‘Optional parameter
‘End Type

‘Const SEE_MASK_INVOKEIDLIST = &HC
‘Const SEE_MASK_NOCLOSEPROCESS = &H40
‘Const SEE_MASK_FLAG_NO_UI = &H400

‘Declare Function ShellExecuteEX Lib “shell32.dll” Alias “ShellExecuteEx” _
        (SEI As SHELLEXECUTEINFO) As Long

‘Public Function ShowProperties(filename As String, OwnerhWnd As Long) As Long

       
       ‘     ‘open a file properties property page for specified file if return value
       ‘     ‘<=32 an error occurred
       ‘     ‘From: Delphi code provided by “Ian Land” (iml@dircon.co.uk)
       Dim SEI As SHELLEXECUTEINFO
       Dim r As Long
       
       ‘     ‘Fill in the SHELLEXECUTEINFO structure
       With SEI
       .cbSize = Len(SEI)
       .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
       .hwnd = OwnerhWnd
       .lpVerb = “properties”
       .lpFile = filename
       .lpParameters = vbNullChar
       .lpDirectory = vbNullChar
       .nShow = 0
       .hInstApp = 0
       .lpIDList = 0
End With

 
‘     ‘call the API
r = ShellExecuteEX(SEI)
 
‘     ‘return the instance handle as a sign of success
ShowProperties = SEI.hInstApp
 
‘End Function
‘Paste the following into a command button, etc.
‘Needs one textbox named Text1

        Dim r As Long
        Dim fname As String
       ‘      ‘get the filename and path from Text1
        fname = (Text1)
       ‘      ‘show the properties dialog, passing the filename
       ‘      ‘and the owner of the dialog
        r = ShowProperties(fname, Me.hwnd)
       
       ‘      ‘Display an error message if things didn’t go as planned
        If r <= 32 Then MsgBox “Error”

Information adding for Controlling 16×2 LCD Module


Here is some code that will help you connect a LCD module to Parallel port of a computer.
Almost any 16×2 LCD module should work. It has complete VB6 code. It works on Windows XP very well. I have used hwinterface.ocx from Logix4u.net that provides basic Inport and OutPort functionality (Thanks to them, made the work lot more fun).

Requirements:
a) Parallel Port connector
b) LCD Module
c) Power supply (5V, 50mA should be ok)
d) hwinterface.ocx downloadable from the net, free. (Visit logix4u.net for more info)

You will have to connect the LCD to Parallel port. Pin map is given below. You can get this info from several other locations on the net.

LCD – ParallelPort
RS – Pin 17
R/W – Gnd
E – Pin 1
D7-D0 – Pin8-Pin2

Other connections to LCD include back lit and contrast control. See LCD manual for details.

Copy the hwinterface.ocx to c:\windows\System32
From start menu, click on Run
In the text box key in the following
regsvr32 c:\windows\system32\hwinterface.ocx
You should get a message saying registered successfully.

Create a new project in VB6. Add a form.
Add required controls (text1, text2, text3, command1 and command2)
Add the code snippet as appropriate.

LPT port is generally located at 0x378. However, it may be moved to other ports as well. For example, on my laptop, it is located on 0x3BC. If in doubt, go to device manager and look for resources used by LPT.

Run the application (VB6)

Keyin the port number (in hex format itself). Click on command1 button to initialize the LCD. You should immediately see Welcome in text1 and ABCE… in text2. LCD module will also contain the exact same data displayed.

You can keyin any thing in text1 or text2. It is copied to LCD Module.

If in doubt, mail me. You can also contact me at udaywali@cquad.co.in

Happy interfacing!