Solved

Few VB Questions

Posted on 2000-03-28
16
236 Views
Last Modified: 2010-05-02
(1)How do you allow users to edit your control at run-time
(2)Label control is placed in User Control. user resizes the user control during run-time , in which event you handle the resizing of the label
(3)Sequence of events in form Unload and form Fire
(4)How do You debug an out of process component
(5)Which tool to use to halt the execution of code when a variable changes
(6)Which type of file is created when you use the Setup Wizard and choose the internet Download setup option
(7)What is the valid property of Form's collection
(8)What would be used in designing a component to generate run-time errors
(9)how to test unload behaviour of an inprocess component
(10)While running a webpage, an user gets a warning about unsafe control and cannot be downloaded.What to do
(11)What will disqualify a safe Active-X scripting control for WWW applications
(12)You have an Active-X document that uses the Async method to obtain data from an intranet location.What type of data cannot be returned.
0
Comment
Question by:arun_dp
  • 5
  • 3
  • 3
  • +4
16 Comments
 
LVL 14

Expert Comment

by:wsh2
ID: 2663483
When is the test?... LOL
0
 
LVL 27

Expert Comment

by:Ark
ID: 2663491
RTFM
Cheers
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2663570
12 questions for 50 points. That's <poke poke poke> just over 4 points each.

Indeed. RTFM.
0
 

Author Comment

by:arun_dp
ID: 2663600
Sorry Guys,
  That is the maximum No. of points I have got right now. So i couldnot afford more than that
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2663604
RTFM?
0
 
LVL 2

Expert Comment

by:damienm
ID: 2663650
What does RTFM stand for?
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2663715
RTFM stands for "Read the ***** manual"

arun, thanks for the explanation, but your question is too broad; it would take a long while to answer any of your questions... it really is worth more than 50 points and for questions this broad this forum is not really the right one anyway.

So, even though RTFM sounds very rude and abrasive, in all fairness it is the best advice anyone here can give you.

If you live in or near a city, go to a decent bookstore; they normally have a computing section and you're bound to find a good VB book there. They're expensive, but you can make a very good career in VB so I would consider it money well spent.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2663750
Some guesses...(some educated ones, some less so)
(2) UserControl_Resize procedure?
(3) QueryUnload followed by Unload followed by Terminate if all object variables referring to the form are set to Nothing
(4) An ActiveX.exe? Run its VB project separately.
(5) Debug.Assert False
(8) Crappy code... <g> But seriously, Err.Raise
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Expert Comment

by:wesleystewart
ID: 2664011
Find a Barnes and Noble nearby and camp out in the computer books section.

This really just looks like homework . . .

Wes
0
 
LVL 1

Expert Comment

by:j3877
ID: 2664732
READ THIS WHOLE ANSWER  - IT CONTAINS A LOT OF DATA FROM THE MSDN LIBRARY, BUT INFO NEEDED CAN BEE XTRACTED!


Sorry 'bout the long answer, but I just copied the text (I need the points! I only have 195!!!) Anyway - Onwards...


10) I can't be bothered typing it all out again, so:
            --------------

Safety settings are used to guarantee users that an ActiveX control will interact safely with their computer and its data. When you distribute ActiveX controls for Internet component download, you must assign safety levels to them. If you do not, and your controls damage users' computers or corrupt their data, you can be held legally accountable if the controls were signed.

You can help prevent these problems by verifying that your code is safe and marking it as such. There are two levels to safety in Internet component download:

Safe for initialization


Safe for scripting
Note   Safety settings apply only to components downloaded in Internet Explorer.

Safe for Initialization
When you mark a control safe for initialization, you guarantee that it will not perform harmful actions on the end user's computer, no matter what data or scripts are used in its initialization. A control that is safe for initialization does not write or modify any registry entries, .ini files, or data files as a result of initialization parameters. Safe for Initialization makes no claims about the safety of the control's methods, run-time properties, or the information it makes available to a script writer.

By default, Internet Explorer displays a warning and does not download controls that have not been marked safe for scripting and initializing. You can designate your software as safe for scripting and initialization when you use the Visual Basic Package and Deployment Wizard to package it for Internet distribution.

Safe for Scripting
When you mark a control safe for scripting, you guarantee that no script can cause the control to damage the users' computers or data. Controls marked safe for scripting should not be able to obtain unauthorized information from the users' computers or corrupt their systems.

Before you mark a control safe for scripting, you must verify that it does not perform any illegal activities or allow openings that could be used to cause damage. In general, controls that can automatically obtain any information about the user and expose that information to a script writer are not safe for scripting. Such seemingly innocent activities can be considered criminal acts in some countries.

In particular, a control should not perform the following actions as a result of scripting:

Insertion or retrieval of custom, script-defined registry and .ini file information. In other words, users should not be able to specify through a script which registry or .ini file information to insert.


Insertion or retrieval of variable registry and .ini file information that is not owned by the control.
Note   It is acceptable for a control to insert and retrieve registry and .ini file information that is predefined when the control is distributed, belongs only to the control, and exists for the purpose of helping the control manage its internal functions.

Reading a file from a hard drive with a name specified by scripting.
There is a fine line between safe and unsafe actions. For example, an ActiveX control that always writes information to its own registry entry may be safe, but a control that lets you name that entry is unsafe. A control that creates a temporary file without using any initialization or scripting value may be safe, but a control that allows the name of the temporary file to be assigned at initialization or by scripting is unsafe.

Prior to marking a control safe for scripting, it is advisable to create documentation recording the justification, taking the same type of care due any legal contract. This documentation can be included in the .inf file for your control. Your documentation might include:

A review by an expert, external developer who understands both the source code and VBScript.


A table listing all exposed methods, events, and properties of the controls.


A table listing all the files opened, API calls used, and the information retrieved or written.
If there are any dependencies or data transfer between the elements of these two tables, then the control is probably not safe for scripting.

Note   Determining whether a control is safe is not a trivial exercise. To understand what type of functionality you should not implement for your control, you might begin by noting the API calls and commands not implemented in VBScript. See http://www.microsoft.com/vbscript/ for information on the API calls and commands not implemented in VBScript.

Limitations of the Safety Flags
A control marked safe for scripting and safe for initialization is not necessarily safe to use. The previous two sections list actions that the control cannot perform as a result of initialization or scripting, but a control could still perform these unsafe actions at other times.

For example, suppose you create an ActiveX control that could reformat your hard-drive after 10 uses. This action does not occur as a result of scripting or initialization, so you can mark the control as safe. Of course, the person who writes such a control is liable for the usual penalties reserved for virus writers.

Responsibility for ensuring that adequate safeguards are in place belongs to the developer, not to end-users or to HTML authors. If you as the developer fail to include adequate safeguards, you can be held legally responsible.

The bottom line in ensuring the safety of your software is to always have your code independently reviewed by a seasoned developer who understands the issues well. You may want to include information about this review in the .inf file for your download.

For More Information   See "Designing Controls for Use With HTML" in "Building ActiveX Controls" for guidelines for making your controls safe for scripting and initialization. See "Advanced Customization for Internet Component Download" for more information on including information in the .inf file.
        ------------------













Advanced Customization for Internet Component Download


There are several things you can do to customize your file download, including:

Modifying an .inf file for the project. You might do this if you want to include information about your security settings, or to include an outside review of your component.


Modifying the .ddf file for the project. You need to do this if you have added any additional files to your download, or if you have changed your .inf file.


Manually rebuilding the.cab file. You need to do this if you have modified your .inf or .ddf files in any way.
The following sections provide more information on making these changes.

Modifying the .inf File
You can customize the installation process by modifying the .inf file. The modified file can then be included in a manually rebuilt.cab file (using the .ddf project file), or it can be directly referenced by the CODEBASE attribute of the OBJECT tag.

Note   An .inf file can be used in the CODEBASE attribute, but this should be avoided. Since an .inf file cannot have adigital signature, using it here would require you to digitally sign any compiled files (for example, .ocx files) to which it refers. This may require you to sign and deploy several executables individually, rather than signing one .cab file that packages all of them.

Typical modifications to an .inf file include:

Adding a license agreement.


Adding a readme file.


Adding additional documentation.
Note   As an ActiveX control developer, you can modify your Internet component download files, but you should be aware that doing so may place a potential liability on yourself or your firm if the modifications are done incorrectly. Some changes indicate that you guarantee, assure, or warranty that the changes are correct and truthful. Attempts to avoid these liabilities by citing "as is" or "suitability" clauses in a license agreement may be ruled invalid by many courts.

Sample .inf File
Here is an example of an .inf file:

;inf file for ControlDemo.ocx
;DestDir can be 10 for Windows directory, 11 for Windows\System(32) directory, or left blank for the Occache or the Downloaded Program Files directory.

[version]
signature=$CHICAGO$

[Add.Code]
CONTROLDEMO.OCX=CONTROLDEMO.OCX
MSVBVM60.DLL=MSVBVM60.DLL

[CONTROLDEMO.OCX]
file-win32-x86=thiscab
RegisterServer=yes
clsid={F651BF93-239B-11D0-8908-00A0C90395F4}
DestDir=
FileVersion=1,0,0,1

[MSVBVM60.DLL]
hook=MSVBVM60.cab_Installer
FileVersion=5,1,43,19

[MSVBVM60.cab_Installer]
file-win32-x86=http://activex.microsoft.com/controls/vb6/MSVBVM60.cab
InfFile=MSVBVM60.inf

Important   Only the original developer may legally mark a control as safe. There are no circumstances where you should ever mark someone else's control as safe. Changing the safety of a control can result in both a copyright infringement and criminal charges.

Adding Version Information to the .inf File
You can use the .inf file to specify the version of your component. The .inf file should have a file section that specifies a version and the same class ID specified in the <OBJECT> tag.

As illustrated in the example below, this file version specifies the version of the ActiveX control to be downloaded:

[circ3.ocx]
; The lines below specify that the specified Circ3.ocx (clsid,
; version) needs to be installed on the system. If it doesn't exist
; already, can be downloaded from the given location (a .cab).
NOTE:
; If "thiscab" is specified instead of the file location, it is
; assumed that the desired file is present in the same .cab cabinet
; that the .inf originated from. If the location pointed to
; is a different .cab, that cabinet is also downloaded and
; unpacked in order to extract the desired file.

file=http://www.code.com/circ3/circ3.cab
clsid={9DBAFCCF-592F-101B-85CE-00608CEC297B}

; Note that the {}s are required when entering the CLSID in the .inf
; file. This is slightly different from the HTML syntax for inserting
; CLSIDs in an <OBJECT> tag.

FileVersion=1,0,0,143

Modifying the .ddf File
You need to modify the project's .ddf file if you modify the .inf file or digitally sign your control in the Support directory. You also need to verify that any files added to the .inf file have also been added to the .ddf file, or they will not be available for installation.

Here is an example of a .ddf file created by the Package and Deployment Wizard:

..OPTION EXPLICIT
..Set Cabinet=on
..Set Compress=on
..Set MaxDiskSize=CDROM
..Set ReservePerCabinetSize=6144
..Set DiskDirectoryTemplate=
..Set CompressionType=MSZIP
..Set CompressionLevel=7
..Set CompressionMemory=21
..Set CabinetNameTemplate="ControlDemo.cab"
"C:\Website\Cabfiles\ControlDemo.inf"
"C:\ControlDemo\ControlDemo.ocx"

The following entries in the .ddf file should not be changed:

Entry Description
MaxDiskSize=CDROM This allows the .cab file to be as large as needed.
ReservePerCabinetSize=6144 This reserves space for a digital signature.


Manually Building .cab Files
You need to rebuild the .cab file every time you modify the .inf or .ddf file associated with it. To rebuild the .cab file, you need Microsoft's Cabinet Builder, Makecab.exe. This file is usually located in \VB\Setupkit\kitfil32.

The simplest way to rebuild the .cab file is to use the existing .ddf file for the project with the following command:

makecab /f yourcontrolname.ddf

The Cabinet Builder generates two additional informational files, setup.inf and setup.rpt.

For More Information   For more information on modifying files associated with a .cab file, see to the Microsoft Developer's Network. For detailed information about .inf files, see the documentation included with Microsoft's Visual C++ and on the MSDN Library CD-ROM.

11) Any control defined as "safe" can't UNDER ANY CIRCUMSTANCES HARM THE USERS COMPUTER THROUGH SCRIPTING INSTRUCTIONS!!!



1)How do you allow users to edit your control at run-time

-Not sure xactly wen u need 2 do something, but if you mean the users can enter values for left,top,width, height, then u mite try the
(2)usercontrol_resize!

