Re: [Windows]Need an example: How to read and list names of USB devices via Windows API without using Utilities

2020-05-27 Thread Mihail Lorenko via Digitalmars-d-learn

On Wednesday, 27 May 2020 at 14:16:56 UTC, BoQsc wrote:
I always wanted to know if there is any proven example on how 
to interface with USB devices by using Windows operating 
system. Any explanations, snippets in relation to topic would 
help.


What I expect:
Being able to detect if a new USB device is connected.
Being able to read USB device name.
Being able to read USB device partition/s name/s.
Being able to list all USB devices.

What is required and are there any critical problems with 
achieving any of this?


Hello!
I advise you to see the following until others have answered you:
[1]: https://code.dlang.org/packages/libusb-d
[2]: https://code.dlang.org/packages/serialport

I can not say that these links satisfy your needs.


Re: Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Mihail Lorenko via Digitalmars-d-learn

On Thursday, 6 February 2020 at 12:37:01 UTC, Adam D. Ruppe wrote:
On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko 
wrote:

B* b;


A pointer to a class is a rare thing in B since they are 
already automatic references. Just use `B b;` and ten `b = a` 
will just work.


Thanks for the answer!
Well, apparently I have to get around my problem. Thanks again!


Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Mihail Lorenko via Digitalmars-d-learn

Hello!
Interested in a question.
Object "A" inherited object "B". And you need to return the 
object link "B". Is this possible in this language? Here is an 
example:



class B
{
   protected int a;
   public void step() {};
}

class A : B
{
   public override step()
   {
   import std.random;
   a = uniform(5,100);
   }
}

void main()
{
B* b;
A  a;
a.step();
b = a.B; // @FixMe: Here you need a link to object B from 
object A.

}


Sorry to trouble you, thanks in advance!