DS_SelectURL
- Updated2023-02-21
- 3 minute(s) read
HRESULT DS_SelectURL (const char *title, const char *startURL, unsigned int options, const char *filter, short *URLWasSelected, char **selectedURL);
Purpose
Displays a dialog box that allows a user to select a Universal Resource Locator (URL).
When the dialog box is open, panels and windows that you created in the thread in which this function is called are not repainted if the thread is Free-threaded (COM threading model). To force repainting, make the thread that calls this function Apartment-threaded. To make a thread Apartment-threaded, call the ActiveX Library function CA_InitActiveXThreadStyleForCurrentThread in that thread, before you call any other ActiveX or DataSocket function.
![]() |
Note If you want to use this function to allow users to select URLs for OPC servers on a remote machine, you must install and enable the remote registry service. Refer to the Connecting to a remote OPC server topic in the DataSocket help file for more information. To access the DataSocket help file, select Start»National Instruments DataSocket server, and select "Help" the from the Help menu of the DataSocket server application. |
Parameters
| Input | ||
| Name | Type | Description |
| title | const char * | The title of the Select URL dialog box. |
| startURL | const char * | The default URL or URL scheme to display in the Select URL dialog box. Pass an empty string ("") to prompt the user with a simple text box. Pass a URL scheme, such as "file:", to open a dialog box appropriate for browsing that type of URL. Pass an entire URL, such as opc://alewife/National Instruments.OPCTest/Modbus Demo Box/4:0 to open a dialog box appropriate for browsing that type of URL. The specified URL is the default value in the dialog box. |
| options | unsigned int | The options to control the behavior of the Select URL dialog box. Use the bitwise OR operator (|) to combine options. You can pass the following options:
|
| filter | const char * | The file type filter for the Select URL dialog box. Examples "All Files (*.*)|*.*" |
| Output | ||
| Name | Type | Description |
| URLWasSelected | short | Returns a non-zero value if the user chooses a URL. Pass the address of a variable of type short. |
| selectedURL | char * | Returns the URL that the user selected. Pass the address of a char* variable to receive the URL. This function allocates memory to hold the URL string. Call DS_FreeMemory on the char* variable when you no longer need it. |
Return Value
| Name | Type | Description |
| status | HRESULT | The value that indicates whether an error occurred. A negative error code indicates function failure. Error codes are defined in CVIversion\toolslib\datasock\dataskt.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h. Other error codes in winerror.h are generated by ActiveX Servers and are passed on to you by the DataSocket Library. |
Additional Information
Library: DataSocket Library
Include file: datasock\dataskt.h
LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later