--AS ABOVE--
(3) QueryUnload followed by Unload followed by Terminate if all object variables referring to the form are set to Nothing
(4) An ActiveX.exe? Run its VB project separately.

(5)as above - debug.assert false

(6)Sorry - using vb6 - Setup & Deployment wizard... mmmmmmm... version 6....... money...... arrrrrrghh...
(7)THIS IS SO HOMEWORK!
(8)Err.raise errnumber
(9)msgboxes in the subs.

(12)Any data type that you've not defined - if u say that you're expecting a binary file (image, soundfile, executable, etc) then the prog'll expect a binary file - nothink else (RTM for more details:


Asynchronous downloading is like the process of having a pizza delivered to your home. You first make a call to a pizza place and place an order. You then go about your business while others make the pizza. When the pizza is ready, a delivery person knocks on your door and informs you that your dinner has arrived.

With the UserDocument, the equivalent of the phone call is the AsyncRead method. Consequently, the AsyncReadComplete event is the equivalent of the pizza delivery person's knock on your door. This may be easier to understand in a simple scenario: loading a text file into a TextBox control.

To asynchronously load a Picture object into a PictureBox control

Press ctrl+n to begin a new project.


Click ActiveX Document DLL to start a new ActiveX DLL project.


In the Project Explorer window, double-click the UserDocument1 icon to open its designer.


On the Toolbox, click the TextBox control icon and draw a TextBox control on the designer. Set the MultiLine property to True.


Double-click the UserDocument designer to open its code window.


Add the following code to InitProperties event:
Private Sub UserDocument_InitProperties()
Dim strPath As String ' file path
' Change the path to a different text file if you
' wish. If you are on an intranet, you can
' also set the path to another computer on
' which you have access privileges.
strPath = "c:\Windows\Readme.txt"
' Now invoke the AsyncRead method. Set the
' type to vbAsyncTypeFile (a file), and the
' name of the property to Pizza.
UserDocument.AsyncRead strPath, _
vbAsyncTypeFile,  "Pizza"
End Sub

The preceding code is the "Pizza call." We gave the third argument (the property name argument) a distinctive name.

Add the following code to the designer. This code is the "knock on the door." It informs you that your "pizza" has arrived, and you should deal with it:
Private Sub UserDocument AsyncReadComplete _
(AsyncProp As VB.AsyncProperty)
Dim FileNum as Long

' Use a Select Case statement to determine which
' property is being delivered.
Select Case AsyncProp.PropertyName
Case "Pizza"

' Open the file and read the contents
' into the TextBox
FileNum = FreeFile
Open AsyncProp.Value For Input As FileNum
Text1.Text  = Input(LOF(FileNum), FileNum)
Close Filenum
End Select
End Sub

Press f5 to run the project.


Internet Explorer (or your default browser) will open and display your .vbd file. If you have used a file on your own computer, the call will happen too quickly for you to perceive any delay. However, if you have access to a larger file on a remote computer, the effect may be more noticeable.
To take our pizza delivery example one step further, imagine that there is a guarantee that the pizza will be delivered within 30 minutes or its free. In this case, you might be very interested in the progress of the pizza delivery person. You can check on the progress of your "pizza" by adding code to the AsyncReadProgress event:

Private Sub UserDocument AsyncReadProgress _
(AsyncProp As VB.AsyncProperty)
   ' Use a Select Case statement to read the StatusCode
   Select Case AsynchProp.StatusCode
      Case vbAsynchStatusCodeSendingRequest
         MsgBox "Attempting to connect"
      Case vbAsynchStatusCodeEndDownloadData
         MsgBox "Download complete"
      Case vbAsynchStatusCodeError
         MsgBox "Error  aborting transfer"
         CancelAsynchRead "Pizza"
   End Select
End Sub

Now when you run the project, the code in the AsyncReadProgress event will display two message boxes: first when an attempt is made to connect to the file, and then when the transfer is complete. If you set a breakpoint on the Select Case statement and step through the code, youll notice that the vbAsynchStatusEndDownloadData status code is returned before the AsyncReadComplete event is fired. This gives you one last chance to cancel or redirect the file (akin to refusing to answer the door when your "Pizza" arrives).

