Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all 1518 articles
Browse latest View live

check if internet is connected or not

$
0
0
add this in module


Code:

Option Explicit
Public Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
Public Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
Public Const RAS95_MaxEntryName = 256
Public Const RAS95_MaxDeviceType = 16
Public Const RAS95_MaxDeviceName = 32

Public Type RASCONN95
      dwSize As Long
      hRasCon As Long
      szEntryName(RAS95_MaxEntryName) As Byte
      szDeviceType(RAS95_MaxDeviceType) As Byte
      szDeviceName(RAS95_MaxDeviceName) As Byte
End Type

Public Type RASCONNSTATUS95
      dwSize As Long
      RasConnState As Long
      dwError As Long
      szDeviceType(RAS95_MaxDeviceType) As Byte
      szDeviceName(RAS95_MaxDeviceName) As Byte
End Type

Public Function IsConnected() As Boolean
Dim TRasCon(255) As RASCONN95
Dim lg As Long
Dim lpcon As Long
Dim RetVal As Long
Dim Tstatus As RASCONNSTATUS95

TRasCon(0).dwSize = 412
lg = 256 * TRasCon(0).dwSize
RetVal = RasEnumConnections(TRasCon(0), lg, lpcon)

If RetVal <> 0 Then
    MsgBox "Error " & Err & " Has Occured!", vbOKOnly + vbCritical, "Error!"
    Exit Function
End If
     
Tstatus.dwSize = 160
RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)

If Tstatus.RasConnState = &H2000 Then
    IsConnected = True
Else
    IsConnected = False
End If
End Function




Code:

Private Sub Command2_Click()
Text1.Text = IsConnected

End Sub


Form Window Setup With Pixel Perfect Accuracy

$
0
0
One of the biggest issues with setting up your form for doing graphical programming is to get it right perfectly. You searched on Google how to do it; you messed around with the Widths and Heights; setting the Scalemode to vbPixels; messed around with Screen.TwipsPerPixel X and Y; and....still no luck. It ends up never being the values you put in to begin with, not to mention the borders of the form as well as the top of your window throws off the values a notch. Luckily I created a function that does just that. This simple sub routine will allow you to set the window anywhere you want on screen and allows you to set the size of your form window with pixel perfect accuracy by just the interior of your form window. This assumes that you are using either a borderstyle of sizable, fixed single, or none. After running this small sample program, you will see that the scalewidth and scaleheights are exact as the values you wanted. And if you take a snapshot of it pressing your PrintScreen key, paste it in a paint program, and get the width and heights of within your window, you will see it'll be exactly the number of pixels you wanted. Enjoy as code like this is not easy to come by. It should be universal. If not, you can adjust the offsets. I tested it on a bunch of resolutions and its all the same so far.

[EDIT] Fixed the code shown below. Now it should be ok.

