Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Access > VBA Access
VBA Access Le forum pour les questions relatives au code VBA sous Access, et à son environnement de développement VBE.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/01/2012, 11h03   #1
Membre régulier
 
Inscription : mars 2008
Messages : 210
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 210
Points : 70
Points : 70
Par défaut Impossible d'utiliser WIA 2.0 sur seven 64 bits

Bonjour,

Je tente vainement de piloter un scanner doté d'un pilote WIA (scansnap s510).

Tous les codes trouvés font intervenir un activeX "commondialog class" (comdlg32.ocx) sur les formulaires.

Lors que j'essaie de mettre ce contrôle sur un formulaire, j'ai un message précisant que le serveur OLE n'est pas inscrit.

J'ai donc utiliser la commande "regsvr32" sur le fichier "comdlg32.ocx", l'inscription fonctionne mais j'ai toujours (lorsque je retente l'ajout du contrôle sur le formulaire) le même message d'erreur ...

Je tourne en rond (les autres composants WIA sont également inscrit : WIAUUT.DLL, etc.) ... Quelqu'un a-t-il déjà eu ce problème ?

Je tourne sur windows seven 64bits, avec ACCESS sous "office365"
emulamateur est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/01/2012, 11h13   #2
Rédacteur/Modérateur
 
Avatar de Domi2
 
Homme
Inscription : juin 2006
Messages : 6 227
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 52
Localisation : Suisse

Informations professionnelles :
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : juin 2006
Messages : 6 227
Points : 9 939
Points : 9 939
Envoyer un message via Skype™ à Domi2
Bonjour,

Je ne connais que très peu cette solution.

Office est en version 32 ou 64 bits ?

Domi2
__________________
Vous avez des montres, nous avons le temps ! (citation attribuée à L.-S. Senghor)

Ici, on ne perd pas de temps ! On en passe...


Access : créer des codes-barres 128 en VBA
Access : les commandes intégrées des menus

Ce message (ou un autre) vous a aidé ? Votez pour lui avec
Domi2 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/01/2012, 08h20   #3
Membre régulier
 
Inscription : mars 2008
Messages : 210
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 210
Points : 70
Points : 70
Bonjour,

Office est également en 64bits.

Il semble qu'il faille adapter le code pour utiliser WIA 2.0., j'ai trouvé cet exemple en vb6 (http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx) :

Code :
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
WIA SDK sample Widget - Reloaded for XP and Win 7 64bit
>>>>>>SAVE AS: widget.vbp:
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
Reference=*\G{94A0E92D-43C0-494E-AC29-FD45948A5221}#1.0#0#C:\Windows\SysWow64\wiaaut.dll#Microsoft Windows Image Acquisition Library v2.0
Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#C:\Windows\SysWow64\scrrun.dll#Microsoft Scripting Runtime
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=Widget.frm
IconForm="Form1"
Startup="Form1"
ExeName32="Widget.exe"
Command32=""
Name="Widget"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="Microsoft Corporation"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
 
[MS Transaction Server]
AutoRefresh=1
 