If an error occurs during the transfer (for example, losing a network connection) the vbAsyncStatusCodeError status code is returned, allowing you to call the CancelAsyncRead method to cancel the transfer and avoid a run time error.

To see a list of possible status codes returned by the AsyncReadProgress event, look at the AsyncStatusCodeConstants in the Object Browser.

For More Information   For an in-depth look at the AsyncRead method and the AsyncReadComplete and AsyncReadProgress events, see "Adding Internet Features to Controls" in "Building ActiveX Controls." Although the topic covers the UserControl object, the mechanics are identical.



SORRY IF THIS MAKES THE PAGE DOWNLOAD SLOWLY, BUT IT'S THE BEST I COULD DU IN THE TIME.
0
 
LVL 1

Accepted Solution

by:
j3877 earned 50 total points
ID: 2664737
READ THIS WHOLE ANSWER  - IT CONTAINS A LOT OF DATA FROM THE MSDN LIBRARY, BUT INFO NEEDED CAN BEE XTRACTED!


Sorry 'bout the long answer, but I just copied the text (I need the points! I only have 195!!!) Anyway - Onwards...


10) I can't be bothered typing it all out again, so:
            --------------

Safety settings are used to guarantee users that an ActiveX control will interact safely with their computer and its data. When you distribute ActiveX controls for Internet component download, you must assign safety levels to them. If you do not, and your controls damage users' computers or corrupt their data, you can be held legally accountable if the controls were signed.

You can help prevent these problems by verifying that your code is safe and marking it as such. There are two levels to safety in Internet component download:

Safe for initialization


Safe for scripting
Note   Safety settings apply only to components downloaded in Internet Explorer.

Safe for Initialization
When you mark a control safe for initialization, you guarantee that it will not perform harmful actions on the end user's computer, no matter what data or scripts are used in its initialization. A control that is safe for initialization does not write or modify any registry entries, .ini files, or data files as a result of initialization parameters. Safe for Initialization makes no claims about the safety of the control's methods, run-time properties, or the information it makes available to a script writer.

By default, Internet Explorer displays a warning and does not download controls that have not been marked safe for scripting and initializing. You can designate your software as safe for scripting and initialization when you use the Visual Basic Package and Deployment Wizard to package it for Internet distribution.

Safe for Scripting
When you mark a control safe for scripting, you guarantee that no script can cause the control to damage the users' computers or data. Controls marked safe for scripting should not be able to obtain unauthorized information from the users' computers or corrupt their systems.

Before you mark a control safe for scripting, you must verify that it does not perform any illegal activities or allow openings that could be used to cause damage. In general, controls that can automatically obtain any information about the user and expose that information to a script writer are not safe for scripting. Such seemingly innocent activities can be considered criminal acts in some countries.

In particular, a control should not perform the following actions as a result of scripting:

Insertion or retrieval of custom, script-defined registry and .ini file information. In other words, users should not be able to specify through a script which registry or .ini file information to insert.


Insertion or retrieval of variable registry and .ini file information that is not owned by the control.
Note   It is acceptable for a control to insert and retrieve registry and .ini file information that is predefined when the control is distributed, belongs only to the control, and exists for the purpose of helping the control manage its internal functions.

Reading a file from a hard drive with a name specified by scripting.
There is a fine line between safe and unsafe actions. For example, an ActiveX control that always writes information to its own registry entry may be safe, but a control that lets you name that entry is unsafe. A control that creates a temporary file without using any initialization or scripting value may be safe, but a control that allows the name of the temporary file to be assigned at initialization or by scripting is unsafe.

Prior to marking a control safe for scripting, it is advisable to create documentation recording the justification, taking the same type of care due any legal contract. This documentation can be included in the .inf file for your control. Your documentation might include:

A review by an expert, external developer who understands both the source code and VBScript.


A table listing all exposed methods, events, and properties of the controls.


A table listing all the files opened, API calls used, and the information retrieved or written.
If there are any dependencies or data transfer between the elements of these two tables, then the control is probably not safe for scripting.

Note   Determining whether a control is safe is not a trivial exercise. To understand what type of functionality you should not implement for your control, you might begin by noting the API calls and commands not implemented in VBScript. See http://www.microsoft.com/vbscript/ for information on the API calls and commands not implemented in VBScript.

