Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win API - boolean? 1

Status
Not open for further replies.

Neil Toulouse

Programmer
Mar 18, 2002
882
GB
Hi folks!

I am trying to use Microsoft's ActiveSync to copy an MDB file from the desktop to a Pocket PC (with VFP) and get it to convert it to CDB during the process. I was pointed in the direction of the DEVICETODESKTOP function. As usual the example code is VB and I have no experience of using these API calls so I could be doing this all wrong anyway!!

Basically I have to declare two of the parameters as Boolean (SYNC and OVERWRITE) as I have indicated below (which I know won't work). I have changed them to INTEGER and sent 0 and 1 which was accepted but nothing happened.

So am I doing it correctly with declaring them as INTEGER and using 0 & 1 and my problem lies elsewhere, or am I doing it all wrong anyway?!!


#DEFINE DESKTOPLOCN "C:\DATA\MyTable.MDB"
#DEFINE TABLELIST "PDA_CN..PDA_ATT"
#DEFINE SYNC .F. (or 0)
#DEFINE OVERWRITE .T. (or 1)
#DEFINE DEVICELOCN ""

DECLARE INTEGER DEVICETODESKTOP IN [c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, LOGICAL (or INTEGER), LOGICAL (or INTEGER), STRING

= DEVICETODESKTOP( DESKTOPLOCN, TABLELIST, SYNC, OVERWRITE, DEVICELOCN )


TIA
Neil

"I like work. It fascinates me. I can sit and look at it for hours..."
 
Neil,
The example I found (in VB), shows that the parameters are:
String, String, Boolean, Integer, String

So maybe you need to try that combination. (VB Boolean being the same as a VFP Logical.)

Rick
 
Since VFP doesn't have type of BOOLEAN (byte), you can replace it with Integer/Long/String. Try this, but I don't know whether it works or not cos I can't test this

DECLARE INTEGER DEVICETODESKTOP IN ;
[c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, INTEGER, INTEGER, STRING
DEVICETODESKTOP( DESKTOPLOCN, TABLELIST, 0, 1, DEVICELOCN )


- or -

DECLARE INTEGER DEVICETODESKTOP IN ;
[c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, LONG, LONG, STRING
DEVICETODESKTOP( DESKTOPLOCN, TABLELIST, .F., .T., DEVICELOCN )


- or -

DECLARE INTEGER DEVICETODESKTOP IN ;
[c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, STRING, INTEGER, STRING
DEVICETODESKTOP( DESKTOPLOCN, TABLELIST, chr(0), 1, DEVICELOCN )


You can try the combination of that types

-- AirCon --
 
Rick/AirCon

Many thanks for the replies. I have tried all that you have suggested:

Rick - the Boolean definition causes a 'too many arguments' error.

AirCon - Your suggestions do not cause an error, but the function doesn't appear to do anything either.

If I issue a ? DEVICETODESKTOP(...) the value returned is -2.1470E+9 whatever that is supposed to mean!!

Neil

"I like work. It fascinates me. I can sit and look at it for hours..."
 
Neil,
I guess I wasn't as clear as I should have been. I meant that you should try:
Code:
#DEFINE SYNC            .F.
#DEFINE OVERWRITE        1

DECLARE INTEGER DEVICETODESKTOP IN [c:\program files\microsoft activesync\adofiltr.dll] ;
 STRING, STRING, LOGICAL, INTEGER, STRING
I might also add chr(0) to the end of the strings - e.g.
Code:
#DEFINE DESKTOPLOCN      "C:\DATA\MyTable.MDB"+chr(0)
#DEFINE TABLELIST        "PDA_CN..PDA_ATT"+chr(0)
#DEFINE DEVICELOCN       ""+chr(0)
Rick
 
Rick,

I'm sorry to say this. But "Logical" is not a "Parameter Type", it's a "Field Data Types". It cannot be use for DECLARE


-- AirCon --
 
Hi Rick!

I have tried LOGICAL as a parameter also and you get the 'Too many parameters' error, so it is as AirCon says.

Neil

"I like work. It fascinates me. I can sit and look at it for hours..."
 
Getting a bit further! I have found the list of error messages that are generated via the DLL.

However, the value being returned is -2.1470E+9 which has been rounded up presumably so I cannot get the exact value!


"I like work. It fascinates me. I can sit and look at it for hours..."
 
Try This:

DECLARE LONG DEVICETODESKTOP IN ;
[c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, LONG, INTEGER, STRING
?transform(DEVICETODESKTOP(DESKTOPLOCN, TABLELIST, .F., 1, DEVICELOCN), '@0')

What value do you get ?

-- AirCon --
 
Oops,

I just found out that "TableList" parameter must be in this format:
tablename<period><period>[tablename<period><period>]

So change the tablelist into this
#DEFINE TABLELIST &quot;PDA_CN..PDA_ATT..&quot;

Try again

-- AirCon --
 
Try this:

LOCAL Desktoplocn, Tablelist, Sync, Overwrite, Devicelocn

Desktoplocn = &quot;C:\DATA\MyTable.MDB&quot;
Tablelist = &quot;PDA_CN..PDA_ATT&quot;
Sync = CHR(0) && or CHR(1) for .T.
Overwrite = CHR(1) && or CHR(0) for .F.
Devicelocn = &quot;&quot;

DECLARE INTEGER DEVICETODESKTOP IN [c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, STRING, STRING, STRING

= DEVICETODESKTOP( Desktoplocn, Tablelist, Sync, Overwrite, Devicelocn )


or


DECLARE INTEGER DEVICETODESKTOP IN [c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, STRING, STRING, STRING

= DEVICETODESKTOP( @Desktoplocn, @Tablelist, Sync, Overwrite, @Devicelocn )


Zhavic

---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
Hi folks!

Thanks for all your replies, but I am still hitting a problem! I think the following syntax may be correct, and I think I have found a way to get the error message out:

LOCAL lcValue

#DEFINE DESKTOPLOCN &quot;C:\AQUA_PDA.MDB&quot;
#DEFINE TABLELIST &quot;PDA_CN..PDA_ATT&quot;
#DEFINE SYNC 0
#DEFINE OVERWRITE 1
#DEFINE DEVICELOCN &quot;&quot;

DECLARE LONG DEVICETODESKTOP IN [c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, INTEGER, INTEGER, STRING

lcValue = DEVICETODESKTOP( DESKTOPLOCN, TABLELIST, SYNC, OVERWRITE, DEVICELOCN )

? lcValue


However, lcValue is returning a value of -2147024809 which I cannot find on the error list!!

I think this is now one for MicroSoft :(

&quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
aaarghh!

I had forgotten to add the extra '..' after the last table name.

Now I am getting error:

-2147217865: Remote ADO Error: A required table does not exist

Now I have a legitimate error message I can (I think) move forward :)

So just to complete the thread, I now have:

#DEFINE DESKTOPLOCN &quot;C:\AQUA_PDA.MDB&quot;
#DEFINE TABLELIST &quot;PDA_CN..PDA_ATT..&quot;
#DEFINE SYNC 0
#DEFINE OVERWRITE 1
#DEFINE DEVICELOCN &quot;&quot;

DECLARE LONG DEVICETODESKTOP IN [c:\program files\microsoft activesync\adofiltr.dll] ;
STRING, STRING, INTEGER, INTEGER, STRING

DEVICETODESKTOP( DESKTOPLOCN, TABLELIST, SYNC, OVERWRITE, DEVICELOCN )


Many thanks for all the help!

&quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Glad you had find out the problem. Time to move on :)

Good luck

-- AirCon --
 
Perhaps you'd like to write a FAQ on how to programmatically syncronize with PocketPC from VFP?

I know I'd love to benefit from the technique you've developed....
 
Hi folks!

I have finally got it working to an extent, so when I finally get a fully working prototype I may indeed compile a FAQ!!

At the moment I am just trying to programatically get some data from my VFP application, turn it into an Access database and then copy that to the PDA with it doing the conversion to Pocket Access (.CDB).

The CDB is then used by a 3rd party application on the PDA for additional data entry etc. I am then grabbing the CDB off the PDA, turning it back into an MDB and then getting the data out of the MDB to update the VFP tables.

All is OK right up to the point the MDB back on the desktop is created. Access is unable to read it (unrecognised format)! So today I am trying it with ODBC!


Neil

&quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top