>>>>>>SAVE AS: widget.frm:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5775
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8895
   LinkTopic       =   "Form1"
   ScaleHeight     =   5775
   ScaleWidth      =   8895
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command2 
      Caption         =   "Properties"
      Height          =   375
      Left            =   3000
      TabIndex        =   8
      Top             =   2640
      Width           =   1815
   End
   Begin MSComctlLib.ListView ListView4 
      Height          =   1455
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   2775
      _ExtentX        =   4895
      _ExtentY        =   2566
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin MSComctlLib.ListView ListView3 
      Height          =   855
      Left            =   120
      TabIndex        =   6
      Top             =   1680
      Width           =   2775
      _ExtentX        =   4895
      _ExtentY        =   1508
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Transfer"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   2640
      Width           =   2775
   End
   Begin VB.PictureBox VideoPreview1 
      Height          =   2895
      Left            =   5400
      ScaleHeight     =   2835
      ScaleWidth      =   3315
      TabIndex        =   3
      Top             =   120
      Width           =   3375
   End
   Begin MSComctlLib.TreeView TreeView1 
      Height          =   2415
      Left            =   3000
      TabIndex        =   2
      Top             =   120
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   4260
      _Version        =   393217
      LabelEdit       =   1
      LineStyle       =   1
      Style           =   7
      Appearance      =   1
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   1455
      Left            =   120
      ScaleHeight     =   1425
      ScaleWidth      =   2745
      TabIndex        =   1
      Top             =   120
      Width           =   2775
   End
   Begin MSComctlLib.ListView ListView2 
      Height          =   2895
      Left            =   5400
      TabIndex        =   5
      Top             =   120
      Width           =   3375
      _ExtentX        =   5953
      _ExtentY        =   5106
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   2535
      Left            =   120
      TabIndex        =   0
      Top             =   3120
      Width           =   8655
      _ExtentX        =   15266
      _ExtentY        =   4471
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.PictureBox CommonDialog1 
      Height          =   480
      Left            =   4800
      ScaleHeight     =   420
      ScaleWidth      =   1140
      TabIndex        =   9
      Top             =   2640
      Width           =   1200
   End
   Begin VB.PictureBox wia 
      Height          =   480
      Left            =   5640
      ScaleHeight     =   420
      ScaleWidth      =   1140
      TabIndex        =   10
      Top             =   240
      Width           =   1200
   End
   Begin VB.Image Image1 
      Height          =   2535
      Left            =   120
      Stretch         =   -1  'True
      Top             =   3120
      Width           =   8655
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
 
Dim CurrentItem As Item
Dim CurrentDevice As Device
Dim MinHeight As Long
Dim MinWidth As Long
Dim BottomMargin As Long
Dim RightMargin As Long
Dim MiddleMargin As Long
 
'Donald_A changed VB6 example "Widget.vbp" from WIA SDK to work both on XP and Windows 7 64bit
'Note: There are problems using the wiaaut.dll Control on Windows 7 so I deleted the Control and added wiaaut.dll as a Reference instead.
'With this change from a Control to a Reference, the x.RegisterEvent becomes irrelevant and x_OnEvent will never be called.
'Also with the change, the VideoPreview window is no longer available to add to a form, so this element will not be addressable
'
'In Win 7, additionally the img handle returned with x.executecommand(X) when called to trip the shutter is returned as a null value, rather
'than the img handle of the latest captured photo as it is in Win XP.  Additionally, since the x.executecommand(X) call does not pause processing
'in Win 7 like it does in XP, some delay logic has to be added (if not XP) before subsequent commands and controls are sent to the camera.
'This is accomplished by checking img count on the camera before the shutter is tripped, then looping until the photo count is incremented by
'one.  The same also should occur if using additional routines to copy photos to the PC, using the same type of sleep loop and FSO to check
'for the image existing on the PC, then continuing on with setting camera constants or taking more shots. 
'Consulting available donphillipe <\AT\> hot mail dot com
 
Dim WiaObj As New wia.CommonDialog
Dim WiaImg As New wia.ImageFile
Dim WiaDev As wia.Device
Dim WiaItm As wia.Item
Dim WiaDevManager As wia.DeviceManager
 
 
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'required so we can wait for photos to save if running windows 7
Dim ExecuteReturnsNull As Boolean
'end of add
 
