This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- FlexNet Connect
- :
- FlexNet Connect Forum
- :
- IsConnected() problem
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2003
04:47 PM
IsConnected() problem
Hi,
I have a question on using the IsConnected() feature using Visual C++ 7.0 (.NET). I am evaluating the Installshield hosted feature of UpdateService.
In the VB example, IsConnected() method is called without parameters. However, it looks like IsConnected() requires that you pass the parameter VARIANT_BOOL* pVal in order to call it in Visual C++. The UpdateService documentation shows this:
HRESULT IsConnected( VARIANT_BOOL* pVal );
If this the case? If so, what should the pVal be initialized to? If I don't initialize it, I get the:
Run-Time Check Failure #3 - The variable 'pVal' is being used without being defined.
error when I run it. If I go ahead and "Continue", the HRESULT returns false. If I call AppUpdate() instead, the internet connection is there because the Installshield update website pops up in a browser window.
Can anyone tell me how to correctly use IsConnected() ? Thanks.
Rick
I have a question on using the IsConnected() feature using Visual C++ 7.0 (.NET). I am evaluating the Installshield hosted feature of UpdateService.
In the VB example, IsConnected() method is called without parameters. However, it looks like IsConnected() requires that you pass the parameter VARIANT_BOOL* pVal in order to call it in Visual C++. The UpdateService documentation shows this:
HRESULT IsConnected( VARIANT_BOOL* pVal );
If this the case? If so, what should the pVal be initialized to? If I don't initialize it, I get the:
Run-Time Check Failure #3 - The variable 'pVal' is being used without being defined.
error when I run it. If I go ahead and "Continue", the HRESULT returns false. If I call AppUpdate() instead, the internet connection is there because the Installshield update website pops up in a browser window.
Can anyone tell me how to correctly use IsConnected() ? Thanks.
Rick
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2003
05:29 PM
Here is the C++ code snippet:
...
HRESULT hr ;
VARIANT_BOOL b = VARIANT_FALSE;
CComPtr spAgent;
hr = spAgent.CoCreateInstance(CLSID_Agent);
if (FAILED(hr))
throw hr;
hr = spAgent->IsConnected(&b);
...
In VB, runtime takes care of HRESULT so that VB programmer can work on better things. In other words, VB programmer does not have to worry about error checks after each line of code.
VB runtime raises the Error to the end-user. HRESULT is never directly exposed.
If you look closely the way IsConnected () is defined in type library of agent as:
HRESULT IsConnected([out, retval] VARIANT_BOOL* pVal);
pVal has a attribute of retval (return value).
Attribute [out, retval] tells VB runtime to pass temporary var as first argument to IsConnected() and show it as return value to the function IsConnected().
An VB example is as follows:
...
Dim pAgent as Object
Set pAgent = CreateObject( "DWUpdateService.Agent" )
If Not( pAgent.IsConnected( ) ) Then
MsgBox "You are not connected to the Internet."
End If
...
...
HRESULT hr ;
VARIANT_BOOL b = VARIANT_FALSE;
CComPtr
hr = spAgent.CoCreateInstance(CLSID_Agent);
if (FAILED(hr))
throw hr;
hr = spAgent->IsConnected(&b);
...
In VB, runtime takes care of HRESULT so that VB programmer can work on better things. In other words, VB programmer does not have to worry about error checks after each line of code.
VB runtime raises the Error to the end-user. HRESULT is never directly exposed.
If you look closely the way IsConnected () is defined in type library of agent as:
HRESULT IsConnected([out, retval] VARIANT_BOOL* pVal);
pVal has a attribute of retval (return value).
Attribute [out, retval] tells VB runtime to pass temporary var as first argument to IsConnected() and show it as return value to the function IsConnected().
An VB example is as follows:
...
Dim pAgent as Object
Set pAgent = CreateObject( "DWUpdateService.Agent" )
If Not( pAgent.IsConnected( ) ) Then
MsgBox "You are not connected to the Internet."
End If
...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2003
05:45 PM
Thanks Sunny. Initializing the VARIANT_BOOL parameter correctly did the trick!