newsgroups-index (beta)

Current group: dbase.dde-ole-dll-winapi

How to prototype functions?

How to prototype functions?  
Jan Hoelterling
 Re: How to prototype functions?  
Ronnie MacGregor
 Re: How to prototype functions?  
Jan Hoelterling
 Re: How to prototype functions?  
Todd Kreuter [dBVIPS]
 Re: How to prototype functions?  
Jan Hoelterling
 Re: How to prototype functions?  
Todd Kreuter [dBVIPS]
From:Jan Hoelterling
Subject:How to prototype functions?
Date:Tue, 28 Dec 2004 13:53:02 -0600
Hi Folks,

I regularly have the problem that even when I find an API, I am not sure how
to EXTERN it. For example, in my quest to determine which Theme is active in
XP, I've found the function GetCurrentThemeName. Now what?

Here is how the function is described in MSDN:

HRESULT DrawThemeBackground(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
const RECT *pRect,
const RECT *pClipRect

(link to the actual page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/functions/drawthemebackground.asp)

How would I read this to determine what I need to do from within dBase to
call this function???

Thanks in advance for any suggestions.

Jan
From:Ronnie MacGregor
Subject:Re: How to prototype functions?
Date:Wed, 29 Dec 2004 11:31:41 -0000
In article , jhoelterling@compuserve.com
says...

Hi Jan

> I regularly have the problem that even when I find an API, I am not sure how
> to EXTERN it. For example, in my quest to determine which Theme is active in
> XP, I've found the function GetCurrentThemeName. Now what?

> How would I read this to determine what I need to do from within dBase to
> call this function???

MSDN is the best place to start from. A google search of the function
name will usually throw up a VB sample, but to be honest you're probably
better just using the MSDN C sample.

There's a very good dBulletin article by Nicolas Martin on the subject,
API32 functions and C Structures :

http://www.jpmartel.com/bu06_e.htm

Also check out Keith Chuvela's "Killer Win32 API"

Gary White has various little chunks of API code around which serve as a
good guide, now at Geoff's site :

http://www.geocities.com/geoff_wass/

Then there is the time honoured method of "suck it and see" .

Which is what I've done with this one .

See binaries - XPTheme.cc

--
Ronnie MacGregor
Scotland
From:Jan Hoelterling
Subject:Re: How to prototype functions?
Date:Wed, 29 Dec 2004 10:11:27 -0600
Very cool, Ronnie. Thank you very much!

Jan
From:Todd Kreuter [dBVIPS]
Subject:Re: How to prototype functions?
Date:Tue, 28 Dec 2004 16:44:58 -0500
Jan Hoelterling wrote:
>
> I've found the function GetCurrentThemeName. Now what?
>
> Here is how the function is described in MSDN:
>
> HRESULT DrawThemeBackground(
> HTHEME hTheme,
> HDC hdc,
> int iPartId,
> int iStateId,
> const RECT *pRect,
> const RECT *pClipRect

Did you paste the right one? You said you found GetCurrentThemeName but
posted DrawThemeBackground. DrawThemeBackground is a bit out of my
league. Whenever I see an API that uses a device context (HDC) I say
"never mind" .

--
Todd Kreuter [dBVIPS]
From:Jan Hoelterling
Subject:Re: How to prototype functions?
Date:Tue, 28 Dec 2004 16:23:29 -0600

"Todd Kreuter [dBVIPS]" wrote in message
news:41D1D3DA.74B1A1F3@dbvips.usa...
>
> Did you paste the right one? You said you found GetCurrentThemeName but
> posted DrawThemeBackground. DrawThemeBackground is a bit out of my
> league. Whenever I see an API that uses a device context (HDC) I say
> "never mind" .

Well, I think I need them both . But you are right, I should have posted
the one that I first mentioned, only that one looked to easy .

For me, the big question is still just how to translate all of the
information in the MSDN into something I can use...

Jan
From:Todd Kreuter [dBVIPS]
Subject:Re: How to prototype functions?
Date:Tue, 28 Dec 2004 17:53:38 -0500
Jan Hoelterling wrote:
>
> Well, I think I need them both . But you are right, I should have posted
> the one that I first mentioned, only that one looked to easy .

Oh my

> For me, the big question is still just how to translate all of the
> information in the MSDN into something I can use...

Not sure there is one good source of information. I normally look in the
include folder at the .h header files for whatever translations or
information I can get (windef.h is good), then at any samples I can
find, either dbase samples or other other languages.

I can only help slightly with the DrawThemeBackground...

I don't have any information on HRESULT or HTHEME, but I assume those
are handles to something because they start with "H". The HDC is a
handle to a device context. For handles, someting needs to exist or you
need to create it, for example you can get a device context handle using
GetDC. The iPartID and iStateID are integer values that are probably
defined on the site or somewhere else. The RECTS are window rectangular
coordinates. The extern in dBASE would be something like:

extern CHANDLE DrawThemeBackground(CHANDLE, CHANDLE, CINT, CINT, CPTR,
CPTR) User32 ?

The RECT CPTRs need to be 16 bytes, i.e. cRect1 = REPLICATE(CHR(0), 8)

Like I said, not much help here ...

--
Todd Kreuter [dBVIPS]
   

Copyright © 2006 newsgroups-index   -   All rights reserved   -   Impressum