Limitations of the Safety Flags
A control marked safe for scripting and safe for initialization is not necessarily safe to use. The previous two sections list actions that the control cannot perform as a result of initialization or scripting, but a control could still perform these unsafe actions at other times.

For example, suppose you create an ActiveX control that could reformat your hard-drive after 10 uses. This action does not occur as a result of scripting or initialization, so you can mark the control as safe. Of course, the person who writes such a control is liable for the usual penalties reserved for virus writers.

Responsibility for ensuring that adequate safeguards are in place belongs to the developer, not to end-users or to HTML authors. If you as the developer fail to include adequate safeguards, you can be held legally responsible.

The bottom line in ensuring the safety of your software is to always have your code independently reviewed by a seasoned developer who understands the issues well. You may want to include information about this review in the .inf file for your download.

For More Information   See "Designing Controls for Use With HTML" in "Building ActiveX Controls" for guidelines for making your controls safe for scripting and initialization. See "Advanced Customization for Internet Component Download" for more information on including information in the .inf file.
        ------------------













Advanced Customization for Internet Component Download


There are several things you can do to customize your file download, including:

Modifying an .inf file for the project. You might do this if you want to include information about your security settings, or to include an outside review of your component.


Modifying the .ddf file for the project. You need to do this if you have added any additional files to your download, or if you have changed your .inf file.


Manually rebuilding the.cab file. You need to do this if you have modified your .inf or .ddf files in any way.
The following sections provide more information on making these changes.

Modifying the .inf File
You can customize the installation process by modifying the .inf file. The modified file can then be included in a manually rebuilt.cab file (using the .ddf project file), or it can be directly referenced by the CODEBASE attribute of the OBJECT tag.

Note   An .inf file can be used in the CODEBASE attribute, but this should be avoided. Since an .inf file cannot have adigital signature, using it here would require you to digitally sign any compiled files (for example, .ocx files) to which it refers. This may require you to sign and deploy several executables individually, rather than signing one .cab file that packages all of them.

Typical modifications to an .inf file include:

Adding a license agreement.


Adding a readme file.


Adding additional documentation.
Note   As an ActiveX control developer, you can modify your Internet component download files, but you should be aware that doing so may place a potential liability on yourself or your firm if the modifications are done incorrectly. Some changes indicate that you guarantee, assure, or warranty that the changes are correct and truthful. Attempts to avoid these liabilities by citing "as is" or "suitability" clauses in a license agreement may be ruled invalid by many courts.

Sample .inf File
Here is an example of an .inf file:

;inf file for ControlDemo.ocx
;DestDir can be 10 for Windows directory, 11 for Windows\System(32) directory, or left blank for the Occache or the Downloaded Program Files directory.

[version]
signature=$CHICAGO$

[Add.Code]
CONTROLDEMO.OCX=CONTROLDEMO.OCX
MSVBVM60.DLL=MSVBVM60.DLL

[CONTROLDEMO.OCX]
file-win32-x86=thiscab
RegisterServer=yes
clsid={F651BF93-239B-11D0-8908-00A0C90395F4}
DestDir=
FileVersion=1,0,0,1

[MSVBVM60.DLL]
hook=MSVBVM60.cab_Installer
FileVersion=5,1,43,19

[MSVBVM60.cab_Installer]
file-win32-x86=http://activex.microsoft.com/controls/vb6/MSVBVM60.cab
InfFile=MSVBVM60.inf

Important   Only the original developer may legally mark a control as safe. There are no circumstances where you should ever mark someone else's control as safe. Changing the safety of a control can result in both a copyright infringement and criminal charges.

Adding Version Information to the .inf File
You can use the .inf file to specify the version of your component. The .inf file should have a file section that specifies a version and the same class ID specified in the <OBJECT> tag.

As illustrated in the example below, this file version specifies the version of the ActiveX control to be downloaded:

[circ3.ocx]
; The lines below specify that the specified Circ3.ocx (clsid,
; version) needs to be installed on the system. If it doesn't exist
; already, can be downloaded from the given location (a .cab).
NOTE:
; If "thiscab" is specified instead of the file location, it is
; assumed that the desired file is present in the same .cab cabinet
; that the .inf originated from. If the location pointed to
; is a different .cab, that cabinet is also downloaded and
; unpacked in order to extract the desired file.

