Using DeviceIoControl Win32 API To Power Down USB Port?
Nov 25, 2010How do I use DeviceIoControl Win32 API and the IOCTL in VB oder C#/C+/C++ to power down a USB port?
View 1 RepliesHow do I use DeviceIoControl Win32 API and the IOCTL in VB oder C#/C+/C++ to power down a USB port?
View 1 RepliesI have a simple USB fan that just runs on the power from the USB port. I want to be able to turn of and on the fan from a simple application.
View 1 RepliesIm coding an application that needs to list all computers inside my LAN, and get the status of the machines ex. Power On, Power Off.. in order to Wake On Lan, or Turn it Off.. im using Visual Basic .Net.I all ready listed all machines, now i need to get the status of them..
View 5 RepliesI was scripting a very basic process manager, with a ListView component, and it was working fine for many days, up until now.Here is the code for getting processes:
Dim Process As New Process()
Dim Count As Integer = 0
ListView1.Items.Clear()[code].....
The line of code where I put "*WIN32 EXCEPTION LINE* keeps running into an error(Win32 Exception was unhandled; Access is denied). Here is the full error description:
System.ComponentModel.Win32Exception was unhandled
ErrorCode=-2147467259
Message=Access is denied[code]....
As I said before, this had been working for several days, up until now.
I have several other API calls working fine, and I've built a Disk_Get_Drive_Layout call with several supporting Structures (really, a lot) If the actual code ends up being really necessary, I'd rather post it then than spam my question with all of it. The bit I know I don't fully understand is in the DRIVE_LAYOUT_INFORMATION_EX Structure (and also the PARTITION_INFORMATION_EX Structure) where a C++ union() is called for - I built a separate structure to provide that functionality, but it does the exact same thing as everything else. The union() in C++ sets up a class with multiple members, where only 1 of those members is understood to exist at a time.
Past that, there's also an uninitialized array in one of the structures and I'm not sure exactly how to handle that - my assumption would be that the API initializes and populates it, and when I try to initialize it myself with an explicit original boundary it always throws a system error at runtime (there's no exception with the uninitialized array, but it never returns any data either and both err.GetLastDLLError and the API GetLastError function always return code 122 defined as 'Error_Insufficient_Buffer')
I am trying to get the HDD Disk Drive information from the DeviceIOControl function with IOCTL_DISK_GET_DRIVE_LAYOUT_EX control code.
Here are the problems :1. The DeviceIOControl function returns(as from output buffer) DRIVE_LAYOUT_INFORMATION_EX structure. Which contains some data types i am unable to get.
[Code]...
I'm trying to read the table of contents from a CD and am having problems with the DeviceIOControl function. When I call it with a control code of IOCTL_CDROM_EJECT_MEDIA or IOCTL_CDROM_LOAD_MEDIA it works fine, and opens or closes the CD drawer. But when I call it with a code of IOCTL_CDROM_READ_TOC_EX it gives an error code of 6 (ERROR_INVALID_HANDLE). I'm using the same handle, so I can't see why it's complaining. It's possible that the input data that I'm giving it is wrong, but I don't think that it should give this particular error in that case.
[Code]
I'm mohammed from Oman ,I'm visual studio.net programmer How I can Read the Data From Barcode Weight scales By Serial port and TcpIp port
View 7 RepliesI have a Windows form.in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())for example( Com1,Com8,Com15,...).but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).how to Get it?
View 2 RepliesI would like to detect the Address and Port number of the Parallel Port in computer.
View 4 RepliesIf I uninstall the COM1 and reboot, it works. If I shut down (power off) and restart, I get the message below. If I uninstall then click on Scan for Hardware Changes,The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name:portName
View 8 RepliesDo you know which website that free download ebooks on API VB.net? I'm a second grad on IT programmer.
View 2 RepliesI am trying to create a small utility that tracks desktop usage in detail, to the level of individual text boxes etc.... in other applications. However, it is proving quite tricky. I thought I had it nailed using the Windows api. The below code is just a snipet of the code but essentially it provides me the handle of the control that the mouse is over. I thought from here, it would be easy to to the same thing but to provide the handle of the control that the cursor was actually clicked on, for example, if someone is filling in a text box in an application, they would not necessarily move the mouse to get to the text box, they may tab to it. Does anyone know if there is a way to get the handle of the control that is in use?
Private Sub Timer1_Tick(sender As Object, e As System.EventArgs) Handles Timer1.Tick
Dim ptx As Integer = Cursor.Position.X
Dim pty As Integer = Cursor.Position.Y
[code]....
i got a program i ran that says unable to install bla bla microsoft.visualbasic.powerpacks.vs version 9.0.0.0 be installed in the global assembly cache (GAC)first
View 2 RepliesDoes anyone know of a good 3rd party reference for Win32 API for .Net where VB.Net is the target language Most API references target C as the language of choice. Frankly, I hate C and all C like languages.
View 11 RepliesAlright today im going to make a chat program in C++ and VB.net VB.net will be the server and C++ will be the chat room. Im doing this becuase some people dont have .net and the program fails so im trying this so then everyone can use it. How would i do this? Like C++ sending information to VB.net and printing it out on a textbox
View 2 Repliescomponent id for Visual Basic Power Pack 3.0.I need to determine if or not it is installed on my system for my setup.
View 3 RepliesWe have a .NET app that needs to examine a folder that may contain COM libraries (DLL and OCX.) When we do encounter a COM library one thing we need to accomplish is to extract the GUID from the COM DLL or OCX.Is there a straightforward way to do this with .NET without using 3rd party libraries?
View 3 RepliesI am looking to record information about the computers power consumption over time, is there any way I could do this using vb, I can get the current voltage from the processor but do not know the current therefore can not work out the wattage. I know of application which do have power consumption recorders but I would like to create my own.
View 1 RepliesI'm trying to make a program to communicate with a power analyser (wt1600),Yokogawa gives an example programm in vb6.0.Now the problem is if i trie to recieve a message that i get an empty string.6.0..Declare Function TmReceiveBin Lib "tmctl.dll" Alias "TmReceive" (ByVal id As Long, ByRef buf As Any, ByVal blen As Long, ByRef rlen As Long) As Long [code]
View 1 RepliesI'm trying to make a program to communicate with a power analyser (wt1600),okogawa gives an example programm in vb6.0.Now the problem is if i trie to recieve a message that i get an empty string.6.0 Declare Function TmReceiveBin Lib "tmctl.dll" Alias "TmReceive" (ByVal id As Long, ByRef buf As Any, ByVal blen As Long, ByRef rlen As Long) As Long
View 4 RepliesI got a new laptop friday, it has windows 7 and its a 64 bit system. I installed visual studio 08. everything was fine until I opened one of my projects.Seems like the powerpacks drawing items no longer exist, there is only a pointer and reort viewer in the group now and all of the items that I have used in the past are keep my app from running.
View 2 RepliesIm coding a little app for my self that generates me a string. Recently I came to contact with a program that is about 50 times faster then mine just because it's using a graphics card GPU to do its calculations.I'm running 3 5770 and I think that 1 is enough for what I need, but I was wondering if it's possible to do such a thing.how can I use my GPU power to do my calculations? All my calculation is stored in 1 function in case you're wondering.
View 6 RepliesI am trying to get my 4 port USB relay board to work in VB.net using the COM PORT. I found some code from a poster who has the 16 port USB relay version. When trying his code i can only get it to turn on relays 1-3 all at the same time. The product can be found here: USB 4 port relay
"01+//" - Relay 1 is switched ON
"01-//" - Relay 1 is switched OFF
"02+//" - Relay 2 is switched ON
"02-//" - Relay 2 is switched OFF
[code].....
So i am confused as to how to separate each relay out with that code above and just be able to turn on any number 1-4 relay on or off independently from each other!
I read in msdn that registrykey class is found in Microsoft.win32 namespace.But when I try to add a reference to my project, I couldn't find Microsoft.win32 in the list.
View 4 Repliesadd notes in the powerpoint slides notes part under the powerpoint slide.using Microsoft.Office.Interop.PowerPoint. I'm using vb.net code.Now it si creating the ppt file and I can add text,comments,image. in the slide . But I need to add notes in the powerpoint slide , in the bottom part of the slide.
Here is the code i'm using for creating slides.
Dim oApp As Microsoft.Office.Interop.PowerPoint.Application
Dim oPres As Microsoft.Office.Interop.PowerPoint.Presentation
Dim oSlide As Microsoft.Office.Interop.PowerPoint.Slide
Dim bAssistantOn As Boolean
[code]....
I have installed VB6 and Visual studio 2005. when i am opening the VB6 files getting this error.
Visual Studio Just in time debugger
An unhandled win32 exception occurred in VB6.EXE
I have a project with sql database and customer require to create this function .I mean when user use my program , they can delete, edit... but not still save yet. Suddenly power failure , and i want to recovery database when user turn on program again.
View 4 RepliesLong story short, code that used to work on my 32 bit computer doesn't work on my 64 bit computer. Does 64 bit require something like changing Integers -> IntPtrs?
View 11 RepliesI have a Delphi program that communicates with a vb.net dll that I created. The vb.net dll communicates with a Fluke scope meter via an RS232 connection. I have created a program that communicates correctly via RS232, giving me the anticipated value. Though, when I package this up as a dll and access the dll from my Delphi program I always receive a value of "1", rather than the value I was expecting (most cases a value in and around 240).I know that my delphi program is definitely communicating correctly with the dll and that my dll is definitely communicating with the scope meter
Here is my vb.net code:
Public Interface IFlukeComm
Function GetReading(ByVal Command As String, ByVal PortNum As Integer) As String
[code].....