Private Sub Form_Load()
 
    ExecuteReturnsNull = False 'well assume no Windows 7 and thus the execute command will return the image pointer to the photo we take; otherwise, we'll have
                               'to iterate the photo list later to download it
    Set WiaObj = New wia.CommonDialog
    Set WiaDevManager = New wia.DeviceManager
    Set WiaObj = New wia.CommonDialog
    Set WiaImg = New wia.ImageFile
 
    MinHeight = Me.Height
    MinWidth = Me.Width
    BottomMargin = Me.Height - ListView1.Top - ListView1.Height
    RightMargin = Me.Width - ListView1.Left - ListView1.Width
    MiddleMargin = ListView2.Left - TreeView1.Left - TreeView1.Width
 
    ListView1.ColumnHeaders.Add , , "Name", ListView1.Width / 7
    ListView1.ColumnHeaders.Add , , "Id", ListView1.Width / 7
    ListView1.ColumnHeaders.Add , , "Type", ListView1.Width / 7
    ListView1.ColumnHeaders.Add , , "Value", ListView1.Width / 7
    ListView1.ColumnHeaders.Add , , "SubType", ListView1.Width / 7
    ListView1.ColumnHeaders.Add , , "Default", ListView1.Width / 7
    ListView1.ColumnHeaders.Add , , "Values", ListView1.Width / 7
    ListView1.View = lvwReport
 
    ListView2.ColumnHeaders.Add , , "Format", ListView2.Width
    ListView2.View = lvwReport
 
    ListView3.ColumnHeaders.Add , , "Id", ListView3.Width / 3
    ListView3.ColumnHeaders.Add , , "Name", ListView3.Width / 3
    ListView3.ColumnHeaders.Add , , "Description", ListView3.Width / 3
    ListView3.View = lvwReport
 
    ListView4.ColumnHeaders.Add , , "Id", ListView3.Width / 3
    ListView4.ColumnHeaders.Add , , "Name", ListView3.Width / 3
    ListView4.ColumnHeaders.Add , , "Description", ListView3.Width / 3
    ListView4.View = lvwReport
 
    'D.A. alter
    'Note:  The WiaDevManager_OnEvent sub will not fire if you load the wiaaut.dll via a Reference and not via a Control
    '       However, I have left the code intact for future reference and to match the original Widget example that uses Control
    WiaDevManager.RegisterEvent wiaEventDeviceConnected
    WiaDevManager.RegisterEvent wiaEventDeviceDisconnected
 
    BuildTree
 
    'end of add
 
End Sub
 
 
 
Private Sub BuildTree()
 
    Dim di As DeviceInfo
    Dim dev As Device
    Dim nde As Node
 
    'D.A.
    Dim devices As Integer
    devices = 0
 
    ListView1.ListItems.Clear
    TreeView1.Nodes.Clear
 
    'D.A. change for no control
    For Each di In WiaDevManager.DeviceInfos
    'For Each di In wia.DeviceInfos
        devices = devices + 1
        Set dev = di.Connect
        If Not dev Is Nothing Then
            Set nde = TreeView1.Nodes.Add(, , , di.Properties("Name").Value)
            Set nde.Tag = dev
            EnumChildren dev.Items, nde
        End If
    Next
    If devices = 0 Then
        MsgBox "No devices were found ...."
        End
    End If
 
End Sub
 
Private Sub EnumChildren(ByRef itms As Items, ByRef nde As Node)
    Dim itm As Item
    Dim newNode As Node
 
    For Each itm In itms
        Set newNode = TreeView1.Nodes.Add(nde.Index, tvwChild, , itm.Properties("Item Name").Value)
        Set newNode.Tag = itm
        If itm.Items.Count > 0 Then EnumChildren itm.Items, newNode
    Next
End Sub
 
Private Sub Command2_Click()
    If Not CurrentItem Is Nothing Then
        'D.A. change
        'CommonDialog1.ShowItemProperties CurrentItem
        WiaObj.ShowItemProperties CurrentItem
    End If
 
    If Not CurrentDevice Is Nothing Then
        'D.A. change
        'CommonDialog1.ShowDeviceProperties CurrentDevice
        WiaObj.ShowDeviceProperties CurrentDevice
    End If