file=http://www.code.com/circ3/circ3.cab
clsid={9DBAFCCF-592F-101B-85CE-00608CEC297B}

; Note that the {}s are required when entering the CLSID in the .inf
; file. This is slightly different from the HTML syntax for inserting
; CLSIDs in an <OBJECT> tag.

FileVersion=1,0,0,143

Modifying the .ddf File
You need to modify the project's .ddf file if you modify the .inf file or digitally sign your control in the Support directory. You also need to verify that any files added to the .inf file have also been added to the .ddf file, or they will not be available for installation.

Here is an example of a .ddf file created by the Package and Deployment Wizard:

..OPTION EXPLICIT
..Set Cabinet=on
..Set Compress=on
..Set MaxDiskSize=CDROM
..Set ReservePerCabinetSize=6144
..Set DiskDirectoryTemplate=
..Set CompressionType=MSZIP
..Set CompressionLevel=7
..Set CompressionMemory=21
..Set CabinetNameTemplate="ControlDemo.cab"
"C:\Website\Cabfiles\ControlDemo.inf"
"C:\ControlDemo\ControlDemo.ocx"

The following entries in the .ddf file should not be changed:

Entry Description
MaxDiskSize=CDROM This allows the .cab file to be as large as needed.
ReservePerCabinetSize=6144 This reserves space for a digital signature.


Manually Building .cab Files
You need to rebuild the .cab file every time you modify the .inf or .ddf file associated with it. To rebuild the .cab file, you need Microsoft's Cabinet Builder, Makecab.exe. This file is usually located in \VB\Setupkit\kitfil32.

The simplest way to rebuild the .cab file is to use the existing .ddf file for the project with the following command:

makecab /f yourcontrolname.ddf

The Cabinet Builder generates two additional informational files, setup.inf and setup.rpt.

For More Information   For more information on modifying files associated with a .cab file, see to the Microsoft Developer's Network. For detailed information about .inf files, see the documentation included with Microsoft's Visual C++ and on the MSDN Library CD-ROM.

11) Any control defined as "safe" can't UNDER ANY CIRCUMSTANCES HARM THE USERS COMPUTER THROUGH SCRIPTING INSTRUCTIONS!!!



1)How do you allow users to edit your control at run-time

-Not sure xactly wen u need 2 do something, but if you mean the users can enter values for left,top,width, height, then u mite try the
(2)usercontrol_resize!

--AS ABOVE--
(3) QueryUnload followed by Unload followed by Terminate if all object variables referring to the form are set to Nothing
(4) An ActiveX.exe? Run its VB project separately.

(5)as above - debug.assert false

(6)Sorry - using vb6 - Setup & Deployment wizard... mmmmmmm... version 6....... money...... arrrrrrghh...
(7)THIS IS SO HOMEWORK!
(8)Err.raise errnumber
(9)msgboxes in the subs.

(12)Any data type that you've not defined - if u say that you're expecting a binary file (image, soundfile, executable, etc) then the prog'll expect a binary file - nothink else (RTM for more details:


Asynchronous downloading is like the process of having a pizza delivered to your home. You first make a call to a pizza place and place an order. You then go about your business while others make the pizza. When the pizza is ready, a delivery person knocks on your door and informs you that your dinner has arrived.

With the UserDocument, the equivalent of the phone call is the AsyncRead method. Consequently, the AsyncReadComplete event is the equivalent of the pizza delivery person's knock on your door. This may be easier to understand in a simple scenario: loading a text file into a TextBox control.

To asynchronously load a Picture object into a PictureBox control

Press ctrl+n to begin a new project.


Click ActiveX Document DLL to start a new ActiveX DLL project.


In the Project Explorer window, double-click the UserDocument1 icon to open its designer.


On the Toolbox, click the TextBox control icon and draw a TextBox control on the designer. Set the MultiLine property to True.


Double-click the UserDocument designer to open its code window.


Add the following code to InitProperties event:
Private Sub UserDocument_InitProperties()
Dim strPath As String ' file path
' Change the path to a different text file if you
' wish. If you are on an intranet, you can
' also set the path to another computer on
' which you have access privileges.
strPath = "c:\Windows\Readme.txt"
' Now invoke the AsyncRead method. Set the
' type to vbAsyncTypeFile (a file), and the
' name of the property to Pizza.
UserDocument.AsyncRead strPath, _
vbAsyncTypeFile,  "Pizza"
End Sub

