Getting Device Info
hi
can anyone tell me anything on retriving device information..in my application i want to retrive which sound card is installed on the system and what type of speakers are being used..and check if i can test my audio output device (speaker) to play a sound if soud card is detected on my system.
__________________ VB leaves me weeping all the time...everytime...
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting Info From A Device Via RS232
Hello
i have received from the vendor of a device for cars the information in order to obtain a real time info from the engine.
Here is the info he has sended to me:
Quote:
Data starts streaming 15 seconds after power up.
> >Output Data Format
> >
> > RS 232
> >
> > Baud rate 9600
> >
> > Data 8 bit
> >
> > Parity None
> >
> > Stop 1 bit
> >
> > Flow Control None
> >
> > Header block
> > #00 null heading
> >
> > #01 start heading
> >
> > #02 start text
> >
> > Data block: data format
> >
> > AFR HEX 8 bit
> >
> > EGT LSB HEX 16 bit
> >
> > EGT MSB HEX 16 bit
> >
> > RPM LSB HEX 16 bit
> >
> > RPM MSB HEX 16 bit
> >
> > Boost LSB HEX 16 bit
> >
> > Boost MSB HEX signed
> >
> > TPS HEX 8 bit
> >
> > User1 HEX 8 bit
> >
> > Config Register HEX 8 bit
> >
> > Possible check sum of all of the above. Not implemented at this point.
> >
> > Data details:
> >
> > All 8 bit and 16 bit numbers need to be converted to decimal
equivalents.
i can connect to the device and receive a lot of info, and i have knowledge of vb, but i have not knowledge with the rs232 comms. Then im absolutly ko and i a dark hole without exit...
Can anyone give me the way in order to receive the info?
Thanks very very very much in advance.
Reading Device Info From COM Port
Have a device attached to the com port wich reads info from the comm port.
When connected to Hyper Terminal the output looks like :
Code:
COMPANY OHCI root hub, class NUMBER/NUMBER, rev NUMBER/NUMBER, addr NUMBER
USB attached: USB-Hub.
COMPANY Technology Inc. product 0xNUMBER, class NUMBER/NUMBER, rev NUMBER/NUMBER, addr NUMBER
USB attached: USB-Bridge.àü##1P
HDD OK
Model: NUMBER
LBA : NUMBER
VCO OVERLAP OK
CARD OK
NUMBER
NUMBER
NUMBER
+------------------------------+
| BOOT VERSION : <NUMBER> |
| HARDWARE VERSION : <NUMBER> |
| SOFTWARE VERSION : <NUMBER> |
+------------------------------+
LNUMBER
QNUMBER
But when I have the input from my program I get also weird chars in it
Like ■ (but then a open square).
Above is with a timer set on 100
When I use MSComm_OnComm
Code:
Select Case MSComm.CommEvent
' Handle each event or error by placing
' code below each case statement
' Errors
Case comEventBreak ' A Break was received.
Info.SelText = "A Break was received" & vbCrLf
Case comEventFrame ' Framing Error
Info.SelText = "Framing Error" & vbCrLf
Case comEventOverrun ' Data Lost.
Info.SelText = "Data Lost" & vbCrLf
Case comEventRxOver ' Receive buffer overflow.
Info.SelText = "Receive buffer overflow" & vbCrLf
Case comEventRxParity ' Parity Error.
Info.SelText = "Parity Error" & vbCrLf
Case comEventTxFull ' Transmit buffer full.
Info.SelText = "Transmit buffer full" & vbCrLf
Case comEventDCB ' Unexpected error retrieving DCB]
Info.SelText = "Unexpected error retrieving DCB]" & vbCrLf
' Events
Case comEvCD ' Change in the CD line.
Info.SelText = "Change in the CD line" & vbCrLf
Case comEvCTS ' Change in the CTS line.
Info.SelText = "Change in the CTS line" & vbCrLf
Case comEvDSR ' Change in the DSR line.
Info.SelText = "Change in the DSR line" & vbCrLf
Case comEvRing ' Change in the Ring Indicator.
Info.SelText = "Change in the Ring Indicator" & vbCrLf
Case comEvReceive ' Received RThreshold # of
' chars.
Info.SelText = "Received RThreshold # of chars" & vbCrLf
Case comEvSend ' There are SThreshold number of
' characters in the transmit
' buffer.
Info.SelText = "There are SThreshold number of characters in the transmit buffer" & vbCrLf
Case comEvEOF ' An EOF charater was found in
' the input stream
Info.SelText = "An EOF charater was found in the input stream" & vbCrLf
End Select
I get
Change in the CTS line
Change in the CD line
Change in the CD line
Change in the CTS line
A Break was received
A Break was received
What am I doing wrong
When showing the event codes with a timer I get
Code:
Private Sub Timer1_Timer()
'Info.SelText = MSComm.CommEvent & vbCrLf
End Sub
0
0
0
0
5
5
1001
1001
1001
1001
1004
1004
En then it stays that way
"ASSOCIATORS OF" In WMI, Getting The Driver Info About A Device
Hello, I trie to get the driver object in WMI with the use of ASSOCIATORS OF keyword, but get a "Bad object path" error an a Automation error
this is the Code I am using:
Code:
Dim strBuffer As String, Sound_Devices As Object, SD As Object
strBuffer = ""
'Set the Operating System object
Set Sound_Devices = WMI.Instance("Win32_SoundDevice")
strBuffer = "Total: " & Sound_Devices.Count & " Audio devices."
For Each SD In Sound_Devices
Dim Driver2 As Object, Drivers As Object, Driver As Object, strQuery As String
strQuery = "ASSOCIATORS OF {Win32_SoundDevice.DeviceID=""" & SD.DeviceID & """}"
Debug.Print strQuery
Set Drivers = WMI.Query(strQuery)
Debug.Print Drivers.Count
For Each Driver2 In Drivers
'Set Driver = Driver2
Debug.Print Driver2.Description
Next
Dim lError As Long, sDescription As String
If Not SD.lasterrorcode = vbNull Then lError = SD.lasterrorcode
If Not SD.errordescription = vbNull Then sDescription = SD.errordescription
If sDescription = "" Then sDescription = "No Error"
strBuffer = strBuffer & vbNewLine & vbNewLine & _
SD.Caption & " ( " & SD.Status & " )" & vbNewLine & _
"( " & SD.PNPDeviceID & " ) " & vbNewLine & _
SD.Manufacturer & vbNewLine & _
lError & ": " & sDescription & vbNewLine & _
"Installed: " & ConvertDate(SD.InstallDate) & vbNewLine
'"ASSOCIATORS OF {IIsWebVirtualDir='W3SVC/1/Root'} WHERE ResultClass = IIsWebVirtualDir ResultRole = GroupComponent"
'ASSOCIATORS OF {ObjectPath} WHERE AssocClass = AssocClassName
Debug.Print strBuffer
Next
Does anyone have thoughts about this?(How to do it better, atleast make it work..)
Thx
[edit] here is Associators Of at MSDN
Getting Device List From Device Manager With Setupapi
I had need to figure out which COM port a USB-serial converter was installed as. If you looked under Device Manager, it was easy to tell from the names. First I tried EnumPorts, but that just gave me the COM number and 'Local Port'. I tried using the WMI, but the device I was looking for was the one that it wouldn't list for some reason. (Worked fine for my other virtual COM port USB device.) So I stumbled onto the setupapi library, but there was no VB examples, only some C. So through some trial and error, I devised a DeviceLister VB6 class to get names and descriptions of devices. It could be changed to include more, but I stopped at names/descriptions.
By five-cent example returns a list of 'Ports' devices (your results will vary):
ECP Printer Port (LPT1)
Communications Port (COM1)
Digi PKG-U Serial Port Adapter (COM16)
^-that last one was the sucker I was after
I thought 'Hey I wonder if anyone else would be looking for this?' so I post it here. It's not the prettiest implementation, but might be a starting point for someone.
Note: The MSDN seems to indicate that this only works for Win2k and beyond.
EDIT: I added an example of retrieving all devices. Also I setup an option to list devices that are not present. Now I can see ports that were installed but aren't active.
Edited by - FD 80 on 6/20/2008 11:35:57 AM
Uninstall A Device From Device Manager.
Hi all,
Is there a way to uninstall a device in device manager with vb6?
I've run into a rootkit that I am trying to make a tool of mine remove. I've tried simply stopping the service but this can cause BSOD's which we all know are fun in windows.
As always any help is appreciated,
Dave
I NEED INFO: Source/Info Using VB.NET && TCP/IP Multi Connects At Same Time.
I need help in finding information on the following:
TCP/IP Multiple connections at the same time using VB.NET.
I have a host machine and I will be receiving multiple msg from multi machines at the same time.
I am not sure where to start using .NET so I need any places on the web that people may have come across that can give me a good start. PLEASE.
Cheers
Storing Logon Info For Persistence Of Info
i would like to ask you more experienced people what would be the best way to store logon info for an individual user. i was looking at an encrypted file, the registry with encrypted data, or even a datadase, ditto, so that it is available next time the program runs. or can one modify the program which is running to include this data next time.
thank you in advance,
jomamameister
Device Context VS Memory Device Context?
Hi. In my spare time ive been reading some sttuff on windows graphics programming
and it seems to be an important topic that of the DeviceContexts, well, what
i have read says that the DC is an object that let me work with devices like
printers, windows (((how is it a window is a device??))). Ok it is like a VB object
but what about the Printer object or the Screen object is that the same?
Also, i read about memory device contexts too, and that i really dont understand it...
im not saying go into deep explanation but what is the difference between MDC and DC... and do i need to worry about it?
System Info And Connection Info
Hi folks,
I want to make a little program which stays running on the background which tells me how much free disk space is left and what the up and downstream is. Where do i begin? i have made the window with al object but i don't know how to get system info like i need
can anybody help me with this?
ListView ? - Select Info In One, Sub Info In Another, Etc.
Well I haven't really done any VB since 5.0 and I think most of the stuff would be the same, but I haven't done a project this in depth yet. I just bought the Mastering VB 6.0 book, but doesn't seem to have the info I am looking for.
I have an app that searches the hd for data files, mp3, mpeg, txt, doc, etc. I have 4 listview's on my form called ListView1, ListView2, ListView3, and ListView4. I currently have all the files it finds listed in the first listview (ListView1), but what I would like it to do instead is:
Column1 listed in ListView1
once something is selected in the ListView1, ListView2 opens with the appropriate sub information which is currently Column2.
Column2 listed in ListView2
Again the same thing goes into ListView3. But instead of following to ListView4 when selecting the item in ListView3, it will list all the Columns from the first ListView's (1 - 3). I have seen some light information in regards to this by searching the forums, but nothing specific.
Any help would be greatly appreciated. The items are currently listed by Tags also if that helps.
Thanks, Corey
Get Vga Card Info And Ram Info
hehe sry for all this questions .. But can some one tell me the code to get vga info and ram info of the pc .. ?? Thank =)
Usb Gps Device
hi:
i recently bougth a gps receiver, and i want to access to it via vb. my gps starts recording points on its memory, and when i plug it it has a type "A" connector (USB) in the gps software retreives the points and exports them to google earth, the gps software is pretty bad it doesnt offer you many options so i am planning on making my own gps software, the problem is i dont know how to access the USB device. i supose that if i can acces the gps memory, i can retrieve all the data of the points, thanks.
Run .chm From Any Cd-rom Device?
Hi guys
I am trying to make my program run a .chm (compiled help file) from the program's working directory (ie the cd rom) but it is not loading. If i change the code to tell the program to find the .chm from the e: (my second cd rom device), it will run.
Can you programme it so it loads from the current working directory, without having to specify the path?
Here is my code:
Private Sub cmdHelp_Click()
Set wShell = CreateObject("Shell.Application")
wShell.Open "e:Help.chm"
End Sub
This code works fine, but if i delete the "e:", it doesn't find it.
I want this code to work across all (cd rom) drives, not just e:
Cheers - Diver.
CD/DVD-ROM Device Name
Hi,
help me please with read CD/DVD-ROM device name and device-letter (E:).
Combo1.Clear
For i = 0 To 2
For c = 0 To 1
If getstring(HKEY_LOCAL_MACHINE, "hardwaredevicemapscsiScsi Port " & i & "Scsi Bus 0Target Id " & c & "Logical Unit Id 0", "type") = "CdRomPeripheral" Then
Combo1.AddItem getstring(HKEY_LOCAL_MACHINE, "hardwaredevicemapscsiScsi Port " & i & "Scsi Bus 0Target Id " & c & "Logical Unit Id 0", "Identifier")
Debug.Print vbCrLf & getstring(HKEY_LOCAL_MACHINE, "hardwaredevicemapscsiScsi Port " & i & "Scsi Bus 0Target Id " & c & "Logical Unit Id 0", "Identifier")
End If
Next c
Next i
with this I get name of CD/DVD device but I need know device-letter (E:) of every d evice.
I have E: (DVD-ROM: TOSHIBA DVD-ROM SD-M1612) and F: (TEAC CD-W540E) and I need this get with my program.
Help me please.
USB Device
I am trying to build a USB connected device.
I want to use the USB HID mode. my hardware will be 3 binary switch closures. No Output at all, just inputs.
Any ideas on how to get this to work on the software side?
I was hoping to use a standard windows driver so that it would be easier to install and I would not have to write the driver then!
thanks. if you have USB design experience I would love to hear from you. google does not seem to have much in the way of technical documents. A lot of sites selling USB services.
Name Of USB Device
I basically need to know how to get the name of the device attatched to each usb port. Like when you plug something in and windows pops up and knows exactaly what it is (sometimes lol).
I can view all of the properties such as IRQs and junk , but I want to be able to say usb port one and click a button and have it say something like "Logitech MX 1000", etc, etc.
Thanks,
Slick
[EDIT]
What I actually need this for: I have a Com port hub (4 com ports connected to laptop through usb). Windows detects them as Com Ports, but "Com Port 1" is stamped beside the port on hub and windows assigns it a random Com Port. This gets confusing and is a real pain when programming.
Ex:
I have a device (camera) on "Com port 2" of hub and windows calls it com port 5. So I tell my app that com port 5 is camera, but when i unplug the hub from laptop and plug it back in, it will not be com port 5 anymore so my program does not work. I will always have the camera plugged into "Com Port 2" on the hub, but I need the above to figure out what logical port (windows) it is hooked up to. So I can say whats on logical Com Port 7? Ah Camera and set this in my program.
Kinda confusing, but thanks in advance for your help!
Use An Usb Device With Vb Help
I have an usb device and windows xp and the drivers that comes with the usb device doesn't work with win xp.
i would like to know if i can make a vb program that can comunicate with this device.
Thanks for any help.
Getting A Device ID?
Declare Function mciGetDeviceID Lib "winmm.dll" Alias "mciGetDeviceIDA" (ByVal lpstrName As String) As Long
Does anyone how to use the above function?? I am not sure what to put for lpstrName! Can anyone give some examples?
Getting A Device Name (VB6)
Hi,
Does anyone know how to get a hardware device name + description usingVB6?
For example, i have a third party serial COM port installed in my PCwhich is listed as something else other
than the standard "Communications Port (COMx)" in device manager... howdo i obtain this listed description?
Regards,
Darren
USB Device
Hi;
i have a fingerprint device, and i need to access it from within VB ( iam not planing to use the product SDK ) i need a hint on how to check a USB device from VB
regards
sam
EVB On An CE.NET 4.2 Device
Hello,
I have an old PocketPC application written in eVB that I need to install on a PSC Falcon 4220 running CE.NET 4.2.
But when I try to run it gives me this error message: "Application error Cannot find extension file Forms Data. Pleas run setup to restore this file."
Even the simplest "Hello world" application won't run!
On a message board elsewhere I found a message of someone saying eVB is not supported on CE.NET 4.2.
Is this really true? Is there any other way to make an eVB application work on a CE.NET 4.2 device or do I have to buy a very expensive Visual Studio .NET licence and rewrite the whole application in .NET !?!?
Chris
USB Device
How can I send a win32 command to a USB device?23
PCI Device List
Hi all,
I have a problem thats not Xtreme and not really VB.
I need to create a list of PCI devices installed in an XP system using Delphi. If anybody has any ideas on where to find the information that could be used to create such a list then please let me know. I'm certain the relevant information must be stored in the Registry somewhere.
I'm certain it isnt that hard and definatley not 'Xtreme', but so far nobody can point to where that info is stored.
Dan
What's A Device Context?
Hi,
I'm trying to make a semi-transparent textbox. And I want a background image on it, so I am trying to understand this tutorial:
http://www.vbaccelerator.com/home/VB...ox/article.asp
But It keeps talking about a DC, which is device context.
What is it?
And how to I link a class (or even make one???) and link it to a textbox??
Please help!
Thank you!
-compuXP
(cause I dunno the first thing about this)
Connecting To A Device, Need Some Help
Hello, I have created a device, but have som problem accessing the "IRP",
this is the Code I used to create the IRP file:
Code:
const WCHAR deviceNameBuffer[] = L"\Device\MyDevice2";
PDEVICE_OBJECT g_RootkitDevice;
nRet =IoCreateDevice (DrvObj, sizeof(65533), &deviceName, 0x00000022, 0, TRUE, &g_RootkitDevice);
if (NT_SUCCESS(nRet)) {
DbgPrint("IoCreateDevice Succeded.");
} else if (NT_INFORMATION(nRet)) {
DbgPrint("IoCreateDevice returned Information");
} else if (NT_WARNING(nRet)) {
DbgPrint("IoCreateDevice returned Warning");
} else if (NT_ERROR(nRet)) {
DbgPrint("IoCreateDevice returned error");
DbgPrint("%x
", nRet);
}
and this is the code I use in vb6 to access the file created...
(btw I know the file is created because "IoCreateDevice Succeeded" return to DbgView)
Code:
Private Sub Form_Load()
Open "\DeviceMyDevice2" For Binary As #1
Close #1
End Sub
The function fails with the error code 76, "Path not found", any idea why?
So What Actually Is A Device Context?
Can someone explain precisely what the terms device context, bitmap and handle mean, and how they relate to each other?
The background is, I'm trying to find the "best" way to load a bitmap file into memory and then blit it to a buffer and ultimately to a Form or PictureBox. I've used BitBlt before, but I've only really copied examples and haven't properly understood what is going on. I've read loads of things like "Select the bitmap into the DC" but don't really understand them fully.
DX8 Device Units
Hi,
This question could have been asked before, but I could not find the answer (not even in DX8 documentation).
When you specify a position for a vector, in what units do you do that? (meaning much like ScaleMode property in VB). Is there any way to change these units? If no, then is there any way to convert between them and standard measurment units (English and International)?
Let's say I want to draw a 30 meter landscape or a 41 feet landscape, or a square of 1 feet 25 inches. What do I specify for the coordinates?
Regards,
Val
USB - Device Names
Hi,
I'm trying to connect to USB devices using code below, but are unsure how the HID.dll presents the device names. If I try 'Device Manager' and use the names under USB controllers, these names are not recognised. Ultimately I will be communicating with a GPS unit, and will not be going down the mscomm32 path due to licensing restrictions.
Quote:
Public Function OpenUSBdevice(NameOfDevice$) As Boolean
' This function searches the system HID tables for NameOfDevice$
' If found then it opens the device and returns TRUE, else it returns FALSE
Dim HidGuid As Guid
Dim Success As Boolean
Dim Openned As Boolean
Dim Buffer(256) As Byte
Dim DeviceInterfaceData As Device_Interface_Data
Dim FunctionClassDeviceData As Device_Interface_Detail
' First, get the HID class identifier
Call HidD_GetHidGuid(HidGuid.Data(0))
' Get a handle for the Plug and Play node, request currently active HID devices
PnPHandle& = SetupDiGetClassDevs(HidGuid.Data(0), 0, 0, &H12)
If (PnPHandle& = -1) Then ErrorExit ("Could not attach to PnP node")
HidEntry& = 0
Openned = False
DeviceInterfaceData.cbsize = 28 'Length of data structure in bytes
' Look through the table of HID devices
Do While SetupDiEnumDeviceInterfaces(PnPHandle&, 0, HidGuid.Data(0), HidEntry&, DeviceInterfaceData.cbsize)
' There is a device here, get it's name
FunctionClassDeviceData.cbsize = 5
Success = SetupDiGetDeviceInterfaceDetail(PnPHandle&, DeviceInterfaceData.cbsize, _
FunctionClassDeviceData.cbsize, UBound(FunctionClassDeviceData.DataPath), BytesReturned&, 0)
If (Success = 0) Then ErrorExit ("Could not get the name of this HID device")
' Convert returned C string to Visual Basic String
HidName$ = Empty
i& = 0
Do While FunctionClassDeviceData.DataPath(i&) <> 0
HidName$ = HidName$ & Chr$(FunctionClassDeviceData.DataPath(i&)): i& = i& + 1
Loop
' Can now open this HID device
HidHandle& = CreateFile(HidName$, &HC0000000, 3, 0, 3, 0, 0)
If (HidHandle = -1) Then ErrorExit ("Could not open HID device")
' Is it OUR HID device?
If HidD_GetProductString(HidHandle&, AddressFor(Buffer(0)), UBound(Buffer)) Then
DeviceName$ = Empty
i& = 0
Do While Buffer(i&) <> 0: DeviceName$ = DeviceName$ & Chr$(Buffer(i&))
i& = i& + 2
Loop
If (StrComp(DeviceName$, NameOfDevice$) = 0) Then
Openned = True
Exit Do
End If
End If 'HidD_GetProductString
Call CloseHandle(HidHandle&) ' Was not OUR HID device
HidEntry& = HidEntry& + 1 ' Check next entry
Loop 'SetupDiEnumDeviceInterfaces returns FALSE when there are no more entries
OpenUSBdevice = Openned
End Function
thanks in advance
Brian
Connection To USB Device
Hallo Hi everybody,
I want to make a connection to USB device ( card reader ) in order the user to log in to my system. I'm using vb6. Is there anyone could help me how vb6 to communicate to the device?.
TQ
Device Caps
Using DirectX 7..
I need some help figuring out what caps is needed by the D3D Device to do the following states:
Code:
'Enable alpha-blending
MainDirect3DDevice.SetRenderState D3DRENDERSTATE_ALPHABLENDENABLE, True
'Set Blend State
MainDirect3DDevice.SetRenderState D3DRENDERSTATE_SRCBLEND, D3DBLEND_BOTHSRCALPHA
MainDirect3DDevice.SetRenderState D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTCOLOR
'Set Alpha Blend Operation
MainDirect3DDevice.SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTOP_BLENDDIFFUSEALPHA
I use Triangle strips and lists on Transformed and Lit vertexes.
The textures are created for hardware with:
Code:
'Set Texture Description
TempDescription.ddsCaps.lCaps = DDSCAPS_TEXTURE
TempDescription.ddsCaps.lCaps2 = DDSCAPS2_TEXTUREMANAGE
And for software with just:
Code:
'Set Texture Description
TempDescription.ddsCaps.lCaps = DDSCAPS_TEXTURE
Any suggestions or links that might help?
Connection Through IR Device
Hello guys,
I have an IR Device installed on my computer and I'd like to make a program in order to be able to send and recieve data from / to a cell phone connected through this IR device. Does anyone know something about this?
Thank you Tassos.
Device Lost Again
Hi. In my Fullscreen app's Render sub, I use this code:
Code:
dim hR as long
hR = g_d3ddevice.testcooperativelevel()
if hR = D3DERR_DeviceNotReset Then
g_d3ddevice.reset g_d3dpp
elseif hR <> 0 then
exit sub
end if
Call DoRender
End Sub
I'm sure g_d3dpp is all set, but if I use this code, the screen starts flickering after I pressed <CTRL>+<ESC> or <ALT>+<TAB>.
Anyone?
Help In Enabling Device
hi all
plz i tired from try enable or desable sound card from VB is any one know how to do that ..
and thanks
Remove An USB Device Via Vb.
Hi to all. is there a method to remove an usb device? Such as Windows' "Remove" command from My Computer.
thanks to all
simons
USB Device Permissions
Here is my situation.
I am creating a program that is gong to turn a computer into a public kiosk. And the purpose of the kiosk is to download specific files onto a USB pen drive device.
The problem is that if the user inserted some device such as a keyboard then the computer security would be compromised. So what I need is for the program to detect devices inserted into the USB port and then either accept or reject them.
I realize that I may have to accept or reject a device based upon the devices name and save a list of accepted devices which is acceptable. But I can not have the computer at risk of compromise.
My searches on Google and this forum did not turn anything up that really helped me.
Device Unavailible
hi there. i have forgotton the code for this and hope you can help me out:
Code:
Private Sub Dir1_Change()
Dir1 = drvMain.Drive 'ERROR happens here when we change the folder when pointing at current unavailible device
File1.Path = Dir1.Path
End Sub
Private Sub drvMain_Change()
Dim errormsg As String
On Error GoTo driveerr
drvMain = drvMain.Drive
driveerr:
If Err.Number = 68 Then
errormsg = MsgBox("The drive chosen is not ready or is unavailible. Please try again", vbCritical, "Drive unavailible")
Exit Sub
End If
End Sub
error happens when the drive is unavailible so when you try and change it, the error comes up in VB
Detect USB Device
Hi,
I'm trying to write a small utility which will run in the system tray and detect when a particular USB device is plugged in, and then get it to launch a program.
Is this possible with Visual Basic 6.0 SP5?
Specifically, I want to be able to detect when the Hauppauge DEC2000-t is plugged in (identify it either by it's name or DeviceID) and then launch a program (ShowShifter).
Thanks
Disable Device
Hello I am new to vb. I am writing a small scipt that will allow me to change ip addresses on my wireless NIC for my laptop. So far everything is going good except onething. Is there a way to disable/enable the NIC in vb(5.0) ??? So that the new address would take affect.
Device Type
hi i want to use the mmcontrol with my project. I has to be able to play mp3's i have already got the mmcontrol to play cd's but how would i make it play mp3's, do i need to use a specific device type?
Device Context
Hi, great job with the forums.I have been registered under a different account that I lost, for about 2 years now, and I have to admint I enjoy the searching facilities of the forums very much.I'm quite confused now, so any help greatly appreciated!
I'm making an application where the user initially loads an image using a CommonFileDialog box.Creating a DC I can paint this onto a picture control. Then the user using his mouse is clicking on the image to select the area he is interested in and I have it displayed onto the picture alone,then he can zoom it e.t.c. register control points e.t.c.
My problem is that once I have the selection I store everything into arrays and manipulate the pixels or their centers the user then will load another image.In the meantime when I ask to Get the pixel value let's say when the user has selected a region and I display it on the picture control alone, it isn't actually reading what is beeing displayed on the screen.it only does so when the image is loaded and remains intact.
I need to be able to update Device Context since I read the values using for example API calls like this one:
greyValue = GetPixel(lngDC, MousePixelPositionX, MousePixelPositionY) And &HFF
My problem is that let's say the picture shows a 20 x 20 face that the user selected and I have the rest all white.When I read the values though with the mouse movement, it will show all the positions, even in the selected area displayed on the picture, as 255 ( white in greyscale)
which means Im doing something wrong.
Part of the code within a sub i use to store the selection:
'trying to debug Device Context problem cause final output still displays orginal BMP transparent background or DC is not updated of the current display on screen
Picture1.Cls
Set Picture1.Picture = LoadPicture ' clear its contents
Set stdPic = LoadPicture
'show selection
Call Array2Picture(1) 'ingore this bit,displays the array back to picture
ProgressBar1.Visible = False
statusText = "Ready"
Label9.Caption = statusText
ProgressBar1.Value = 0
'DC once I have new content i though I would update the DC like this
lngDC = CreateCompatibleDC(Picture1.hdc)
lngOrigBMP = SelectObject(lngDC, stdPic.Handle)'this is used when loading the original BMP too
Form2.Refresh
Picture1.Refresh
Anyways, If I'm confusing you guys too much, i just need to know how to pass the current contents of a picture to a DC.
I imagine that I can't also pass arrays to DC directly.
Erm, I'm confused
Device To Draw On? (HDC)
I found this function that is exaclty what im looking for, however one of the parameteres says the input is a "Device to Draw on" As Type Long. How would I go about getting an object as this decive sush as Form1.
Code:
'*******************************************************************************
' DrawGradient (FUNCTION)
'
' DESCRIPTION:
' This function is used to draw gradients with four colours
'
' Arguments:
' hDC - The device to draw on
' Top - Distance in pixels, from top
' Left - Distance in pixels, from left
' Width - In pixels
' Height - In pixels
' colourTopLeft - The colour of the top-left corner
' colourTopRight - The colour of the top-right corner
' colourBottomLeft - The colour of the bottom-left corner
' colourBottomRight - The colour of the bottom-right corner
'*******************************************************************************
Public Function DrawGradient(hDC As Long, Left As Long, Top As Long, Width As Long, Height As Long, colourTopLeft As Long, colourTopRight As Long, colourBottomLeft As Long, colourBottomRight As Long)
...
End Function
...could Not Connect To The Device....
Hi all !
I am trying now for 3 days to program my "typhoon myguide pocket pc" with embedded visual basic, without any success : if VB tries to connect to the pocket pc, I get :
<
The platform manager could not connect to the device.
This happens if the
project type does not match to the connected device,
or if a required file in
Windows CE Services or the platform SDK is missing or corrupt.
(Error code=0xLX)
>
The connection (active sync) is working, I can easily transfer files to the pocket pc.
The selected platform in embVB is Pocket PC 2002 (Default Device), my Pocket PC uses Microsoft Pocket PC, Version 4.20.1081.
I dont use any german pathnames (a known bug of embedded VB, which I found on the MS homepage).
Is there anyone, who had the same problem and solved it ????
I would be glad, if someone could help me !!!
thanks, Joerg
How To Detect A USB Device?
Hi guys
Im trying to write the code for my VB program that detects a USB device, in this case a USB camera, does anyone have any suggestions? tips or what have ya
Thanks for answering, much appreciated
Device List
Is there way to display the Hardware devices in the VB ? (Getting the device list) ?
Thanks in Advance
About Device Contexts
I have been experimenting with using device contexts (DC) with various api routines. Once i get the DC of a window I want to do something with, whether it is copying some part of it with bitblt, or getting the color of a pixel, it seems that I must activate the window and bring it to the front before the routine will work. Why is this required? Is there a way around this? I would think if i got the dc of something i could just copy some pixels from its window without haveing to bring it to the front.
|