End Sub
 
 
Private Function PropType(id As WiaPropertyType) As String
    Select Case id
    Case BooleanPropertyType
        PropType = "Boolean"
    Case BytePropertyType
        PropType = "Byte"
    Case ClassIDPropertyType
        PropType = "Class ID"
    Case CurrencyPropertyType
        PropType = "Currency"
    Case DatePropertyType
        PropType = "Date"
    Case DoublePropertyType
        PropType = "Double"
    Case ErrorCodePropertyType
        PropType = "Error Code"
    Case FileTimePropertyType
        PropType = "File Time"
    Case HandlePropertyType
        PropType = "Handle"
    Case IntegerPropertyType
        PropType = "Integer"
    Case LargeIntegerPropertyType
        PropType = "Large Integer"
    Case LongPropertyType
        PropType = "Long"
    Case ObjectPropertyType
        PropType = "Object"
    Case SinglePropertyType
        PropType = "Single"
    Case StringPropertyType
        PropType = "String"
    Case UnsignedIntegerPropertyType
        PropType = "Unsigned Integer"
    Case UnsignedLargeIntegerPropertyType
        PropType = "Unsigned Large Integer"
    Case UnsignedLongPropertyType
        PropType = "Unsigned Long"
    Case VariantPropertyType
        PropType = "Variant"
    Case VectorOfBooleansPropertyType
        PropType = "Vector Of Booleans"
    Case VectorOfBytesPropertyType
        PropType = "Vector Of Bytes"
    Case VectorOfClassIDsPropertyType
        PropType = "Vector Of Class IDs"
    Case VectorOfCurrenciesPropertyType
        PropType = "Vector Of Currencies"
    Case VectorOfDatesPropertyType
        PropType = "Vector Of Dates"
    Case VectorOfDoublesPropertyType
        PropType = "Vector Of Doubles"
    Case VectorOfErrorCodesPropertyType
        PropType = "Vector Of Error Codes"
    Case VectorOfFileTimesPropertyType
        PropType = "Vector Of File Times"
    Case VectorOfIntegersPropertyType
        PropType = "Vector Of Integers"
    Case VectorOfLargeIntegersPropertyType
        PropType = "Vector Of Large Integers"
    Case VectorOfLongsPropertyType
        PropType = "Vector Of Longs"
    Case VectorOfSinglesPropertyType
        PropType = "Vector Of Singles"
    Case VectorOfStringsPropertyType
        PropType = "Vector Of Strings"
    Case VectorOfUnsignedIntegersPropertyType
        PropType = "Vector Of Unsigned Integers"
    Case VectorOfUnsignedLargeIntegersPropertyType
        PropType = "Vector Of Unsigned Large Integers"
    Case VectorOfUnsignedLongsPropertyType
        PropType = "Vector Of Unsigned Longs"
    Case VectorOfVariantsPropertyType
        PropType = "Vector Of Variants"
    Case Else
        PropType = "Unsupported"
    End Select
End Function
 
Private Sub EnumCommands(ByRef cmds As DeviceCommands)
    Dim i As Integer
    Dim cmd As DeviceCommand
    Dim li As ListItem
 
    ListView3.ListItems.Clear
 
    If cmds.Count > 0 Then
        For Each cmd In cmds
            Set li = ListView3.ListItems.Add(, , cmd.CommandID)
            li.SubItems(1) = cmd.Name
            li.SubItems(2) = cmd.Description
        Next
    End If
End Sub
 
Private Sub EnumEvents(ByRef evts As DeviceEvents)
    Dim i As Integer
    Dim evt As DeviceEvent
    Dim li As ListItem
 
    ListView4.ListItems.Clear
 
    If evts.Count > 0 Then
        For Each evt In evts
            Set li = ListView4.ListItems.Add(, , evt.EventID)
            li.SubItems(1) = evt.Name
            li.SubItems(2) = evt.Description
        Next
    End If
End Sub
 
Private Sub EnumFormats(ByRef fmts As Formats)
    Dim v As Variant
    Dim i As Integer
 
    ListView2.ListItems.Clear
 
    If fmts.Count > 0 Then
        For Each v In fmts
            ListView2.ListItems.Add , , v
        Next
    End If
End Sub
 