vb Code:
  1. Option Explicit
  2.  
  3. Private Sub Window_Setup(Window As Form, Optional ByVal X As Long = -1, Optional ByVal Y As Long = -1, Optional ByVal Width As Long = -1, Optional ByVal Height As Long = -1, Optional Caption As String = " ", Optional Auto_Redraw As Boolean = False, Optional ByVal Back_Color As Long = -1)
  4.     'Use -1 for default values and "" for default strings.
  5.     With Window
  6.         If Caption <> " " Then .Caption = Caption 'Else use current setting. Note: Some people may want "" as the caption.
  7.         .AutoRedraw = Auto_Redraw
  8.         .ScaleMode = vbPixels
  9.         If X <> -1 Then .Left = X * Screen.TwipsPerPixelX 'Else use current setting.
  10.         If Y <> -1 Then .Top = Y * Screen.TwipsPerPixelY 'Else use current setting.
  11.         If .BorderStyle = vbSizable Then
  12.             If Width <> -1 Then .Width = (Width * Screen.TwipsPerPixelX) + (16 * Screen.TwipsPerPixelX) 'Else use current setting.
  13.             If Height <> -1 Then .Height = (Height * Screen.TwipsPerPixelY) + (38 * Screen.TwipsPerPixelY) 'Else use current setting.
  14.         ElseIf .BorderStyle = vbFixedSingle Then
  15.             If Width <> -1 Then .Width = (Width * Screen.TwipsPerPixelX) + (6 * Screen.TwipsPerPixelX) 'Else use current setting.
  16.             If Height <> -1 Then .Height = (Height * Screen.TwipsPerPixelY) + (28 * Screen.TwipsPerPixelY) 'Else use current setting.
  17.         ElseIf .BorderStyle = 0 Then
  18.             If Width <> -1 Then .Width = (Width * Screen.TwipsPerPixelX) 'Else use current setting.
  19.             If Height <> -1 Then .Height = (Height * Screen.TwipsPerPixelY) 'Else use current setting.
  20.         End If
  21.         If Back_Color <> -1 Then .BackColor = Back_Color 'Else use current setting.
  22.         .Show
  23.         .SetFocus
  24.     End With
  25. End Sub
  26.  
  27. Private Sub Form_Load()
  28.     Window_Setup frmMain, 0, 0, 255, 255
  29.     Print frmMain.ScaleWidth & ", " & frmMain.ScaleHeight
  30. End Sub

Getting data from an URL provided

$
0
0
My task is to develop code in VB Classic, to open and URL (provided) and grab the information on the page and pass to application.

a) Open the URL site
b) Get the data on the page of the URL
c) Pass the data back to the appication

Appreciate your help

VB6 - BasicBuffer, Binary Stream Class

$
0
0
Description

A simple stream-style buffer class.

This is a kind of binary stream, similar to an ADO Steam object in Type = adBinary mode or an OLE IStream object. It accepts and returns Byte arrays, Integers, and Longs but not text String values.

It can be useful whenever you want a data structure that supports something similar to concatenating Byte arrays when you need to accumulate data arriving in bits and pieces and extract chunks for use. Things like Winsock control and MSComm control binary communication come to mind.

The properties and methods are similar to those of an ADO Stream.

This class has a lot of things in it to handle common needs. Remove anything you don't need in your programs.

I have done a lot of testing, but bug reports and fixes would be welcome.


Properties

ChunkSize As Long [R/W]
EOS As Boolean [RO]
HaveAtLeast(Length As Long) As Boolean [RO]
IsOpen As Boolean [RO]
Position As Long [R/W]
Size As Long [RO]



Methods

CloseBuf()
CurrentBytes() As Byte()
DeleteBytes(Optional ByVal Length As Long = -1)
ExtractBytes(Optional ByVal Length As Long = -1) As Byte()
ExtractInteger() As Integer
ExtractLong() As Long
OpenBuf()
ReadBytes(Optional ByVal Length As Long = -1) As Byte()
ReadInteger() As Integer
ReadLong() As Long
ScanForBytes(ByRef Target() As Byte) As Long
SetEOS()
ShrinkBuf()
WriteBytes(ByRef Bytes() As Byte)
WriteInteger(ByVal Value As Integer)
WriteLong(ByVal Value As Long)



Attachment

The attached archive contains BasicBuffer.cls as well as a testing Project.

It uses character data for easy reading/debugging here (converting to/from Unicode as needed) though BasicBuffers are normally for binary data.

This looks weird but tries to provide a test for correctness of as many operations as possible.


Requirements

No special requirements. You just need VB6. It may also work in Office VBA and VB5 (not tested).

See comments in the code for more help in understanding its use.
Attached Files

How disable cookie warning, when call method .Write of Object("HTMLFile")?

$
0
0
How disable cookie warning, when call method .Write of Object("HTMLFile")?
Code:
Code:

Set objDocument = CreateObject("HTMLFile")
Set oHttp = CreateObject("MSXML2.ServerXmlHttp.6.0")
   
