Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Update > WUAPI: Asynchronous operations with Visual Basic 6 Project

Reply
Thread Tools Display Modes

WUAPI: Asynchronous operations with Visual Basic 6 Project

 
 
morukland
Guest
Posts: n/a

 
      09-11-2005
Dear all,

can anybody give some advice how to perform an asynchronous search from
a Visual Basic 6 application?

I have the following module for the BeginSerach function:
Public Sub WUScan(strType)
Dim WUSsearchJob As ISearchJob
Dim WUSState As Variant
WUScriteria = "IsInstalled=0 and Type='Software'"
Set WUSsearchJob = oUpd.BeginSearch(WUScriteria, ?iUnknown?,
WUSState)
End Sub

I'm not sure what to put in for the IUnknown callback interface.
Tried some methods, i.e. implementing the ISearchCompletedCallback
interface into an ActiveX-DLL (Class WScanA) and calling it from the
main app:

Public Sub WUScan(strType)
Dim WUSsearchJob As ISearchJob
Dim WUSState As Variant
WUScriteria = "IsInstalled=0 and Type='Software'"
Set WScanX = New WScan.WScanA
Set WUSsearchJob = oUpd.BeginSearch(WUScriteria, WScanX, WUSState)

End Sub

WScan ActiveX-DLL:
'Class WScanA
Implements ISearchCompletedCallback

Private Sub Class_Initialize()
Debug.Print "WUScan init"
End Sub

Private Sub Class_Terminate()
Debug.Print "WUScan term"
MsgBox Date & " " & Time & " - Test.."
End Sub

Public Sub ISearchCompletedCallback_Invoke(ByVal searchJob As
WUApiLib.ISearchJob, ByVal callbackArgs As
WUApiLib.ISearchCompletedCallbackArgs)
MsgBox searchJob.IsCompleted
End Sub

....which fails also. The class is terminating while the search is still
ongoing. The %windir%\system32\windowsupdate.log contains then an error
indicating the callback failed:
WARNING: WU client fails to call back to search call
{CAE90800-88AC-4EC9-AA02-E7D88B7E00E3} with error 0x8024000c

If anyone could tell me how to implement the asynchronous functions of
the WUAPI.dll (at least the BeginSearch) that would be really great.

Thanks in advance.

 
Reply With Quote
 
 
 
 
Q
Guest
Posts: n/a

 
      09-17-2005
It looks like you were in the same boat as I was. I found an article in Swiss
that solves this problem. After I was able to run the BeginSearch
successfully, I tried to implement the same type of code for BeginDownload,
but quickly realized that there was no way to do the Update list that it uses
to download. Maybe you can figure that part out and re-post the solution here.

Here is the link to answer your question:
http://www.swissdelphicenter.ch/de/f...hl=beginsearch

If you copy the code right, it will work.

Let me know if you get the downloadbegin to work?

"morukland" wrote:

> Dear all,
>
> can anybody give some advice how to perform an asynchronous search from
> a Visual Basic 6 application?
>
> I have the following module for the BeginSerach function:
> Public Sub WUScan(strType)
> Dim WUSsearchJob As ISearchJob
> Dim WUSState As Variant
> WUScriteria = "IsInstalled=0 and Type='Software'"
> Set WUSsearchJob = oUpd.BeginSearch(WUScriteria, ?iUnknown?,
> WUSState)
> End Sub
>
> I'm not sure what to put in for the IUnknown callback interface.
> Tried some methods, i.e. implementing the ISearchCompletedCallback
> interface into an ActiveX-DLL (Class WScanA) and calling it from the
> main app:
>
> Public Sub WUScan(strType)
> Dim WUSsearchJob As ISearchJob
> Dim WUSState As Variant
> WUScriteria = "IsInstalled=0 and Type='Software'"
> Set WScanX = New WScan.WScanA
> Set WUSsearchJob = oUpd.BeginSearch(WUScriteria, WScanX, WUSState)
>
> End Sub
>
> WScan ActiveX-DLL:
> 'Class WScanA
> Implements ISearchCompletedCallback
>
> Private Sub Class_Initialize()
> Debug.Print "WUScan init"
> End Sub
>
> Private Sub Class_Terminate()
> Debug.Print "WUScan term"
> MsgBox Date & " " & Time & " - Test.."
> End Sub
>
> Public Sub ISearchCompletedCallback_Invoke(ByVal searchJob As
> WUApiLib.ISearchJob, ByVal callbackArgs As
> WUApiLib.ISearchCompletedCallbackArgs)
> MsgBox searchJob.IsCompleted
> End Sub
>
> ....which fails also. The class is terminating while the search is still
> ongoing. The %windir%\system32\windowsupdate.log contains then an error
> indicating the callback failed:
> WARNING: WU client fails to call back to search call
> {CAE90800-88AC-4EC9-AA02-E7D88B7E00E3} with error 0x8024000c
>
> If anyone could tell me how to implement the asynchronous functions of
> the WUAPI.dll (at least the BeginSearch) that would be really great.
>
> Thanks in advance.
>
>

 
Reply With Quote
 