Private Sub EnumProperties(ByRef props As Properties, ByRef ThumbnailData As Vector, ByRef ThumbnailWidth As Long, ByRef ThumbnailHeight As Long)
    Dim p As Property
    Dim i As Long
    Dim s As String
    Dim li As ListItem
    Dim v As Vector
    Dim pc As Integer
 
    On Error GoTo BadDriver
 
    ListView1.ListItems.Clear
 
    pc = 0
 
    If props.Count > 0 Then
        For Each p In props
            Set li = ListView1.ListItems.Add(, , p.Name)
            Set li.Tag = p
            li.SubItems(1) = p.PropertyID
            li.SubItems(2) = PropType(p.Type)
            If Not p.IsVector Then
                li.SubItems(3) = p.Value
            Else
                s = ""
                Set v = p.Value
                For i = 1 To v.Count
                    s = s & CStr(v(i))
                    If i < 50 Then
                        If i <> v.Count Then
                            s = s & ", "
                        End If
                    Else
                        s = s & ", ... (Size = " & v.Count & ")"
                        Exit For
                    End If
                Next
                li.SubItems(3) = s
            End If
            If p.Name = "Thumbnail Data" Then Set ThumbnailData = p.Value
            If p.Name = "Thumbnail Width" Then ThumbnailWidth = p.Value
            If p.Name = "Thumbnail Height" Then ThumbnailHeight = p.Value
            Select Case p.SubType
            Case ListSubType
                li.SubItems(4) = "List"
                li.SubItems(5) = p.SubTypeDefault
                s = ""
                Set v = p.SubTypeValues
                For i = 1 To v.Count
                    s = s & CStr(v(i))
                    If i < 50 Then
                        If i <> v.Count Then
                            s = s & ", "
                        End If
                    Else
                        s = s & ", ... (Size = " & v.Count & ")"
                        Exit For
                    End If
                Next
                li.SubItems(6) = s
            Case FlagSubType
                li.SubItems(4) = "Flags"
                li.SubItems(5) = p.SubTypeDefault
                s = ""
                Set v = p.SubTypeValues
                For i = 1 To v.Count
                    s = s & CStr(v(i))
                    If i <> v.Count Then
                        s = s & ", "
                    End If
                Next
                li.SubItems(6) = s
            Case RangeSubType
                li.SubItems(4) = "Range"
                li.SubItems(5) = p.SubTypeDefault
                li.SubItems(6) = "Min = " & p.SubTypeMin & ", Max = " & p.SubTypeMax & ", Step = " & p.SubTypeStep
            Case Else
                li.SubItems(4) = "Unspecified"
            End Select
BadDriverResume:
            pc = pc + 1
        Next
    End If
 
    Exit Sub
BadDriver:
    If Err.Number = -2145320836 Then
        MsgBox Err.Description, vbOKOnly, p.Name & " Property"
        Err.Clear
        Resume BadDriverResume
    Else
        MsgBox Err.Description
        Resume
    End If
End Sub
 
 
 
 
Private Sub Command1_Click()
    If Not CurrentItem Is Nothing Then
        Dim img As ImageFile
        'D.A. changed
        'Set img = CommonDialog1.ShowTransfer(CurrentItem)
        Set img = WiaObj.ShowTransfer(CurrentItem)
        If Not img Is Nothing Then
            Set Image1.Picture = img.FileData.Picture
            ListView1.Visible = False
        End If
    End If
End Sub
 
