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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a .TLB file... 1

Status
Not open for further replies.

Neil Toulouse

Programmer
Mar 18, 2002
882
GB
Hi folks!

I have just come across a Type Library called REMOTECE.TLB which is supposed to contains every Remote API call (RAPI) definition within the Windows CE Remote API.

I want to use some of these functions but not sure what to do with it! Can I do anything with it anyway? (ie is it just a reference to functions contained somewhere else?).

As usual all examples etc are in VB and I am beginning to think you need the Pocket PC development suite to get the functions and as such, they are not 'freely' available.

Any advice is much appreciated!

TIA
Neil

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

(Untested) But isn't a tbl file associated with a dll? Any chance you can load it in the Visual Basic object browser?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike!

Thanks for the repsonse. Unfortunately my knowledge of the world of .DLLs is very limited! I have just re-examined the ZIP file in which this .TLB and the sample VB code resides, and there is no .DLL file attached.

But just as a test I ran one of the compiled (EXE) VB sample routines (which basically gets a list of files residing on the PDA) which works fine.

Maybe the DLL is built into the VB EXE?

I don't have VB installed here so can't object browse the .TLB, but it does browse OK in VFP's Class Browser, listing all the functions.

I am beginning to wish I hadn't got involved in this PDA project as it seems to get more and more complex as I go along!!

Neil

"I like work. It fascinates me. I can sit and look at it for hours..."
 
Neil,

I agree with Mike Gagnon, except that you don't open the TLB directly -- you open the corresponding COM component. You have to know the name under which the component is registered in Windows.

If you don't have VB, open Word or Excel, select Tools / Macros / Visual Basic Editor. Then, from within VBA, select View / Object Browser. Finally, right-click in the drop-down that says <All Libraries>, select References, then tick the relevant COM component.

Mike


Mike Lewis
Edinburgh, Scotland
 
Hi Mike!

I have done what you said but (I am probably being thick here!!) how do I know what the relevant COM component is? I am assuming it is that I am looking for?!!

I have opened the .TLB file into the browser and it shows me the functions etc, but it is still listed as a Type Library.

Apologies for my ignorance on this!

How goes it in Edinburgh? The lads enjoyed their course and are making steady progress :)

Neil

&quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Right then I think I have cracked it!

I used my brain (for once) and simply ran a search on RAPI on my local drive, and hey presto, a RAPI.DLL exists in SYSTEM32 folder!

So I just tested one of the functions (declaring it etc) and it returned a value of 0 (I have no idea what 0 means, but that's the next problem!!).

As I have a return value I am assuming it is this DLL and so I can move on.

Many thanks for the suggestions!

Neil

&quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Thanks for pointing out where to download...

Here's the situation: The RAPI.DLL is not a COM/ActiveX DLL.
The Type library that you downloaded contains:
1) Enumerated data types (equavalent to the .H files in C and VFP),
2) Structure type definitions (Equivalent to the .LIB file in C, I think... No equivalent in VFP (other than string))
3) CERAPI &quot;Module&quot; definition: Contains all the function declarations (Equivalent to a global .BAS file in some VB programs containing DECLARE statements, and the .LIB file in C, and to the DELCARE statements that must be used in VFP)

So, the Object Browser in VB is very usefull. Open up one of the sample projects contained in that download, and add the reference to the RemoteCE.TLB file to the project ( Project Menu -> References -> Browse ), then open the Object Browser ( View Menu -> Object Browser ), and finally, choose &quot;RemoteCETypeLibrary&quot; for the library to browse.

You can find the VB DECLARE statement equivalents in the &quot;class&quot; CERAPI... Highlight the function on the right, and look in the bottom detail panel. Convert this to VFP, then use something like to create/access the structure members.

This looks really promising!!
 
Neil,

You've obviously made some progress since your last reply to me. But, for what it's worth, when you asked:

how do I know what the relevant COM component is?

the answer is that it is the COM component that you downloaded. Presumably, the site where you downloaded it, or the documentation or README file that comes with the download, references the product by name. It is that name that you should be concerned with. The name of the DLL or TLB is incidental.

Keep in mind that the information from the TLB might be helpful, but it is no substitute for proper documentation. Rather than spending time figuring out the TLB, maybe you should be looking for the docs for the product.