morukland
Guest
Posts: n/a

 
      09-27-2005
Hi,

yes, I found the solution. I don't know exactly if it's the "normal"
way to implement but it works. So simply implementing the interfaces in
a special ActiveX-Dll works:
i.e.
ActiveX-DLL "WScan"
Class "WScanA"
''''''''''''''''''''''''''''''''''''''''''''''''''
Implements ISearchCompletedCallback

Public Event SearchComplete()

Public Sub ISearchCompletedCallback_Invoke(ByVal searchJob As
WUApiLib.ISearchJob, ByVal callbackArgs As
WUApiLib.ISearchCompletedCallbackArgs)
RaiseEvent SearchComplete
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''

Then in your main application, you set a reference to the WScan.dll and
add the following to your form object:
''''''''''''''''''''''''''''''''''''''''''''''''''
Public WithEvents WScanUpdatesA As WScan.WScanA

Public Sub WUScan
Set WScanUpdatesA = New WScan.WScanA
Set WUSsearchJob = oUpdSearcher.BeginSearch(WUScriteria,
WScanUpdatesA, WUSState)
End Sub

Private Sub WScanUpdatesA_SearchComplete()
'Receives the SearchComplete Event
Call SearchJobStat(WUSsearchJob)
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''

I have implemented all other Callbacks (Download, Install..) to the
same dll and its working fine.

That's it!

Ibrahim Isik

Q schrieb:

> It looks like you were in the same boat as I was. I found an article in Swiss
> that solves this problem. After I was able to run the BeginSearch
> successfully, I tried to implement the same type of code for BeginDownload,
> but quickly realized that there was no way to do the Update list that it uses
> to download. Maybe you can figure that part out and re-post the solution here.
>
> Here is the link to answer your question:
> http://www.swissdelphicenter.ch/de/f...hl=beginsearch
>
> If you copy the code right, it will work.
>
> Let me know if you get the downloadbegin to work?
>
> "morukland" wrote:
>
> > Dear all,
> >
> > can anybody give some advice how to perform an asynchronous search from
> > a Visual Basic 6 application?
> >
> > I have the following module for the BeginSerach function:
> > Public Sub WUScan(strType)
> > Dim WUSsearchJob As ISearchJob
> > Dim WUSState As Variant
> > WUScriteria = "IsInstalled=0 and Type='Software'"
> > Set WUSsearchJob = oUpd.BeginSearch(WUScriteria, ?iUnknown?,
> > WUSState)
> > End Sub
> >
> > I'm not sure what to put in for the IUnknown callback interface.
> > Tried some methods, i.e. implementing the ISearchCompletedCallback
> > interface into an ActiveX-DLL (Class WScanA) and calling it from the
> > main app:
> >
> > Public Sub WUScan(strType)
> > Dim WUSsearchJob As ISearchJob
> > Dim WUSState As Variant
> > WUScriteria = "IsInstalled=0 and Type='Software'"
> > Set WScanX = New WScan.WScanA
> > Set WUSsearchJob = oUpd.BeginSearch(WUScriteria, WScanX, WUSState)
> >
> > End Sub
> >
> > WScan ActiveX-DLL:
> > 'Class WScanA
> > Implements ISearchCompletedCallback
> >
> > Private Sub Class_Initialize()
> > Debug.Print "WUScan init"
> > End Sub
> >
> > Private Sub Class_Terminate()
> > Debug.Print "WUScan term"
> > MsgBox Date & " " & Time & " - Test.."
> > End Sub
> >
> > Public Sub ISearchCompletedCallback_Invoke(ByVal searchJob As
> > WUApiLib.ISearchJob, ByVal callbackArgs As
> > WUApiLib.ISearchCompletedCallbackArgs)
> > MsgBox searchJob.IsCompleted
> > End Sub
> >
> > ....which fails also. The class is terminating while the search is still
> > ongoing. The %windir%\system32\windowsupdate.log contains then an error
> > indicating the callback failed:
> > WARNING: WU client fails to call back to search call
> > {CAE90800-88AC-4EC9-AA02-E7D88B7E00E3} with error 0x8024000c
> >
> > If anyone could tell me how to implement the asynchronous functions of
> > the WUAPI.dll (at least the BeginSearch) that would be really great.
> >
> > Thanks in advance.
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic WindyGeorge Windows Vista General Discussion 3 09-18-2008 08:41 PM
Visual studio project files for devcon Pavel A. Windows Vista Drivers 0 05-03-2008 11:06 PM
Err.Number 486, Vista Ultimate, Visual Studio, & Visual Basic Mike Windows Vista General Discussion 2 01-16-2008 06:06 PM
Running Visual C++ and/or Visual Basic under Vista Home Premium OS DaleB Windows Vista General Discussion 10 11-20-2007 05:45 PM
Visual Basic 6 Program Name Andy DeFilippo Windows Vista General Discussion 0 03-22-2007 07:53 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59