sTemp = colUrls(i)
       
oHttp.Open "GET", sTemp, False
oHttp.setRequestHeader "Content-Type", "text/xml"
oHttp.sEnd
       
objDocument.Write oHttp.responsetext    '<--- warning shows in this place

look at the screen:
Attachment 96491
Attached Images
 

Email Client Program

$
0
0
JACMail is an Email Client Program designed to allow fast and efficient recovery of email
from a POP3 server, and the sending of email through an SMTP server. It is primarily oriented
towards text based messaging with attachments, and does not directly support highly formatted
HTML based email or embedded objects. It receives and stores both "text/plain" and "text/html"
messages, and Web based emails can be sent to the default browser for viewing. It also
supports Plain Authentication based SMTP and multiple mailboxes. The mailboxes are stored in
an Access database utilising ODBC.

The code uses IP Version independent system calls, so it will only work on Windows systems
that actively support both IPv4 and IPv6. That more or less restricts it to Windows Vista or
later. It utilises the following standard components and references: RICHED32.DLL, RICHTX32.OCX,
COMDLG32.OCX, MSSTDFMT.DLL, MSBIND.DLL, MSADODC.OCX, MSDATGRD.OCX, which the user
must have available in order to compile the program. WS2_32.DLL is required to run the program.

J.A. Coutts
Attached Images
 
Attached Files

Pure VB6 TreeView Control

$
0
0
....or ListView if you set the 'Indentation' Property to zero.... ;-)


Why I created this:
I am developing a treeview control BUT this isn't it!