The preceding code is the "Pizza call." We gave the third argument (the property name argument) a distinctive name.

Add the following code to the designer. This code is the "knock on the door." It informs you that your "pizza" has arrived, and you should deal with it:
Private Sub UserDocument AsyncReadComplete _
(AsyncProp As VB.AsyncProperty)
Dim FileNum as Long

' Use a Select Case statement to determine which
' property is being delivered.
Select Case AsyncProp.PropertyName
Case "Pizza"

' Open the file and read the contents
' into the TextBox
FileNum = FreeFile
Open AsyncProp.Value For Input As FileNum
Text1.Text  = Input(LOF(FileNum), FileNum)
Close Filenum
End Select
End Sub

Press f5 to run the project.


Internet Explorer (or your default browser) will open and display your .vbd file. If you have used a file on your own computer, the call will happen too quickly for you to perceive any delay. However, if you have access to a larger file on a remote computer, the effect may be more noticeable.
To take our pizza delivery example one step further, imagine that there is a guarantee that the pizza will be delivered within 30 minutes or its free. In this case, you might be very interested in the progress of the pizza delivery person. You can check on the progress of your "pizza" by adding code to the AsyncReadProgress event:

Private Sub UserDocument AsyncReadProgress _
(AsyncProp As VB.AsyncProperty)
   ' Use a Select Case statement to read the StatusCode
   Select Case AsynchProp.StatusCode
      Case vbAsynchStatusCodeSendingRequest
         MsgBox "Attempting to connect"
      Case vbAsynchStatusCodeEndDownloadData
         MsgBox "Download complete"
      Case vbAsynchStatusCodeError
         MsgBox "Error  aborting transfer"
         CancelAsynchRead "Pizza"
   End Select
End Sub

Now when you run the project, the code in the AsyncReadProgress event will display two message boxes: first when an attempt is made to connect to the file, and then when the transfer is complete. If you set a breakpoint on the Select Case statement and step through the code, youll notice that the vbAsynchStatusEndDownloadData status code is returned before the AsyncReadComplete event is fired. This gives you one last chance to cancel or redirect the file (akin to refusing to answer the door when your "Pizza" arrives).

If an error occurs during the transfer (for example, losing a network connection) the vbAsyncStatusCodeError status code is returned, allowing you to call the CancelAsyncRead method to cancel the transfer and avoid a run time error.

To see a list of possible status codes returned by the AsyncReadProgress event, look at the AsyncStatusCodeConstants in the Object Browser.

For More Information   For an in-depth look at the AsyncRead method and the AsyncReadComplete and AsyncReadProgress events, see "Adding Internet Features to Controls" in "Building ActiveX Controls." Although the topic covers the UserControl object, the mechanics are identical.



SORRY IF THIS MAKES THE PAGE DOWNLOAD SLOWLY, BUT IT'S THE BEST I COULD DU IN THE TIME.
0
 

Author Comment

by:arun_dp
ID: 2668159
Thanks a lot j3877. Your answers help me in someway.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2668199
D*mn j3877.. with an answer like that.. no wonder the EE server blew !!!.. <lol> and a <wink>
0
 

Author Comment

by:arun_dp
ID: 2668417
Wsh2,
  mind ur language while answering queries. You are not a super human, U SOB
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2668455
cor blimey, wsh2, it's not your day today, is it?

arun, please, it was only a joke!

<hands out happy pills in this thread too>


Purple haze all in my brain

Lately things just don't seem the same

Actin' funny, but I don't know why

'Scuse me while I kiss this guy <g>

Purple Haze all around
Don't know if I'm comin' up or down
Am I happy or in misery?
What ever it is, that girl put a spell on me

Help me
Help me
Oh, no, no

Purple haze all in my eyes, uhh
Don't know if its day or night
You got me blowin', blowin' my mind
Is it tomorrow, or just the end of time?

Oh, no, oh
Oh, help me
Purple haze - Tell me, baby, tell me I can't go on like this
Purple haze - You're makin' me blow my mind...mama
Purple haze - n-no, nooo
Purple haze - No, its painful, baby
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2668460
<snif>
I'm old enough to have been at Woodstock but I was too young to go...
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now