Private Sub ListView3_DblClick()
    Dim li As ListItem
    Set li = ListView3.SelectedItem
    Dim itm As wia.Item
    Dim img As wia.ImageFile
    Dim dev As wia.Device
    Dim di As wia.DeviceInfo
    Dim pItmCtr As Integer, cItmCtr As Integer, forCtr As Integer
 
    If Not CurrentDevice Is Nothing Then
        pItmCtr = CurrentDevice.Items.Count             'the count of photos on the card before we fire the shutter
        Set itm = CurrentDevice.ExecuteCommand(li.Text)
        If itm Is Nothing Then  'WIA returns null for "itm" when running this on Windows 7 so we have to search the images to find the last one
             ExecuteReturnsNull = True  'A null value for itm flags this as a Windows 7 system
             For forCtr = 1 To 100   'we keep comparing the count before and after the photo taken until it increases by 1
                Sleep (200)         'then we assume the missing handle from the execute command will be the last image in the list
                cItmCtr = CurrentDevice.Items.Count     'and we use the last photo in the batch on the camera card to display
                If pItmCtr <> cItmCtr Then Exit For
             Next
             If pItmCtr <> cItmCtr Then
                Set itm = CurrentDevice.Items.Item(cItmCtr)
                If Not itm Is Nothing Then
                    Set img = WiaObj.ShowTransfer(itm)
                    If Not img Is Nothing Then
                       Set Image1.Picture = img.FileData.Picture
                       ListView1.Visible = False
                    End If
                End If
             Else
                MsgBox "A timeout occured waiting for an image to be created on camera after shutter fired."
                Exit Sub
             End If
        Else
            Set img = WiaObj.ShowTransfer(itm)
            If Not itm Is Nothing Then
                'D.A. changed
                'Set img = CommonDialog1.ShowTransfer(itm)
                Set img = WiaObj.ShowTransfer(itm)
                If Not img Is Nothing Then
                    Set Image1.Picture = img.FileData.Picture
                    ListView1.Visible = False
                End If
            End If
        End If
    End If
    If Not CurrentItem Is Nothing Then
        pItmCtr = CurrentItem.Items.Count
        Set itm = CurrentItem.ExecuteCommand(li.Text)
        If itm Is Nothing Then  'WIA returns null for "itm" when running this on Windows 7 so we have to search the images to find the last one
             ExecuteReturnsNull = True  'A null value for itm flags this as a Windows 7 system
             For forCtr = 1 To 100   'we keep comparing the count before and after the photo taken until it increases by 1
                Sleep (200)         'then we assume the missing handle from the execute command will be the last image in the list
                cItmCtr = CurrentItem.Items.Count     'and we use the last photo in the batch on the camera card to display
                If pItmCtr <> cItmCtr Then Exit For
             Next
             If pItmCtr <> cItmCtr Then
                Set itm = CurrentItem.Items.Item(cItmCtr)
                If Not itm Is Nothing Then
                    Set img = WiaObj.ShowTransfer(itm)
                    If Not img Is Nothing Then
                       Set Image1.Picture = img.FileData.Picture
                       ListView1.Visible = False
                    End If
                End If
             Else
                MsgBox "A timeout occured waiting for an image to be created on camera after shutter fired."
                Exit Sub
             End If
        Else
            Set img = WiaObj.ShowTransfer(itm)
            If Not img Is Nothing Then
                Set Image1.Picture = img.FileData.Picture
                ListView1.Visible = False
            End If
        End If
    End If
 
    BuildTree
    'D.A. No longer valid since the Control eliminated for Reference"
 
    WiaDevManager.RegisterEvent wiaEventDeviceConnected
    WiaDevManager.RegisterEvent wiaEventDeviceDisconnected
    'Original:
    'wia.RegisterEvent wiaEventDeviceConnected
    'wia.RegisterEvent wiaEventDeviceDisconnected
 
End Sub
 
 
Private Sub ListView4_DblClick()
    Dim li As ListItem
    Set li = ListView4.SelectedItem
    If Not CurrentDevice Is Nothing Then
        On Error Resume Next
        WiaObj.RegisterEvent li.Text, CurrentDevice.DeviceID
        If Err.Number <> 0 Then
            MsgBox Err.Description
        End If
    End If
End Sub
 
Private Sub Image1_Click()
    ListView1.Visible = True
End Sub
 
Private Sub Form_Resize()
    If Me.Width < MinWidth Then Me.Width = MinWidth
    If Me.Height < MinHeight Then Me.Height = MinHeight
 
    ListView1.Width = Me.Width - ListView1.Left - RightMargin
    ListView1.Height = Me.Height - ListView1.Top - BottomMargin
    Image1.Width = ListView1.Width
    Image1.Height = ListView1.Height
 
    ListView2.Left = Me.Width - ListView2.Width - RightMargin
    VideoPreview1.Left = ListView2.Left
 
    TreeView1.Width = ListView2.Left - TreeView1.Left - MiddleMargin
    Command2.Width = TreeView1.Width
End Sub
 
 
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    Dim itm As Item
    Dim dev As Device
    Dim ThumbnailData As Vector
    Dim ThumbnailWidth As Long
    Dim ThumbnailHeight As Long
 
    Set ThumbnailData = Nothing
    ThumbnailWidth = 0
    ThumbnailHeight = 0
 
    If TypeOf Node.Tag Is Item Then
        Set itm = Node.Tag
        Set CurrentDevice = Nothing
        Set CurrentItem = itm
        'Set Picture1.Picture = itm.Thumbnail
        EnumProperties itm.Properties, ThumbnailData, ThumbnailWidth, ThumbnailHeight
        If Not ThumbnailData Is Nothing Then
            If ThumbnailWidth <> 0 Then
                If ThumbnailHeight <> 0 Then
                    Set Picture1.Picture = ThumbnailData.Picture(ThumbnailWidth, ThumbnailHeight)
                End If
            End If
        End If
        EnumFormats itm.Formats
        EnumCommands itm.Commands
        ListView2.ZOrder
        Picture1.ZOrder
    Else
        Set dev = Node.Tag
        Set CurrentItem = Nothing
        Set CurrentDevice = dev
        If dev.Type = VideoDeviceType Then
            'D.A. changed
            'The VideoPreview control from WIA is no longer available when when we call as a Reference
            'Set VideoPreview1.Device = dev
            MsgBox "Video window does not exist if using wiaaut.dll Reference instead of Control"
        End If
        EnumProperties dev.Properties, ThumbnailData, ThumbnailWidth, ThumbnailHeight
        EnumCommands dev.Commands
        EnumEvents dev.Events
        ListView4.ZOrder
        VideoPreview1.ZOrder
    End If
 
 
End Sub
 
Private Sub WiaDevManager_OnEvent(ByVal EventID As String, ByVal DeviceID As String, ByVal ItemID As String)
    'D.A. changes
    'Note:  The WiaDevManager_OnEvent sub will not fire if you load the wiaaut.dll via a Reference and not via a Control
    '       However, I have left the code intact for future reference
   ' MsgBox "RECEIVED EVENT!" & vbCrLf & vbCrLf & _
   '     "EventID = """ & EventID & """" & vbCrLf & _
   '     "DeviceID = """ & DeviceID & """" & vbCrLf & _
   '     "ItemID = """ & ItemID & """"
 
    If EventID = wiaEventDeviceConnected Then
        BuildTree
    ElseIf EventID = wiaEventDeviceDisconnected Then
        BuildTree
    Else
        MsgBox "RECEIVED EVENT!" & vbCrLf & vbCrLf & _
        "EventID = """ & EventID & """" & vbCrLf & _
        "DeviceID = """ & DeviceID & """" & vbCrLf & _
        "ItemID = """ & ItemID & """"
    End If
 
End Sub
Bien évidemment, je ne vois pas ce que je dois récupérer pour access qui, sauf erreur, ne connaît pas les "widgets" ...

Il semble surtout que WIA ait quelques soucis sous seven (http://www.vbforums.com/archive/index.php/t-662377.html)

Une piste est proposée mais je ne sais pas comment l'utiliser dans le code :

Code :
1
2
3
4
5
Dim oWIACd as WIA.CommonDialog
Dim oImageFile as ImageFile
 
     Set oWIACd = new WIA.CommonDialog
     Set oImageFile = oWIACd.showAcquireImage
emulamateur est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/01/2012, 08h58   #4
Rédacteur/Modérateur
 
Avatar de Philippe JOCHMANS
 
Homme Philippe JOCHMANS
Développeur informatique
Inscription : mai 2005
Messages : 17 625
Détails du profil
Informations personnelles :
Nom : Homme Philippe JOCHMANS
Âge : 44
Localisation : France, Loir et Cher (Centre)

Informations professionnelles :
Activité : Développeur informatique
Secteur : Communication - Médias

Informations forums :
Inscription : mai 2005
Messages : 17 625
Points : 30 945
Points : 30 945
Envoyer un message via MSN à Philippe JOCHMANS Envoyer un message via Skype™ à Philippe JOCHMANS
Bonjour

Office 64 bits, lire cela avant : http://arkham46.developpez.com/artic...ice/vba64bits/

Philippe
__________________
Détaillez vos questions, sinon vous aurez des réponses erronées et vous irez tout droit dans le et lisez les règles sinon
Si vous pensez commencer sans un livre, oublier : livres pour débuter
Vous pouvez consulter mes articles sur Access et PowerPoint
Le blog Office.

Inutile de m'envoyer un MP pour des questions techniques ou de me relancer , je n'y répondrais pas.
Philippe JOCHMANS est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/01/2012, 10h12   #5
Membre régulier
 
Inscription : mars 2008
Messages : 210
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 210
Points : 70
Points : 70
Bonjour,

J'avais déjà lu cet article, notamment avec les pbs d'icônes dans le ruban ...

Bref, j'ai pas le choix ... je ne peux qu'utiliser la version 64bits
emulamateur est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/01/2012, 06h17   #6
Membre régulier
 
Inscription : mars 2008
Messages : 210
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 210
Points : 70
Points : 70
Le problème se pose également sur une installation "full" 32bits de seven et office
emulamateur est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 20h50.


 
 
 
 
Partenaires

Hébergement Web