The PushKeys command is available for VB 5.0 and above only. This is the only reason I moved from VB 3.0 to VB 6.0. PushKeys works more than 100 times faster than the VB SendKeys commnad. However, the keystrokes appear to be queued until a DoEvents command is executed. Normally, this would not be a problem except that DoEvents stops the execution of the VB 6.0 application.
formSave = Screen.ActiveForm.Caption AppActivate DOSAppName$ ' Transfers control to the DOS application PushKeys DOS_ScreenCapture$ ' Send keys to the active (DOS) application ' The following 4 lines of code are not needed in VB 3.0, ' These are needed so that the clipboard will be available For i = 1 To 10 ' I tried various values - 1, 10, 1000 - ' 1 failed, 10 works sometimes, 1000 hung DoEvents ' Without this - Error - Can't Open Clipboard Next i AppActivate formSave ' Without this, DoEvents hangs the application ' The following code never fails in VB 3.0, is intermittent in VB 6.0 tt$ = Clipboard.GetText()
According to Microsoft, DoEvents returns control to the Visual Basic program after the operating system has finished processing the events in its queue and all keys in the SendKeys queue have been sent. The Sleep 32-bit API function is a subset of the DoEvents function.
I tried to develop a template in one directory and do a save as in another directory. I ended up modifying the wrong data and lost the template. There is no way to modify the directory where project members are saved except to delete and reload them. I have not yet figured out how to determine where exe's are created.
Use the dir command.
Both of these should give the same result
Dim Msg ' Declare variable Msg = "1st part of string " Msg = Msg & "Next part of string " Msg = Msg & "Last part of string" Msg = "1st part of string " _ & "Next part of string " _ & "Last part of string"Available starting with VB 4.0
VB has 34 base classes. Of these, 20 are UI controls, 7 are defined in Global (App, Clipboard, Forms, Licenses, Printer, Printers, Screen). The others are Form, MDIForm, Menu, PropertyPage, UserControl, UserDocument, VBControlExtender.
Property functions let you create custom properties for forms and class modules. Properties are accessed using the PropertySet, PropertyGet, and PropertLet statements. First, declare the property as a form-level variable
Private TempStr as StringThen add the following procedures to the form
Public Property Let FormVariable(str as string) TempStr = str End Property Public Property Get FormVariable() FormVariable = TempStr End PropertyThe property is now set using
Form1.FormVariable = "test"
Initialize --> Load --> Form_Activate
Screen.ActiveControl is not valid during either Initialize or Load, but is valid during Form_Activate
Form_GotFocus appears to never get called.
Clicking a control generates 3 events in a control specific order.
|MouseDown --> Click --> MouseUp|
|MouseDown --> MouseUp --> Click|
You place break point by clicking in the Left-hand gray border. If a red dot appears, the program will pause and be displayed in the debug window when that line of code is executed.
In debug mode, double click a variable to see its value. Sometimes, simply pointing to a variable will display its value, but double clicking works on more variables.
In order to single step the program, you must first display the Debug Toolbar. This is hidden in View / Toolbars / Debug which is not visible on a 640x480 display unless you scroll the View menu to display the Toolbars selection. (In my opinion, this rates significantly below poor design. Scrolling a menu is never acceptable!)
|*.frx||Form Extension file |
Various strings, default data, etc.
Not text files
|*.cls||Code to create new objects|
|ActiveX Documents (pro)|
|ActiveX Designers (pro)|
|User Controls (pro)|
|*.vbg||VB Group - Identifies the startup project|
|*.vbp||Project files - Lists the included files, the name and path for the exe, who the software is licensed to|
CMDialog.Flags = OFN_FILEMUSTEXIST + OFN_HIDEREADONLYno longer hides the readonly checkbox. You must use cdlOFNFileMustExist and cdlOFNHideReadOnly instead.
The problem appears to be that the *.vbp (VB project) files contain hard coded paths, such as
Module=GlobalConstants; ..\..\..\Program Files\Microsoft Visual Studio\VB98\GlobalConstants.bas Module=Module2; ..\TestDosApp\globcons.basmust inspect this file yourself before doing any work.
It is a real pain that the project name can't be the same as the form name even though they have different extensions. Real languages provide more freedom.
dim CallingForm as Form sub subName(formVar as Form) CallingForm = formVar ' This fails set CallingForm = formVar ' This works end sub CallingForm.UIText.text = "string" ' This works In the main form, use this to pass the form reference call subName(me)
When working with Courier New and a Picture Box, the fonts are irrational. If you set the fontSize = 8 it is actually set to 8.25!
Screen.ActiveControl.SelTextcan access the selected text, but how do I know if the ActiveControl is a text box and not a button? Well Screen.ActiveControl returns a control. However, there is no built-in help for control - no members, no properties, no parent, nothing. Neither the help file nor the fabulous Object Browser provides any information.
The help for ActiveControl contains a partial answer: TypeOf returns the object's type. However, the help for the TypeOf keyword points to If..Then..Else and provides no additional help at all. (The help for VB 3.0 and VB 6.0 are equally bad.) Searching the Object Browser for TypeOf returns No items found.
ActiveForm.ActiveControldoes not work, it has no value even though it is the example used for the ActiveForm help example. Therefore, the rule is Don't trust the help files!
Additional TypeOf help is provided under Clipboard / checking data formats .
It would make a lot more sense if the UI Controls had built-in overloaded virtual functions which handled these basic commands.
The whole point of object oriented programming is that you can treat an unknown object as a base object in the class hierarchy and execute overloaded methods without knowing, or caring, what the specific type of the object is.
VB 6.0 fails totally as an object oriented language.