At this stage, I am just creating the classes that will provide the 'engine' for my final work. However, in the course of doing so, I knocked up a very basic VB6 User Control and a hosting form in order to test them. I do not intend to use this Control myself (I'll be writing a new one that draws the nodes and provides for 'proper' hit-tests etc) so may not develop it further unless I need to add functionality to the classes that I need to test. Therefore there may or may not be updates to this post. However, somebody might find it useful to learn from in its current state...

I'd also appreciate peer code review as I'm a self-taught coder and may be doing some things less efficiently than I could be (or making other glaring mistakes)!

FEATURES:
  • full keyboard support
  • Drag-And-Drop between nodes
  • User-definable node caption colours
  • User-definable Background colour or picture

WATCH OUT FOR:
  • Barely any error handlers added as yet (cos I want to expose all errors during testing)
  • Not extensively commented (since I'm re-writing, re-designing as I go along)

Please do not report errors/crashes with the demo form - it is just a demo. I am however interested in errors raised by the classes and, to a lesser extent, the User Control. I'll repeat; it's really the classes that I am submitting - the rest is just a way of demonstrating/testing them...

Attachment 96669
Attached Files

How to zip the backup file in folder

$
0
0
Dear Expert,

I want to zip the backup file in target folder so how to do it, the code below is for backup the database in the target folder.

Code:

Private Sub Form_Load()
con.Close
End Sub

Private Sub cmdBackup_Click()
Set rs = Nothing
Set con = Nothing

If Dir$(App.Path & "\Backup", vbDirectory) = "" Then
    MkDir (App.Path & "\Backup")
End If


Dim MyDateTime As String

MyDateTime = Format(Date, "dd-mm-yyyy")  &  Format(DateTime.Time, "HH mm AMPM")


FileCopy App.Path & "\Test.mdb", App.Path & "\Backup\Test " & MyDateTime  & ".mdb"


MsgBox ("Backup completed")

End Sub


VB6 - AllRGB

$
0
0
This is a program I've been working on to convert a source image(currently it must be 2048x2048 pixels and file type: JPG, GIF, BMP(suggested)) to a 4096x4096(16777216 pixels/colors) AllRGB image. AllRGB means each color is used only once, none missing, none repeating.

Here are some of my very own examples produced with this very program(NOTE: some images may be slightly NSFW). Included is a RAR file with the latest compiled EXE, scanned by jotti.org with 20 out of 20 CLEAN results!

Here is the official AllRGB web page with dozens of more examples(SFW). I believe I have four on there, currently(all earlier works... I have newer submissions pending).

You can download the complete source code here: Attachment 96969

It's really easy to use:
  1. Select a Sort By... method from the menu(NOTE: methods denoted with artifact will benefit from Limit Swapping disabled and using higher Depths)
  2. Click Prepare Palette menu, enabling the Render menu upon completion(likely no more than 10-20 seconds on a modern PC)
  3. Click Render menu, select image file(must be a 2048x2048 bmp, jpg, or gif) BMP suggested
Under the Options menu, Swap Pixels is what's responsible for 'faithfully' colorizing images. Limit Swapping and Depths configure the pixel swapping. Depth is the most critical factor, and you'll have to experiment(to maximize optimal quality/time; in my experiences this is usually around 2-3 minutes) with it for different pictures. I've found good to great results generally start to appear between Depths of 12 to 30, so that's the default. It'll iterate, incrementing the depth by 6, so that's 4 passes; generally, these 4 passes with Limit Swapping enabled take around 5 minutes(aggregate), and 7 to 8 minutes with Limit Swapping disabled. The extra time/passes has ensured a very wide compatibility across numerous test images I've used(colors probably won't be perfect, but they're usually quite good). Time estimates based on my AMD Phenom II @ 3.8 GHz.

Feel free to ask any questions or add any comments you may have.

Source code is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License. Have fun, play with the code, and share your changes with us!
Attached Files

(VB6) richtextbox loop for read data help..

$
0
0
i have some data in richtextbox like this..

00001 abcd 0001 efgh
00002 jklm 0002 nopq
00003 rstu 0003 vwxy
.............................
etc,

and i want it to produce it in this format..

abcd efgh
jklm nopq
rstu vwxy
.............
etc,

to get that i used this
mid(richtextbox.text, 7, 4) & mid(richtextbox.text, 17, 4)

but it only show the first line..
i dont know how to loop the function and the next line will show up too..
please help me.. i'm beginner for using VB6.
*sorry for my english

VB6 Spell Check using Word

$
0
0
I cannot take credit for this routine, as the bulk of it comes courtesy of Microsoft. It utilizes the Spell Checker in Microsoft Word, and contains a couple of interesting techniques that I have not used before. One is the CoAllowSetForegroundWindow call, which enables the COM server process called to take focus away from the client
application. The other is moving the Word window off screen by setting the top of the window to a large negative number. This prevents it from interfering with the client program. I have tested it with Word 9.0 and word 12.0, and I have implemented it as a module for portability.

J.A. Coutts
Code:

Attribute VB_Name = "modSpell"
Option Explicit

Declare Function CoAllowSetForegroundWindow Lib "ole32.dll" (ByVal pUnk As Object, ByVal lpvReserved As Long) As Long

Public Function SpellChk() As String
    Dim WordApp As Object
    Dim objDoc As Object 'Word.Document
    Dim lOrigTop As Long
    Dim lErr As Long
    On Error GoTo SpellChkErr
    ' Create a Word document object
    Set WordApp = CreateObject("Word.Application")
    CoAllowSetForegroundWindow WordApp, 0
    Set objDoc = WordApp.Documents.Add
    ' Position Word off screen to avoid having document visible
    lOrigTop = WordApp.Top
    WordApp.WindowState = 0
    WordApp.Top = -3000
    WordApp.Visible = True
    WordApp.Activate
    ' Assign the text to the document and check spelling
    With objDoc
        .Content.Paste
        .Activate
        .CheckSpelling
        ' After the user has made changes, use the clipboard to
        ' transfer the contents back to the text box
        .Content.Copy
        SpellChk = Clipboard.GetText(vbCFText)
        ' Close the document and exit Word
        .Saved = True
        .Close
    End With
    Set objDoc = Nothing
    WordApp.Visible = False
    WordApp.Top = lOrigTop
    WordApp.Quit
    Set WordApp = Nothing
    Exit Function
SpellChkErr:
    lErr = err
    SpellChk = Clipboard.GetText(vbCFText)
    Screen.MousePointer = vbNormal
    Select Case lErr
        Case 91, 429
            MsgBox "MS Word cannot be found!", vbExclamation
        Case Else
            MsgBox "Error: " & err & " - " & Error$(err), vbExclamation, App.ProductName
    End Select
End Function

'Calling routine
Private Sub cmdSpell_Click()
    Clipboard.Clear
    Clipboard.SetText txtMessage.Text
    txtMessage.Text = SpellChk()
End Sub

monster packet vb6 codes , various type v1

$
0
0
monster packet source want to share that i found in pc

tried to upload , gone past size limits so cant add attachment

i uploaded to sendspace
http://www.sendspace.com/file/lij39l

em this is must se and have by me + had it very long time and want to share +

i will share mega pack 2 /3/4

also got paid planet source and i will share with u all its my licence so i can share

How To Set More Than 1 Minute To A Timer

$
0
0
Many people facing this problem can't set timer more than 1 minute interval here is one of solution to all you need a timer and text box add this code to timer

I am showing how to make timer interval 10 minute :wave:

Private Sub Timer1_Timer()
If text1.text="10" then
'here type what you need to do after interval 10 minutes
text1.text="0"
else
text1.text=val(text1)+1
end if
end sub

VB6 - MailCall: LAN App to App Alerts

$
0
0
Sometimes when a data client application can be in use by multiple people it may be useful to know when certain updates have been done so you can requery. This can be true whether you use a database or a set of random files... or some other shared resource. In theory you might even use it to monitor progress reports from a "batch" program running on another PC.

Example:

Perhaps you have a customer list table in a database and you use it to populate a Customer ListBox. When somebody adds a new customer you might want to reload your ListBox.

Now, you could beat on the database almost continuously using a Timer to reload every few seconds. This has performance implications though and they can be very serious when you use a shared file-based DBMS such as Jet.


MailCall

You can add a MailCall instance to a Form as an alternative.

MailCall has a Listen() method that you pass a Name to that is unique to your application. This causes MailCall to create the server end of a Mailslot and set up a broadcast name that it will use when you call its Send() method.

Send() accepts a String of up to to 100 Unicode characters and broadcasts it to all other computers on the LAN.

MailCall has its own Timer control that it uses to poll for inbound broadcasts every 1 to 65 seconds (set via the PollInterval property).

When this Timer's event handler reads an inbound message it will optionally skip any originating from itself depending on the value of the ReportLocal property. It also skips duplicate message payloads it finds during that poll since it is possible for Mailslot broadcasts to be delivered more than once depending n your network configuration).

If these criteria are met it raises its Receive() event, passing the data payload.

By passing different Name values to Listen() calls you can reuse MailCall in separate applications without collisions.


Data

Your 0 to 100 characters of Data can be whatever makes sense for your application. It might be empty, just a "ping" to everyone. Or it might be a database table name. Or it might be a signal from an "admin" program saying to close the database because maintenance is going to be performed.

You should be able to format the DATA as any Unicode characters, even NULs though that's usually not valuable. And you can parse incoming Data and act upon it in any way you see fit.

You can make up a protocol with a Msg ID code and comma-separated parameters. As long as it fits within 100 characters.

If desperate, you can also jam up to 200 ANSI characters into the String.


Requirements

Most of these are spelled out in the comments within MailCall. it should work on any machine that can run VB6 programs.

In case it isn't clear: Mailslots do not work over the Internet. Again, see the comments for more detail.

Your PCs' firewalls must permit MS Networking traffic ("File and Printer Sharing"), and all of the machines must be in the same Workgroup or Domain.

Win9x clients have limitations on the Mailslot names they can use. There can only be one Mailslot server for a given Mailslot name in one PC.


The Demo

So you can't really test the Demo thoroughly by running two copies on your computer.

But since there are no Demo dependencies aside from (a.) Windows and (b.) the VB6 runtime you could run A second Windows OS in a VM with networking support (and in the same Domain or Workgroup) and copy the compiled EXE there to test "pinging" back and forth between a copy on your PC and running in the VM.

And you can run the Demo standalone, talking to itself. Normally though an application instance doesn't want to see its own broadcasts (see the comments).
Attached Files

VB6 - Msms2Libs: Extract VS6/VB6 MSMs to Libraries

$
0
0
Purpose

Those who package and deploy VB6 Projects using Windows Installer tools that create MSI packages have the luxury of using Microsoft-built stable redistributable Merge Modules that contain the VB6-supplied OCXs and DLLs. But to get this stability when using a scripted setup maker such as the PDW it can be harder to come up with a source for them.

When you package applications you really don't want to use the "live" versions of these libraries, i.e. the versions installed and registered on your development system. The main reason is that you shouldn't try to install a version that is newer than the baseline version for the last Service Pack: now SP6 for VS6/VB6.

The PDW has a Redist folder, typically at:

C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist

When you install VS/VB this folder gets created and a basic set of files is placed there, but you the programmer are supposed to ensure that these files are updated appropriately and new files added over time. When files are placed here the PDW will use these versions for packaging your application instead of taking them from the "live" locations (System32, Program Files\Common Files, etc.).

There are several MS KB articles that cover this as well as related issues. Here are a few:

Best practices for deploying Visual Basic 6.0 applications

INFO: PDW [Do Not Redistribute] Section of VB6DEP.INI

INFO: Support for Third-Party Installers

INFO: How Setup Wizard and PDW Use Dependency Files


Msms2Libs

To get a set of the current baseline libraries I have written a VB6 program "Msms2Libs."

What it does is:
  • Run the merge modules package (msmenu.exe) to extract the MSMs to a subdirectory (Extracted) under the program's own directory (App.Path).
  • Create a "queue" of MSM files to process by scanning the directory.
  • Use the Windows Installer automation interface to extract the merge module CAB file from each merge module and into the same subdirectory.
  • Run an instance of the Microsoft utility Extract.exe against each CAB file to extract the files from the CAB into the same subdirectory.
  • Rename each extracted file from its name in the CAB file to its target name (the actual DLL or OCX name).
  • Delete all of the MSM and CAB files from the subdirectory.
Once complete the Extracted subdirectory should have a set of the VB6 SP6 files contained in those MSM files. There will also be some VC6 files there that you can delete and ignore or use for VC6 projects (but that's a different subject).

Some MSMs are skipped, see the comments in Msms2Libs' UIForm.frm module for details.


Using Msms2Libs

The full Project source is in the attached archive. Unzip these to a Project folder.

Next you will need to put a copy of the Microsoft Cabinet SDK utility Extract.exe into this folder. This used to be easy: just download and run CabSDK.exe from Microsoft, then after the self-extractor runs copy the utility from the CabSDK folder created.

Microsoft no longer offers this download though. If you do not already have the Cabinet SDK on your computer you might try some web searches, some 3rd party sites may still host this download. Just be sure to run a good virus scan on it before running it.

Once you have the Project folder set up and Extract.exe copied there, you need to download the VS6 SP6 Merge Modules package:

Merge Modules for Service Pack 6 for Visual Basic 6.0 and Visual C++ 6.0

Put this in a safe place, and copy it into the Project folder as well so Msms2Libs can run it for you to extract the MSMs.

Now you can run Msms2Libs from within the VB6 IDE or compile it and run the EXE. This should perform the steps listed above for you, create a log.txt file listing its actions, and leave you with a set of libraries in the Extracted subfolder.

So to run Msms2Libs, at a minimum you'd have some read/write directory that contains:
  • Compiled Msms2Libs.exe
  • The Extract.exe utility
  • The downloaded MSM distribution package MSMenu.exe

Notes

General

Be sure to read the comments at the head of UIForm.frm before running the program. There are some Consts you might want to alter and you might want to make additional changes too.

The entire process is non-destructive. If anything goes wrong just delete the Extracted subfolder or at least its contents, then you can re-run after making any changes that might be required.

DEP Files

These Merge Modules are meant for use by MSI packaging tools. This means they do not supply any .DEP files (since those are never deployed to target systems anyway). The equivalent of the .DEP file contents is embeeded in the MSMs themselves as "rules" for installing the libraries and registering them.

Ideally when you copy these extracted libraries into the PDW's Redist folder you will also either create new .DEP files for each one or else copy the existing .DEP from each library's "live" location and update it with new version and timestamp information.

It would be difficult to have Msms2Libs generate these for you since they normally contain information that Microsoft supplies in them regarding subdependencies and localization resource DLLs as wel as version numbers and dates.
Attached Files

Multi Server Multi Client Chat Application

VB6 - RTBCompose RTF Editor UserControl

$
0
0
Sometimes you want to provide a RichTextBox control wrapped with some buttons and logic to let the user interact with it as a somewht fuller-featured editor for RTF data. This is easy enough but a little tedious to do over and over again.

RTBCompose is a UserControl for this which you can add to your Projects and drop into your Forms. It helps keep the fiddly button handling logic out of your Forms and away from your business logic.

Uses

The attached demo is a small Project using RTBCompose to create a sort of stripped-down WordPad like program.

A more practical use might be programs that let a user compose and send RTF messages. This is why the SendButton option exists in RTBCompose.

You may also have a database that contains RTF-format Memo fields that you need users to be able to enter text into and/or edit existing text.

What it adds

RTBCompose provides a simple button bar supporting common rich editing operations such as cut, copy, paste, bold, etc.

It also adds a font/color "picker" based on the Font Common Dialog (ChooseFont API) wrapped in a way that makes it "work like" the VB6 CommonDialog control.

And it also has a button for "insert picture."

It adds Ctrl-B, Ctrl-I, and Ctrl-U keystrokes in addition to the Ctrl-C, Ctrl-V, and Ctrl-X natively supported by the RichTextBox control. Users get used to these in other programs and get to expect them.

There are other misc. features such as a left-right Margins property, a SendClicked event linked to the Send button you may not need, an IsDirty property and IsDirtyChanged event useful for adjusting things like menu item enabled status in the parent Form and detecting unsaved changes.

What it subtracts

RTBCompose only exposes a few things like the RichTextBox's base Font, Text, and RTFText properties and the LoadFile and SaveFile methods. It already takes care of most of the Selxxx properties with its own code, so you generally would not need them in the parent Form.

Since you have the full source you could expose more properties, add or remove buttons, implement drag/drop, etc. as required.

System Requirements

Should pretty much work on any system that VB6 programs run on.
Attached Images
 
Attached Files

new pause funchion

$
0
0
Code:

Private Sub TimeOut(HowLong)
    Dim TheBeginning
    Dim NoFreeze As Integer
    TheBeginning = Timer


    Do
        If Timer - TheBeginning >= HowLong Then Exit Sub
        NoFreeze% = DoEvents()
    Loop
End Sub


use
TimeOut 4

VB6 Unexpected Error on Windows 7

$
0
0
A forms-based VB6 application that runs on XP and Windows Server 2003 fails on Windows 7 with "Unexpected Error", even before the first form is launched.

(I will be answering myself as I've just solved it. I just wanted to pass on the knowledge)

[RESOLVED] VB6 Unexpected Error on Windows 7

$
0
0
A forms-based VB6 application that runs on XP and Windows Server 2003 fails on Windows 7 with "Unexpected Error", even before the first form is launched.

(I will be answering myself as I've just solved it. I just wanted to pass on the knowledge)
Viewing all 1518 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>