Edinbugh is unusually warm at the moment. I'd go as far as to say hot (anything above 20C is a heat wave here). Everybody's getting ready for the Festival just now. For that reason, I won't be running any more courses here until September.

Best wishes to all in Birmingham.

Mike


Mike Lewis
Edinburgh, Scotland
 
Mike:

The TLB seems to be a hand made reference TLB into the native windows DLL routines used to access an attached Win CE device.

There is no COM component involved: The TLB defines the subroutine entry points into the DLL, but doesn't happen to define any object, that I can find.

In the VB examples in the ZIP file, the functions are called with no object identifier, ie:

Code:
RetVal = CeRapiInit()
dbHandle = CeFindFirstDatabase()
RetVal = CeRapiUninit()

However, there is not DECLARE for these three functions... right click them and choose &quot;Definition&quot; and the Object Browser jumps open and points to the function definition in the above-mentioned TLB.
 
Neil,

In view of what Wgcs just said, you can forget everything here about using object browsers, etc. If there is no COM component involved, then the TLB probably isn't very useful.

Wgcs seems to know all about this DLL, so maybe you should be tapping into his knowledge store.

Mike


Mike Lewis
Edinburgh, Scotland
 
I knew nothing about it until he pointed to it here.... The VB object browser is an excellent way to view the contents of this TLB, and is where I'm getting almost all of my information.

The MSDN library is where I'm finding the rest: The CeRapiXXXXXX functions are standard windows API functions contained in RAPI.DLL, with the C header stored in RAPI.H (in Visual C++). I don't know where this TLB originated, but it is the equavilent of RAPI.H for VB.... yet has not object definitions in it. It seems that this TLB contains many references to functions (like CeRapiCheckpassword) that aren't listed in MSDN.

I've been looking for these interfaces for months... I've overlooked the CeRapiXXXX functions in MSDN up till now because the MSDN text says: &quot;REQUIREMENTS: Runs on Windows CE OS v2.0 and Later&quot;... it has no mention that the RAPI.DLL is part of Windows 2k (my platform... or might install as part of ActiveSync). Yet, I just tried them and they work.

Here's some simple code that works in VFP:
Code:
declare INTEGER CeCheckPassword IN RAPI.DLL STRING @ Pass
declare INTEGER CeRapiInit IN RAPI.DLL
declare integer CeRapiUninit IN RAPI.DLL
DECLARE LONG CeFindFirstDatabase IN RAPI.DLL LONG dbType
?ceRapiInit()
?ceCheckPassword('junk')  && always returns &quot;0&quot;
xx=CeFindFirstDatabase(0)
?xx
?ceRapiUninit()
 
Actually, CeCheckPassword is in MSDN... I was misspelling CeRapiCheckPassword.....[dazed]
 
One warning: The VB object browser sorts the members of a class/structure by name, so you can't rely on that to rebuild the structure. You need to use MSDN (check out msdn.microsoft.com)
 
wgcs

Very usefull faq William, thanks.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi folks!

I didn't think my post would create so much interest!! Thanks to all the repsonses as it means I wasn't being totally thick with the .TLB!!

I also came across this OCX for sale but I don't know what it does above and beyond what has already been discussed here:


Also I found a couple of posts on the Foxite forums but not much else!

Neil

&quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Just to finish off incase anyone else is following this thread, there are also two functions available in the ADOFILTR.DLL which is installed as part of Microsoft's ActiveSync (and is found in one of the folders it creates).

These are DEVICETODESKTOP and DESKTOPTODEVICE:



All they do is allow you to programmatically copy Access MDB's to the PDA. They also have the benefit of doing the conversion between MDB/CDB (Pocket Access) as required depending if you are copying from the PDA (MDB) or to it (CDB).

Obviously you would then need to find a nice solution for converting your VFP data to MDB (I use ODBC and SQL-Passthrough).

As an aside, beware of how you use your FlashCards!! If you copy the MDB to a FlashCard on the PDA it does the conversion to the Card and it takes forever!! From my experimentation it seems FlashCards are only usuable if you do a straight copy of a file to it. If you try and do any type of database manipulation on them the whole process grinds to a halt (my test took 5/6 minutes to save a record as opposed to 2 seconds in PDA memory). I simply now use the FlashCard as a backup of the data when the application exits so a simple file copy can take place.

HTH
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