hi all !!!
i need to call this API :
FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD
Flags)
i have a sample code in C++ that work fine... FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD
Flags) FT_STATUS ftStatus; DWORD numDevs;
ftStatus = ListDevices(&nu mDevs, NULL, FT_LIST_NUMBER_ ONLY); char Buf[64]; ftStatus = ListDevices((PV OID)numDevs, buffer,
FT_LIST_BY_INDE X|FT_OPEN_BY_DE SCRIPTION);
but i don't know how i can convert it on VB.NET
thank a lot ! 5 4227
I'm assuming FT_STATUS is 32-bit number. Another thing is bothering me -
the first param is a DWORD. You are passing its address in the first call
(which I assume causes the function to return the number), but then you are
casting the number to a pointer in the second call?? That doesn't seem
right. I will assume you will always need to pass an address. I'm also
assuming the buffer is an ASCII string. Otherwise, you'll want to change
that to a Byte array. Strange that you declare Buf[64] as a Char array, but
then use a non-existant buffer variable. That leaves my interpretation of
the second paramater in a little bit of a mystery. I'm assuming at the
moment that buffer is the address of Buf.
Declare ANSI Function FT_ListDevices( ByRef pArg1 As Integer, ByVal pArg2 As
String, ByVal Flags As Integer) As Integer
You will need to get the numeric values for the 3rd parameter and create
constants for them. Also, in the first call, pass String.Empty to the second
parameter (which will translate to NULL).
PS: All C(++) programers that assign PVOID or *void to variables and
parameters are going to the same hell as VB programers who don't declare
their variables.
-Rob Teixeira [MVP]
"Eric BOUXIROT" <ri****@rickou. net> wrote in message
news:3f******** **************@ news.free.fr... hi all !!! i need to call this API : FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD Flags)
i have a sample code in C++ that work fine...
FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD Flags) FT_STATUS ftStatus; DWORD numDevs;
ftStatus = ListDevices(&nu mDevs, NULL, FT_LIST_NUMBER_ ONLY); char Buf[64]; ftStatus = ListDevices((PV OID)numDevs, buffer,
FT_LIST_BY_INDE X|FT_OPEN_BY_DE SCRIPTION);
but i don't know how i can convert it on VB.NET
thank a lot !
hi rob,
thank for your answer.
i have try what you say but it don't work too..
for your info:
FT_STATUS is long
when i call : ftStatus = ListDevices(&nu mDevs, NULL, FT_LIST_NUMBER_ ONLY);
the API should put in numDevs the number of devices it can access.
this call work fine...OK
but when i call the second : ftStatus = ListDevices((PV OID)numDevs, buffer,
FT_LIST_BY_INDE X|FT_OPEN_BY_DE SCRIPTION);
the device should put in buffer (which is an array of 64 byte) the name of
the device (from index numDevs). numDevs is Long. but it don't work (the API
return in ftStatus that device doesn't exist)..
i have try the exemple in VC++ then it work fine (all two calls !!),
i have try to replace (PVOID)numDevs in second call by &numDevs and this
don't work..(the API return in ftStatus that device not exist, like with VB
!)
thank for your help...
FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD
Flags)
OK, sounds more and more like the kind of C programmer I want to hate.
They appear to have created the 1st parameter as both a number and a
pointer.
If you ever find the programmer of this API, shoot him.
Your safest bet is to create TWO api declare statements with different
Aliases.
One passes the 1st parameter ByValue and the other passes the 1st parameter
ByRef.
Also, Long in C = Integer in VB.NET and C#.
-Rob Teixeira [MVP]
"Eric BOUXIROT" <ri****@rickou. net> wrote in message
news:3f******** **************@ news.free.fr... hi rob,
thank for your answer. i have try what you say but it don't work too.. for your info: FT_STATUS is long
when i call : > ftStatus = ListDevices(&nu mDevs, NULL, FT_LIST_NUMBER_ ONLY); the API should put in numDevs the number of devices it can access.
this call work fine...OK
but when i call the second : > ftStatus = ListDevices((PV OID)numDevs, buffer, FT_LIST_BY_INDE X|FT_OPEN_BY_DE SCRIPTION); the device should put in buffer (which is an array of 64 byte) the name of the device (from index numDevs). numDevs is Long. but it don't work (the
API return in ftStatus that device doesn't exist)..
i have try the exemple in VC++ then it work fine (all two calls !!),
i have try to replace (PVOID)numDevs in second call by &numDevs and this don't work..(the API return in ftStatus that device not exist, like with
VB !)
thank for your help... FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID
pArg2,DWORD Flags)
Hello, Eric:
You will need (as Rob said) different declarations for the three different flags:
declare function FT_ListDevices1 lib "FTD2XX.DLL " alias "FT_ListDevices " (byref pArg1 as int32, byval pArg2 as int32, byval Flags as int32) as int32 'For FT_LIST_NUMBER_ ONLY
declare ansi function FT_ListDevices2 lib "FTD2XX.DLL " alias "FT_ListDevices " (byval pArg1 as int32, byval pArg2 as string, byval Flags as int32) as int32 'For FT_LIST_BY_INDE X
declare ansi function FT_ListDevices3 lib "FTD2XX.DLL " alias "FT_ListDevices " (byval pArg1 as int32, byref pArg2 as string(), byval Flags as int32) as int32 'For FT_LIST_ALL (I don't know if it will work)
Remember that each string must be at least 64 characters long before calling the function.
Regards.
"Eric BOUXIROT" <ri****@rickou. net> escribió en el mensaje news:3f******** **************@ news.free.fr...
| hi all !!!
| i need to call this API :
| FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD
| Flags)
|
| i have a sample code in C++ that work fine...
|
| > FTD2XX_API FT_STATUS WINAPI FT_ListDevices( PVOID pArg1,PVOID pArg2,DWORD
| Flags)
| >
| > FT_STATUS ftStatus;
| > DWORD numDevs;
| >
| > ftStatus = ListDevices(&nu mDevs, NULL, FT_LIST_NUMBER_ ONLY);
| > char Buf[64];
| > ftStatus = ListDevices((PV OID)numDevs, buffer,
| FT_LIST_BY_INDE X|FT_OPEN_BY_DE SCRIPTION);
|
| but i don't know how i can convert it on VB.NET
|
| thank a lot !
Thank to you José and Rob !!!
after 1 day of hard search, this shit of API work....
Big Thank !!
i have one more question...
with this call
declare ansi function FT_ListDevices2 lib "FTD2XX.DLL " alias
"FT_ListDevices " (byval pArg1 as int32, byval pArg2 as string, byval Flags
as int32) as int32 'For FT_LIST_BY_INDE X
now i get a string ok but it seem to be incomplete..i explain..
when i break the program and in execution windows i type
? buffer (which is my string buffer with 65 Spaces)
i get
"123456
but there isn't the " at the end of string....
now i change the declare to use array of 64 bytes...
and add each byte to my string buffer with CHR instruction...
now when i ? buffer i get correct
"123456"
......
i don't know why...
thank a lot for your help ! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: R.Wieser |
last post by:
Hello All,
I'm trying to get a "Virtual Listbox" to work. I've currently got a form,
and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and
LBS_NODATA flags on it. I've allso subclassed the window and do see all
kinds of WS_??? messages coming by.
But now I'm stuck :-\
I've got *no* idea what to do next, and all my searching on the web leads me
|
by: Joh |
last post by:
hello,
i'm trying to understand how i could build following consecutive sets
from a root one using generator :
l =
would like to produce :
, , , ,
|
by: Jack Addington |
last post by:
I've got a fairly simple application implementation that over time is going
to get a lot bigger. I'm really trying to implement it in a way that will
facilitate the growth. I am first writing a WinForms interface and then
need to port that to a web app. I am kinda stuck on a design issue and need
some suggestions / direction.
Basically I have a business layer that I want to use to process any
dataentry logic (row focus changes, data...
|
by: Sai Kit Tong |
last post by:
In the article, the description for
"Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports
or
Managed Entry Points"
suggests the creation of the class ManagedWrapper.
If I need to build multiple mixed mode dll's used by a consumer application,
do I have to implement multiple ManagedWrapper's (each embedded in
indiviudal DLL project) and call all of them in my consumer application?
|
by: Bill Borg |
last post by:
Hello,
I call a function recursively to find an item that exists *anywhere* down
the chain. Let's say I find it five layers deep. Now I've got what I need and
want to break out of that whole stack and continue execution at the point of
the initial call. Is that possible?
Thanks,
Bill
| |
by: sommarlov |
last post by:
Hi everyone
>From one of our systems an xml file is produced. I need to validate
this file before we send it to an external system for a very lenghty
process. I cannot change the xml file layout.
The solution i got today is very slow, and i need help to find another
solution.
Here is the xml file. It consists of a list of position ids (ESTOXX50
INDEX_BM_E and FTSE INDEX_BM_E), and below that a list of tags for each
position id. What i...
|
by: bsruth |
last post by:
I tried for an hour to find some reference to concrete information on
why this particular inheritance implementation is a bad idea, but
couldn't. So I'm sorry if this has been answered before. Here's the
scenario:
We have a base class with all virtual functions. We'll call this the
Animal class. We then make two classes Fish and Bird that both inherit
from Animal. In the program, we have a single array of Animal pointers
that will...
|
by: sara |
last post by:
i am studying a computer engineering and i started taking programming
using C++ since month
i have question i think it`s easy for you all *prof.programmer* but
it`s bit diffecult for me plzz i need your help. (: this is the
question:
** A new telephone communication company needs a billing calculation
program. The cost of a call is based on the following three inputs that
should be entered by the user, and they are explained as follows.
|
by: bean330 |
last post by:
Hey, I'm somewhat new to C# and I need a little help, please!
I'm selecting a bunch of records, setting properties on a COM
executable and then calling a method on that executable to run. I
want to run the executable in separate threads because they can be
long-running and it would be optimal for us to run a bunch
simultaneously.
I've got that part working - it's pretty easy in C#. What I'm having
a hard time with is managing the...
|
by: Siyodia |
last post by:
This is a java program which i need to run facing compilation error
Its consuming a third party web service method
I have the supported files(folder) which contain necessary class files org/apache/axis
The following is what i need to do but am unable to do
////////////////////////////////////////////////////////////////////////////////////////////
set classpath where the below jars are located....
axis.jar
commons-discovery.jar
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |