|
| |||||||||||||||
|
|
|
Even though Microsoft has released Visual Studio.NET a while ago now, there are still loads of companies/people using Visual Basic, mostly due to their legacy software which was initially written in VB, or because they already have a VB developer license and, for the kind of programs they write, it might be too expensive to invest in a VB.NET license. I guess this section really applies to these folks -- all the others please look away :-) |
|
Tips |
|
Start the Default Program Registered for File TypeThis isn't something out of ordinary, but I figured out it might be worth mentioning it here since I had quite a few people asking me about how to do this or how to find out which program is associated with a file type in Windows, in order to be able to start the program and pass the file name in the command line. Needless to say, that is not the way of opening a file with the registered application in Windows! Two reasons for that:
(There's actually a 3rd reason as well, which is quite obvious: not everyone configures
or installs the programs in the same location -- so just hardcoding a path like
Public Const SW_SHOWNORMAL = 1
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _ ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long ... (code goes here) ... ShellExecute hwnd, "open", Name of the file, vbNullString, vbNullString, SW_SHOWNORMAL ... (code goes here) ...
Download the source. |
|
Create an Outlook-like ControlEven though this is such old news, there are still people out there
it seems requesting something that looks like the Outlook bar :-)
So here it is -- not a big deal, just a couple of Download the source. |
|
Add a Horizontal Scrollbar to a ListboxThis came to my attention on Experts Exchange
when I realized that there are still people out there struggling
with the lack of horizontal scrollbars in the
' Add the following 2 lines to your declaration section
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Const LB_SETHORIZONTALEXTENT As Long = &H194 ' Where you want to show the scrollbar, just call the function like this: SendMessage YourListBox.hWnd, LB_SETHORIONTALEXTENT, width for scrollbar, 0
Public Sub AddScrollBar( ByRef lst As ListBox )
Dim i As Integer Dim m As Integer Dim tmp As Integer ' Compute maximum list item width in pixels m = 0 For i = 0 To lst.ListCount - 1 tmp = ScaleX( Me.TextWidth(lst.List(i)), ScaleMode, vbPixels ) If tmp > m Then m = tmp Next i SendMessage lst.hWnd, LB_SETHORIZONTALEXTENT, m, 0 End Sub |
|
|
Go back to the Technical page. Go back to the main page. |
|
|
Home | Profile | Hosting
| Info | News | Fun Stuff | Tech | Support
| Contact Us
| J2ME tips and news
© Copyright liviutudor.com.
| |||||||||||||||
| |
|||||||||||||||