Powerbasic Museum 2020-B

Archive => Archived Posts => Topic started by: José Roca on August 03, 2012, 09:28:30 PM

Title: Windows API Headers III v.1.04
Post by: José Roca on August 03, 2012, 09:28:30 PM
 
This project is an effort to translate the C headers of the Microsoft Platform SDK for Windows to PowerBASIC™. This version has been updated using the SDK for Windows 7.1.

These headers are freeware, not public domain. This means that you can use them for your own purposes, even in commercial applications, without paying a fee, but not to make derivative works from, sell or redistribute without permission. Also you must assume the entire risk of using them. Downloading the software indicates that you accept these terms.

Because of the use of new data types only available in PNWIN 10.0+ and PBCC 6.0+ and other features, they can only be used with the new compilers.

You must also be aware that these headers are not extensions to the ones provided with the compiler, but a full replacement. Therefore, you must not mix them with the PowerBASIC include files in any way, neither directly (via #INCLUDE), nor indirectly (via the include path in the IDE).

Unzip the attached file to a folder of your choice and replace the PB Include path in the PB Ide or the editor that you are using to that folder instead of C:\PBWin10\WinApi.

The wrapper functions for the Common Controls have been removed from CommCtrl.inc and placed in the following individual files. Therefore, the use of constants such %NOTOOLBAR, %NOUPDOWN, etc., is no longer needed. Just #INCLUDE the wanted files in your application.

AnimateCtrl.inc (Animation control)
ButtonCtrl.inc (Button control)
ComboBoxCtrl.inc (ComboBox control)
ComboBoxExCtrl.inc (ComboBoxEx control)
DateTimeCtrl.inc (Date Time control)
EditCtrl.inc (Edit control)
HeaderCtrl.inc (Header control)
HotKeyCtrl.inc (Hot Key control)
IPAddressCtrl.inc (IP Address control)
ListBoxCtrl.inc (ListBox control)
ListViewCtrl.inc (ListView control)
MonthCalCtrl.inc (Month Calendar control)
PagerCtrl.inc (Pager control)
ProgressBarCtrl.inc (Progress Bar control)
RebarCtrl.inc (Rebar control)
RichEditCtrl.inc (Rich Edit control)
ScrollBarCtrl.inc (Scroll Bar control)
StaticCtrl.inc (Static control)
StatusbarCtrl.inc (Status Bar control)
SysLinkCtrl.inc (SysLink control)
TabCtrl.inc (Tab control)
TaskDialogCtrl.inc (Task Dialog control)
ToolbarCtrl.inc (Toolbar control)
TrackbarCtrl.inc (Track Bar control)
TreeViewCtrl.inc (TreeView control)
UpDownCtrl.inc (UpDown control)

There are 1,200 files using 78,079,357 bytes.
Title: Windows API Headers III v.1.04 Help File
Post by: José Roca on August 03, 2012, 09:30:48 PM
Help file for the main classes and wrapper functions available in the version 3.1.04 of the Windows API Headers for PBWin 10+ and PBCC 6+.
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on August 03, 2012, 09:47:22 PM
What is new?

New functions:

AfxGetDefaultBrowserPath
AfxGetDefaultBrowserName
AfxGetDefaultMailClientPath
AfxGetDefaultClientMailName
AfxGetDllPath
AfxGetDllVersion
AfxGetDomainOrWorkGroup
AfxGetInternetExplorerVersion
AfxGetOSArchitecture
AfxGetPathFromhInstance
AfxGetPathFromWindowHandle
AfxGetSystemType
AfxGetTokenElevationType
AfxGetUserAndDomainFromPid
AfxIsPartOfDomain
AfxIsSimpleMapiInstalled
AfxIsUserAdmin
AfxLoadFileToString
AfxPointSizeToDIp
AfxPrintBitmalDlg
AfxUnscaleX
AfxUnscaleY
AfxUrlExists
Button_SetImageList
GdipPlusDllVersion
GdiPlusPrintImage
GdiPlusPrintImageDlg
GdiPlusPrintResourceImage
GdiPlusPrintResourceImageDlg

New classes:

CSQLite
CAfxSmtpMail
CAfxMp3

Modifications:

CAfxProtableDevices.inc file changed to CAfxPortableDevices.inc
CWindow_InputBox: Added optional parameter bPassword.
SciLexer.inc, Scintilla.inc and SciCtrl.inc updated to version 3.2.0.
Title: Re: Windows API Headers III v.1.04
Post by: Pierre Bellisle on August 04, 2012, 06:39:06 AM
Thank José...

Pierre
Title: Re: Windows API Headers III v.1.04
Post by: Petr Schreiber on August 04, 2012, 09:51:33 AM
Thank you José,

I would only add that this update contains very important fix to glext.inc and cglext.inc, which corrects a problem with glShaderSource.


Petr
Title: Re: Windows API Headers III v.1.04
Post by: Peter Weis on August 04, 2012, 01:23:42 PM
Hello Jose,

thank you for change variable iImageList in include ListViewCtrl.inc

regards Peter
Title: Re: Windows API Headers III v.1.04
Post by: Donald Ping on August 06, 2012, 04:08:05 PM
Thank you José.
Title: Re: Windows API Headers III v.1.04
Post by: Tiziano Magni on August 07, 2012, 05:19:19 PM
Many thanks, José
Title: Re: Windows API Headers III v.1.04
Post by: Theo Gottwald on August 08, 2012, 12:02:57 PM
Great additions, Jose. Even there is an E-Mail Class now.
Title: Re: Windows API Headers III v.1.04
Post by: David Warner on August 08, 2012, 01:15:21 PM
Thanks José you are amazing!
Title: Re: Windows API Headers III v.1.04
Post by: Francisco Castanedo on August 09, 2012, 10:38:15 PM
Thank you very much José
Title: Re: Windows API Headers III v.1.04
Post by: Eddy Larsson on August 10, 2012, 04:28:07 PM
thanks so much, Jose

Eddy
Title: Re: Windows API Headers III v.1.04
Post by: Tsai Ji Fong on August 11, 2012, 11:32:08 AM
Thanks José

best regards,
tsai ji fong
Title: Re: Windows API Headers III v.1.04
Post by: Gary Beene on August 20, 2012, 04:04:38 AM
My thanks as well!  Jose, your dedication to helping the entire PowerBASIC community is just amazing and very much appreciated!

Ever since I understood the value of your work, I've been in a dilemma on what includes to use in the code I post in the forums.  I don't know for sure, but I've always figured that most of the folks in the forums have stuck with the PowerBASIC includes - mostly because they are comfortable that those headers will work best with their PowerBASIC code.  Since my own code has mostly been intended to help folks on the forums, I stuck with the PowerBASIC includes.

When PowerBASIC recently gave you your own corner at the PowerBASIC site, I think it was a great step towards making your includes the first choice in includes for PowerBASIC programmers.  And with all of the features that you continue to add to your include files, features not available in the PowerBASIC includes,  it has become impossible for me to ignore the benefits of switching over.

So starting today, I'm switching over to your includes for all of my posted code and my apps. However late to the party I've been, count me on-board!

If you have any suggestions on how I can help promote your includes, feel free to speak up. I think aggressively putting the option in front of users - especially new users - will be doing them a service!
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on August 20, 2012, 06:23:36 PM
The best way to promote them is to use them. My first goal was to give PBer's what C++ programmers have: a full set of headers to allow to use anything that Windows provide. I have a deep knowledge of the Windows API and COM, and the translations aren't quick and dirty ones or partial. I promised Bob a ton of wrappers if dead code removal was implemented. There are several help files available and thousands of examples. I'm providing full source code, not black boxes. Don't know what more can I do.

Title: Re: Windows API Headers III v.1.04
Post by: James A Gant on August 30, 2012, 07:05:04 AM
Jose,

Thank you very much for all the work you have put into these.

James A. Gant
Title: Re: Windows API Headers III v.1.04
Post by: Randall Glass on September 04, 2012, 11:50:38 AM
I have the Powerbasic 9.05.

Where can I get the old headers?

Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 04, 2012, 03:27:10 PM
There: http://www.jose.it-berater.org/smfforum/index.php?topic=4136.0
Title: Re: Windows API Headers III v.1.04
Post by: Patrice Terrier on September 18, 2012, 04:40:17 PM
José

The GetProcessHandleFromHwnd API seems to be missing in the OleAcc.inc

...
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 18, 2012, 09:27:48 PM
It is not included in OleAcc.h.
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 18, 2012, 09:41:04 PM
I will add it to OleAcc.inc, but it is not included in any of the versions of OleAcc.h that I have.


' // Documented, but not included in OleAcc.h
DECLARE FUNCTION GetProcessHandleFromHwnd IMPORT "OLEACC.DLL" ALIAS "GetProcessHandleFromHwnd" ( _
   BYVAL hwnd AS DWORD _                                ' __in HWND hwnd
) AS DWORD                                             ' HANDLE

Title: Re: Windows API Headers III v.1.04
Post by: Patrice Terrier on September 18, 2012, 10:42:38 PM
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318087(v=vs.85).aspx
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 18, 2012, 11:35:23 PM
Yet, it is documented in MSDN, but not included in the headers.
Title: Re: Windows API Headers III v.1.04
Post by: Patrice Terrier on September 19, 2012, 08:59:33 AM
It comes up to be very handy when you need to interact with external process.

Here is an example of use:

FUNCTION ExeTerminate(BYVAL hWnd AS DWORD) AS LONG
    IF IsWindow(hWnd) THEN
        LOCAL hProcess AS DWORD
        hProcess = GetProcessHandleFromHwnd(hWnd)
        IF hProcess THEN
           IF TerminateProcess(hProcess, 9) THEN
              WaitForInputIdle(hProcess, %INFINITE)
              FUNCTION = %TRUE
           END IF
        END IF
    END IF
END FUNCTION
Title: Re: Windows API Headers III v.1.04
Post by: Doug McDonald on January 21, 2013, 05:17:36 PM
Thank you !!!!
Title: Re: Windows API Headers III v.1.04
Post by: Theo Gottwald on July 13, 2013, 11:48:37 PM
548 Downloads this version. I am using these only ...

In SciCtrl.inc looks like there are a few bugs inside.
One is the

SCI_AutocSetSeparator()

It needs an ASC-Value as Parameter, not a STRPTR().

FUNCTION SCI_AutocSetSeparator (BYVAL hSci AS DWORD, BYVAL strSeparator AS BYTE) AS LONG
   FUNCTION = SendMessageA(hSci, %SCI_AUTOCSETSEPARATOR, strSeparator, 0)
END FUNCTION
' ========================================================================================
' ========================================================================================
FUNCTION SCIP_AutocSetSeparator (BYVAL pSci AS DWORD, BYVAL strSeparator AS BYTE) AS LONG
   FUNCTION = Scintilla_DirectFunction(pSci, %SCI_AUTOCSETSEPARATOR, strSeparator, 0)
END FUNCTION   
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on July 14, 2013, 12:36:44 AM
THis should be easier to use with PB.


' ========================================================================================
FUNCTION SCI_AutocSetSeparator (BYVAL hSci AS DWORD, BYVAL strSeparator AS STRING) AS LONG
   FUNCTION = SendMessageA(hSci, %SCI_AUTOCSETSEPARATOR, ASC(strSeparator), 0)
END FUNCTION
' ========================================================================================
' ========================================================================================
FUNCTION SCIP_AutocSetSeparator (BYVAL pSci AS DWORD, BYVAL strSeparator AS STRING) AS LONG
   FUNCTION = Scintilla_DirectFunction(pSci, %SCI_AUTOCSETSEPARATOR, ASC(strSeparator), 0)
END FUNCTION
' ========================================================================================

Title: Re: Windows API Headers III v.1.04
Post by: Theo Gottwald on July 14, 2013, 06:48:25 AM
Of course, Jose, because you can just write

SCIP_AutocSetSeparator (pSci," ")
instead of
SCIP_AutocSetSeparator (pSci,32)

I found this some weeks before, there may be few more such cases in the include file.

Title: Re: Windows API Headers III v.1.04
Post by: Paul Squires on September 13, 2013, 04:10:46 PM
Edit_GetRightMargin is spelled incorrectly in "EditCtrl.inc". The "h" and the "t" are reversed.


' ========================================================================================
' Gets the width of the right margin for an edit control.
' ========================================================================================
FUNCTION Edit_GetRigthMargin (BYVAL hEdit AS DWORD) AS LONG
   FUNCTION = HI(WORD, SendMessage(hEdit, %EM_GETMARGINS, 0, 0))
END FUNCTION
' ========================================================================================


"Rigth" should be "Right"

Not sure if this was already fixed but I just came across it today while working on some code.

Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 13, 2013, 05:07:52 PM
Thanks very much. I will post a new version soon, since I have updated some third party libraries and did some minor corrections to other files.
Title: Re: Windows API Headers III v.1.04
Post by: David Warner on September 26, 2013, 01:25:59 PM
Hi  José,

I just noticed a small typo in WinApiHeaders.chm
AfxOpenFileDialog is listed in the index as AfxOpelFileDialog
and the topic header is the same.

I must say that your header files really are a 'tour de force'.
Thanks again for all your amazing efforts.

Best Regards,

David
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 26, 2013, 03:15:56 PM
Thanks very much. I have modified the help file.
Title: Re: Windows API Headers III v.1.04
Post by: David Warner on September 26, 2013, 06:27:47 PM
Here are a few more for you to review...

WinApiHeaders.chm

Index entry                                       Correction?
------------------------------------------------  --------------------------
AfxQuadDateToFormatedStr                          AfxQuadDateToFormattedStr
AfxQuadTimeToFormatedStr                          AfxQuadTimeToFormattedStr
Button_SetImaleListXY                             Button_SetImageListXY

Topic headers                               
ControlClientHeight (Poperty)                     ControlClientHeight (Property)
ControlClientWidth (Poperty)                      ControlClientWidth (Property)
ControlHeight (Poperty)                           ControlHeight (Property)

CotH [Method]
A single index entry offers two topic options
(CosH [Method] and CotH [Method])
Is this correct?

DaysInYear Method [CAfxTime Class]
Topic content under "PowerBASIC Syntax"
METHOD DayusInYear () AS LONG                     METHOD DaysInYear () AS LONG

Delete Tooltip Method [CWindow Class]         
Topic header "DeleteTooltip (Method)"
Topic content under "PowerBASIC Syntax"
METHOD Tooltip_Delete                             METHOD DeleteTooltip

EditWordBreakProc
A single index entry offers two identical
topic options (topic content differs slightly)
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 26, 2013, 07:26:58 PM
Thanks again. I have modified these entries and a couple of "formated" more.
Title: Re: Windows API Headers III v.1.04
Post by: Paul Squires on September 27, 2013, 07:00:03 PM
Not sure if this one has been reported already:

' ========================================================================================
' Selects all items.
' ========================================================================================
SUB ListView_SetlectAllItems (BYVAL hwndLV AS DWORD)
   LOCAL lvi AS LVITEM
   lvi.mask = %LVIF_STATE
   lvi.state = -1
   lvi.stateMask = %LVIS_SELECTED
   SendMessage hwndLV, %LVM_SETITEMSTATE, -1, VARPTR(lvi)
END SUB


ListView_SetlectAllItems should be ListView_SelectAllItems  (remove the first "t" from SetlectAllItems)

Title: Re: Windows API Headers III v.1.04
Post by: José Roca on September 27, 2013, 07:19:32 PM
Thanks very much. I probably missed this one because if forgot to add an entry for it in the help file, that I have added now.

The "formatted" one is a problem that I have with that word, because in Spanish is "formateado", with only one "t".
Title: Re: Windows API Headers III v.1.04
Post by: David Warner on October 01, 2013, 11:44:03 PM
Quote from: José Roca on September 27, 2013, 07:19:32 PM
The "formatted" one is a problem that I have with that word, because in Spanish is "formateado", with only one "t".

No worries! So, you have a minor problem with one English word.
I have a problem with 99.999% of Spanish words.  ;D

Anyway, here are a few more entries for you to check out...
Index entry                                       Correction? / Comment
------------------------------------------------  --------------------------

Eqv [Method] (CVariant Class)
Topic content under "PowerBASIC Syntax"
METHOD Add                                        METHOD Eqv

~~~

FormatCurrency [Method] (CVariant Class)
Topic content under "PowerBASIC Syntax"
METHOD FormatPercent                              METHOD FormatCurrency

~~~

FromDoubleVector [Method] (CProp Variant Class)
Topic content under "PowerBASIC Syntax"
METHOD FromInt64Vector                            METHOD FromDoubleVector

~~~

ListBox_CalcHorizontabExtent Function             ListBox_CalcHorizontalExtent
Topic Title
ListBox_CalcHorizontabExtent                      ListBox_CalcHorizontalExtent

~~~

Index contains inconsistent use of brackets and square brackets.
e.g.    SA_1D_AppendWord Method (CDictionary Class)
        SA_1D_AppendWString Method [CSafeArray Class]
Should they all just use round brackets?

~~~

SA_1D_AppendVariant Method [CSafeArray Class]
Topic content under "PowerBASIC Syntax"
METHOD SA_1D_AppendVariantElement                 METHOD SA_1D_AppendVariant

~~~

SA_1D_AppendUnknown Method (CDictionary Class)
Topic content under "PowerBASIC Syntax"
METHOD SA_1D_AppendDecimal                        METHOD SA_1D_AppendUnknown

~~~

SA_1D_PutCurrency Method (CDictionary Class)
Topic content under "PowerBASIC Syntax"
METHOD SA_1D_PutDouble                            METHOD SA_1D_PutCurrency

~~~

SA_1D_PutWString Method [CSafeArray Class]
Topic content under "PowerBASIC Syntax"
METHOD SA_1D_PutString                            METHOD SA_1D_PutWString

~~~

SetPatsBySize Method (CWindow Class)              should read Parts not Pats.
                                                  SetStatusBarPartsBySize Method (CWindow Class)
Topic Header
SetPartsBySize (Method)                           SetStatusBarPartsBySize (Method)

Topic content under "PowerBASIC Syntax"
METHOD SetStatusbarPartsBySize                    Should match index entry and topic header.

~~~

SetPositions Metod [IAfxMp3 Interface]            SetPositions Method [IAfxMp3 Interface]

~~~

ToDoubleArray Method [CVariant Class]
Topic content under "PowerBASIC Syntax"
METHOD ToInt64Array                               METHOD ToDoubleArrayAlloc

~~~

ToDoubleVector Method [CPropVariant Class]
Topic content under "PowerBASIC Syntax"
METHOD ToInt64Array                               METHOD ToDoubleVector

~~~

XPButton_SetBitmapFromFile Function [XPButton Control (Themed)]
Topic content under "PowerBASIC Syntax"
FUNCTION XPButton_SetIconFromFile                 FUNCTION XPButton_SetBitmapFromFile

~~~
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on October 02, 2013, 01:01:12 AM
Thanks very much. I also have changed the return type of several of the XPButton function from LONG to DWORD for consistency.

If you wonder why there were so many errors in the CSafeArray class, it is because it was not a fully finished work, but a draft. During the beta testing of the compiler, I asked Bob if he was going to add support for safe arrays. As I didn't get a clear reply, I began to work in the class, and then Bob released a beta version with safe array support :)
Title: Re: Windows API Headers III v.1.04
Post by: Jim Reeder on October 03, 2013, 05:25:13 AM
I am a bit confused as to where to find the latest versions.  For instance, the WinApiHeaders.rar file contents has a last modified date of 8/3/2012.

The source code file for CSED has a note that The Win API Headers ver 2.02+ is required, however, the download file is WINAPI_III_1.04 with contents that have most recent modified date of 8/3/2012.

Perhaps I am not interpreting these dates correctly.
Title: Re: Windows API Headers III v.1.04
Post by: José Roca on October 03, 2013, 06:07:44 AM
The latest released version is WINAPI_III_1.04. The 2.02 version was for PB9. If the code for CSED mentions 2.02 must be that I have forgot to change it, but it requires the III series, that support unicode.
Title: Re: Windows API Headers III v.1.04
Post by: Theo Gottwald on October 06, 2013, 11:27:50 AM
Jose, could you also address the small issues in the Scintilla*.inc?


' ========================================================================================
' SCI_ADDSTYLEDTEXT(int length, cell *s)
' This behaves just like SCI_ADDTEXT, but inserts styled text.
' ========================================================================================
' ========================================================================================
FUNCTION SCI_AddStyledText (BYVAL hSci AS DWORD, BYVAL strText AS STRING) AS LONG
   FUNCTION = SendMessageA(hSci, %SCI_ADDSTYLEDTEXT, LEN(strText), STRPTR(strText))
END FUNCTION
' ========================================================================================
' ========================================================================================
FUNCTION SCIP_AddStyledText (BYVAL pSci AS DWORD, BYVAL strText AS STRING) AS LONG
   FUNCTION = Scintilla_DirectFunction(pSci, %SCI_ADDSTYLEDTEXT, LEN(strText), STRPTR(strText))
END FUNCTION
' ========================================================================================     

Contained a small typing mistake (s/d)
Title: Re: Windows API Headers III v.1.04
Post by: Theo Gottwald on October 06, 2013, 11:41:23 AM
I have always promoted to use your headers as the official.
Now the people at PB HQ have been blindfolded in the past and did never realize the potential value of your contribution.
Its not your fault, it was because ... you know it blinds people.
Yet we all use your headers. I use them for any new project and also for all my major projects.
Any seriouse Visual Designer in the PB Market also wether uses exclusively Your Includes OR includes them at least as an option.