Ver código fonte

API glue enhancements.

woollybah 9 anos atrás
pai
commit
9497047b9d

+ 1 - 1
directx.mod/d3d9x.bmx

@@ -18,7 +18,7 @@ End Type
 
 End Extern
 
-Global d3dx9Lib=LoadLibraryA( "d3dx9" )
+Global d3dx9Lib:Byte Ptr=LoadLibraryA( "d3dx9" )
 
 If Not d3dx9Lib Return
 

+ 1 - 1
directx.mod/dd.bmx

@@ -1752,7 +1752,7 @@ End Type
 
 End Extern
 
-Global ddLib=LoadLibraryA( "ddraw" )
+Global ddLib:Byte Ptr=LoadLibraryA( "ddraw" )
 
 If Not ddLib Return
 

+ 1 - 1
directx.mod/dsound.bmx

@@ -183,7 +183,7 @@ End Extern
 
 Private
 
-Global _ds=LoadLibraryA( "dsound" )
+Global _ds:Byte Ptr=LoadLibraryA( "dsound" )
 
 Public
 

+ 382 - 27
win32.mod/com.bmx

@@ -7,11 +7,23 @@ Extern "win32"
 
 Function CLSIDFromProgID(code$w,clsid:Byte Ptr)
 Function CoCreateInstance(rclsid:Byte Ptr,pUnkOuter:Byte Ptr,dwClsContext,riid:Byte Ptr,ppv:Byte Ptr Ptr)
-Function IIDFromString(lpsz$w,riid:Byte Ptr)
+Function IIDFromString_(lpsz$w,riid:Byte Ptr)="IIDFromString"
+Function StringFromIID_(riid:Byte Ptr,lpsz:Short Ptr Ptr)="StringFromIID"
 End Extern
 
+Function IIDFromString(lpsz:String, riid:GUID)
+	Return IIDFromString_(lpsz, riid.guidPtr)
+End Function
+
+Function StringFromIID(riid:GUID, lpsz:String Var)
+	Local sp:Short Ptr
+	Local res:Int = StringFromIID_(riid.guidPtr, Varptr sp)
+	lpsz = String.FromWString(sp)
+	Return res
+End Function
+
 Extern
-	Function bmx_win32_com_IUnknown_QueryInterface:Int(handle:Byte Ptr, riid:Byte Ptr, ppvObj:Byte Ptr)
+	Function bmx_win32_com_IUnknown_QueryInterface:Int(handle:Byte Ptr, riid:Byte Ptr, ppvObj:Byte Ptr Ptr)
 	Function bmx_win32_com_IUnknown_AddRef:Int(handle:Byte Ptr)
 	Function bmx_win32_com_IUnknown_Release:Int(handle:Byte Ptr)
 End Extern
@@ -19,7 +31,7 @@ End Extern
 Type IUnknown
 	Field unknownPtr:Byte Ptr
 	
-	Method QueryInterface:Int( riid:Byte Ptr,ppvObj:Byte Ptr )'="IUnknown_QueryInterface"
+	Method QueryInterface:Int( riid:Byte Ptr,ppvObj:Byte Ptr Ptr )'="IUnknown_QueryInterface"
 		Return bmx_win32_com_IUnknown_QueryInterface(unknownPtr, riid, ppvObj)
 	End Method
 	
@@ -38,94 +50,237 @@ Extern
 Function SysAllocStringLen:Short Ptr(bstr:Short Ptr,length)
 Function SysFreeString(bstr:Short Ptr)
 End Extern
-Rem
+
 Type IDispatch Extends IUnknown
-	Method QueryInterface( riid:Byte Ptr,ppvObj:Byte Ptr )="IDispatch_QueryInterface"
-	Method AddRef()="IDispatch_AddRef"
-	Method Release_()="IDispatch_Release"
-
-	Method lfGetTypeInfoCount(pctinfo:Byte Ptr)="IDispatch_lfGetTypeInfoCount"
-	Method lfGetTypeInfo(iTInfo,lcid,ITypeInfo:Byte Ptr)="IDispatch_lfGetTypeInfo"
-	Method lfGetIDsOfNames( riid:Byte Ptr,rgszNames:Byte Ptr Ptr,cNames,lcid,rgDispId:Byte Ptr)="IDispatch_lfGetIDsOfNames"
-	Method Invoke(dispIdMember:Byte Ptr,riid:Byte Ptr,lcid,wFlags,pDispParams:Byte Ptr,pVarResult:Byte Ptr,pExcepInfo:Byte Ptr,puArgErr:Byte Ptr)="IDispatch_Invoke"
+'	Method QueryInterface( riid:Byte Ptr,ppvObj:Byte Ptr )="IDispatch_QueryInterface"
+'	Method AddRef()="IDispatch_AddRef"
+'	Method Release_()="IDispatch_Release"
+
+	Method lfGetTypeInfoCount(pctinfo:Byte Ptr)'="IDispatch_lfGetTypeInfoCount"
+	End Method
+	
+	Method lfGetTypeInfo(iTInfo,lcid,ITypeInfo:Byte Ptr)'="IDispatch_lfGetTypeInfo"
+	End Method
+	
+	Method lfGetIDsOfNames( riid:Byte Ptr,rgszNames:Byte Ptr Ptr,cNames,lcid,rgDispId:Byte Ptr)'="IDispatch_lfGetIDsOfNames"
+	End Method
+	
+	Method Invoke(dispIdMember:Byte Ptr,riid:Byte Ptr,lcid,wFlags,pDispParams:Byte Ptr,pVarResult:Byte Ptr,pExcepInfo:Byte Ptr,puArgErr:Byte Ptr)'="IDispatch_Invoke"
+	End Method
+	
 End Type
 
+Extern
+	Function bmx_win32_IWebBrowser_get_LocationURL:Int(handle:Byte Ptr, LocationURL:Short Ptr Ptr)
+	Function bmx_win32_IWebBrowser_get_LocationName:Int(handle:Byte Ptr, LocationName:Short Ptr Ptr)
+	Function bmx_win32_IWebBrowser_get_Document:Int(handle:Byte Ptr, ppDisp:Byte Ptr Ptr)
+End Extern
 Type IWebBrowser Extends IDispatch	
 	Method lfGoBack()
+	End Method
+	
 	Method lfGoForward()
+	End Method
+
 	Method lfGoHome()
+	End Method
+
 	Method lfGoSearch()
+	End Method
+
 	Method lfNavigate(URL$w,Flags:VARIANT,TargetFrameName:VARIANT,PostData:VARIANT,Headers:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfRefresh()
+	End Method
+
 	Method lfRefresh2(Level:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfStop()
+	End Method
+
 	Method lfget_Application(ppDisp:IDispatch Ptr Ptr) 
+	End Method
+
 	Method lfget_Parent(ppDisp:IDispatch Ptr Ptr)
+	End Method
+
 	Method lfget_Container(ppDisp:IDispatch Ptr Ptr)
-	Method lfget_Document(ppDisp:IDispatch Ptr)
+	End Method
+
+	Method lfget_Document(ppDisp:Byte Ptr Ptr)
+		bmx_win32_IWebBrowser_get_Document(unknownPtr, ppDisp)
+	End Method
+
 	Method lfget_TopLevelContainer(pBool:Short Ptr)
+	End Method
+
 	Method lfget_Type(_Type$w)	
+	End Method
+
 	Method lfget_Left(pl:Int Ptr)
+	End Method
+
 	Method put_Left(Left) 
+	End Method
+
 	Method lfget_Top(pl:Int Ptr)
+	End Method
+
 	Method put_Top(Top)
+	End Method
+
 	Method lfget_Width(pl:Int Ptr)
+	End Method
+
 	Method put_Width(Width)
+	End Method
+
 	Method lfget_Height(pl:Int Ptr)
+	End Method
+
 	Method put_Height(Height)
+	End Method
+
 	Method lfget_LocationName(LocationName:Short Ptr Ptr)
+		Return bmx_win32_IWebBrowser_get_LocationName(unknownPtr, LocationName)
+	End Method
+
 	Method lfget_LocationURL(LocationURL:Short Ptr Ptr)
+		Return bmx_win32_IWebBrowser_get_LocationURL(unknownPtr, LocationURL)
+	End Method
+
 	Method lfget_Busy(pBool:Short Ptr)
+	End Method
+
 End Type
 
 Type IWebBrowserApp Extends IWebBrowser
 	Method lfQuit()
+	End Method
+
 	Method lfClientToWindow(pcx:Int Ptr,pcy:Int Ptr) 
+	End Method
+
 	Method lfPutProperty(Property$w,vtValue:Byte Ptr) 'VARIANT)	'simon come here 
+	End Method
+
 	Method lfGetProperty(Property$w,vtValue:Byte Ptr) 'VARIANT) 
+	End Method
+
 	Method lfget_Name(Name:Byte Ptr )
+	End Method
+
 	Method lfget_HWND(pHWND:Int Ptr)
+	End Method
+
 	Method lfget_FullName(FullName:Short Ptr Ptr)
+	End Method
+
 	Method lfget_Path(Path:Short Ptr Ptr)
+	End Method
+
 	Method lfget_Visible(pBool:Short Ptr)
+	End Method
+
 	Method put_Visible(Value:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfget_StatusBar(pBool:Short Ptr)
+	End Method
+
 	Method put_StatusBar(Value:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfget_StatusText(StatusText:Short Ptr Ptr)
+	End Method
+
 	Method put_StatusText(StatusText$w)
+	End Method
+
 	Method lfget_ToolBar(Value:Int Ptr)
+	End Method
+
 	Method put_ToolBar(Value)
+	End Method
+
 	Method lfget_MenuBar(Value:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method put_MenuBar(Value:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfget_FullScreen(pbFullScreen:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method put_FullScreen(bFullScreen:Byte Ptr) 'VARIANT)
+	End Method
+
 End Type
 
 Type IWebBrowser2 Extends IWebBrowserApp
 	Method lfNavigate2(URL:VARIANT,Flags:VARIANT,TargetFrameName:VARIANT,PostData:VARIANT,Headers:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfQueryStatusWB(cmdID,pcmdf)
+	End Method
+
 	Method lfExecWB(cmdID,cmdexecopt,pvaIn:VARIANT,pvaOut:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method lfShowBrowserBar(pvaClsid:VARIANT,pvarShow:VARIANT,pvarSize:Byte Ptr) 'VARIANT)
+	End Method
+
 	Method get_ReadyState(plReadyState:Int Ptr)
+	End Method
+
 	Method lfget_Offline(pbOffline:Short Ptr)
+	End Method
+
 	Method put_Offline(bOffline)
+	End Method
+
 	Method lfget_Silent(pbSilent:Short Ptr)
+	End Method
+
 	Method put_Silent(bSilent)
+	End Method
+
 	Method lfget_RegisterAsBrowser(pbRegister:Short Ptr)
+	End Method
+
 	Method put_RegisterAsBrowser(bRegister)
+	End Method
+
 	Method lfget_RegisterAsDropTarget(pbRegister:Short Ptr)
+	End Method
+
 	Method put_RegisterAsDropTarget(bRegister)
+	End Method
+
 	Method lfget_TheaterMode(pbRegister:Short Ptr) 
+	End Method
+
 	Method put_TheaterMode(bRegister)
+	End Method
+
 	Method lfget_AddressBar(Value:Short Ptr)
+	End Method
+
 	Method put_AddressBar(Value)
+	End Method
+
 	Method lfget_Resizable(Value:Short Ptr)
+	End Method
+
 	Method put_Resizable(Value)
-End Type
+	End Method
 
-' warning methods below maybe incorrectly described! 
+End Type
 
 Type IHTMLWindow2 Extends IDispatch
+Rem
     Method item(this:Byte Ptr,_variant:Byte Ptr)
     Method get_length(_pint:Int Ptr)
 
@@ -197,102 +352,287 @@ Type IHTMLWindow2 Extends IDispatch
     Method resizeTo(_int,_int1)
     Method resizeBy(_int,_int1)
     Method get_external(IDispatch:Byte Ptr Ptr)
+End Rem
 End Type
 
 Type IHTMLDocument2 Extends IDispatch
+Rem 
 	Method get_Script(IDispatch:Byte Ptr Ptr)
+	End Method
 
 	Method get_all(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_body(LPHTMLELEMENT:Byte Ptr)
+	End Method
+
 	Method get_activeElement(LPHTMLELEMENT:Byte Ptr)
+	End Method
+
 	Method get_images(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_applets(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_links(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_forms(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_anchors(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method put_title(_bstr:Short Ptr)
+	End Method
+End Rem
 	Method get_title(_pbstr:Short Ptr Ptr)
+	End Method
+Rem
 	Method get_scripts(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method put_designMode(_bstr:Short Ptr)
+	End Method
+
 	Method get_designMode(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_selection(LPHTMLSELECTIONOBJECT:Byte Ptr)
+	End Method
+
 	Method get_readyState(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_frames(LPHTMLFRAMESCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_embeds(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method get_plugins(LPHTMLELEMENTCOLLECTION:Byte Ptr)
+	End Method
+
 	Method put_alinkColor(_variant:Long)
+	End Method
+
 	Method get_alinkColor(this:Byte Ptr)
+	End Method
+
 	Method put_bgColor(_variant:Long)
+	End Method
+
 	Method get_bgColor(this:Byte Ptr)
+	End Method
+
 	Method put_fgColor(_variant:Long)
+	End Method
+
 	Method get_fgColor(this:Byte Ptr)
+	End Method
+
 	Method put_linkColor(_variant:Long)
+	End Method
+
 	Method get_linkColor(this:Byte Ptr)
+	End Method
+
 	Method put_vlinkColor(_variant:Long)
+	End Method
+
 	Method get_vlinkColor(this:Byte Ptr)
+	End Method
+
 	Method get_referrer(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_location(LPHTMLLOCATION:Byte Ptr)
+	End Method
+
 	Method get_lastModified(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method put_url(_bstr:Short Ptr)
+	End Method
+
 	Method get_url(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method put_domain(_bstr:Short Ptr)
+	End Method
+
 	Method get_domain(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method put_cookie(_bstr:Short Ptr)
+	End Method
+
 	Method get_cookie(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method put_expands(_variant:Short)
+	End Method
+
 	Method get_expands(_variant:Short Ptr)
+	End Method
+
 	Method put_charset(_bstr:Short Ptr)
+	End Method
+
 	Method get_charset(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method put_defaultCharset(_bstr:Short Ptr)
+	End Method
+
 	Method get_defaultCharset(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_mimeType(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_fileSize(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_fileCreatedDate(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_fileModifiedDate(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_fileUpdatedDate(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_security(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_protocol(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method get_nameProp(_pbstr:Short Ptr Ptr)
+	End Method
+
 	Method write(SAFEARRAY)
+	End Method
+
 	Method writeln(SAFEARRAY)
+	End Method
+
 	Method open(_bstr:Short Ptr,v1:Long,v2:Long,v3:Long,IDispatch:Byte Ptr Ptr)
+	End Method
+
 	Method close()
+	End Method
+
 	Method clear()
+	End Method
+
 	Method queryCommandSupported(_bstr:Short Ptr,_variantbool:Short Ptr)
+	End Method
+
 	Method queryCommandEnabled(_bstr:Short Ptr,_variantbool:Short Ptr)
+	End Method
+
 	Method queryCommandState(_bstr:Short Ptr,_variantbool:Short Ptr)
+	End Method
+
 	Method queryCommandIndeterm(_bstr:Short Ptr,_variantbool:Short Ptr)
+	End Method
+
 	Method queryCommandText(_bstr:Short Ptr,BSTR:Byte Ptr)
+	End Method
+
 	Method queryCommandValue(_bstr:Short Ptr,_variant:Byte Ptr)
+	End Method
+
 	Method execCommand(_bstr:Short Ptr,_variantbool:Short,_variant:Long,_variantpbool:Short Ptr)
+	End Method
+
 	Method execCommandShowHelp(_bstr:Short Ptr,_variantbool:Short Ptr)
+	End Method
+
 	Method createElement(_bstr:Short Ptr,LPHTMLELEMENT:Byte Ptr)
+	End Method
+
 	Method put_onhelp(_variant:Long)
+	End Method
+
 	Method get_onhelp(this:Byte Ptr)
+	End Method
+
 	Method put_onclick(_variant:Long)
+	End Method
+
 	Method get_onclick(this:Byte Ptr)
+	End Method
+
 	Method put_ondblclick(_variant:Long)
+	End Method
+
 	Method get_ondblclick(this:Byte Ptr)
+	End Method
+
 	Method put_onkeyup(_variant:Long)
+	End Method
+
 	Method get_onkeyup(this:Byte Ptr)
+	End Method
+
 	Method put_onkeydown(_variant:Long)
+	End Method
+
 	Method get_onkeydown(this:Byte Ptr)
+	End Method
+
 	Method put_onkeypress(_variant:Long)
+	End Method
+
 	Method get_onkeypress(this:Byte Ptr)
+	End Method
+
 	Method put_onmouseup(_variant:Long)
+	End Method
+
 	Method get_onmouseup(this:Byte Ptr)
+	End Method
+
 	Method put_onmousedown(_variant:Long)
+	End Method
+
 	Method get_onmousedown(this:Byte Ptr)
+	End Method
+
 	Method put_onmousemove(_variant:Long)
+	End Method
+
 	Method get_onmousemove(this:Byte Ptr)
+	End Method
+
 	Method put_onmouseout(_variant:Long)
+	End Method
+
 	Method get_onmouseout(this:Byte Ptr)
+	End Method
+
 	Method put_onmouseover(_variant:Long)
+	End Method
+
 	Method get_onmouseover(this:Byte Ptr)
+	End Method
+
 	Method put_onreadystatechange(_variant:Long)
+	End Method
+
 	Method get_onreadystatechange(this:Byte Ptr)
+	End Method
+
 	Method put_onafterupdate(_variant:Long)
+	End Method
+
 	Method get_onafterupdate(this:Byte Ptr)
+	End Method
+
 	Method put_onrowexit(_variant:Long)
 	Method get_onrowexit(this:Byte Ptr)
 	Method put_onrowenter(_variant:Long)
@@ -310,10 +650,9 @@ Type IHTMLDocument2 Extends IDispatch
 	Method get_onerrorupdate(this:Byte Ptr)
 	Method toString(_pbstr:Short Ptr Ptr)
 	Method createStyleSheet(_bstr:Short Ptr,_int,LPHTMLSTYLESHEET:Byte Ptr)
+End Rem
 End Type
 
-End Extern 
-End Rem
 
 Const IUnknown_UUID$="{00000000-0000-0000-C000-000000000046}"
 Const IDispatch_UUID$="{00020400-0000-0000-C000-000000000046}"
@@ -346,17 +685,33 @@ Const CLSCTX_ALL=(CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER
 Const CLSCTX_INPROC=(CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER)
 Const CLSCTX_SERVER=(CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER)
 
+Extern
+	Function bmx_win32_GUID_new:Byte Ptr()
+	Function bmx_win32_GUID_free(handle:Byte Ptr)
+End Extern
 Type GUID
-	Field	data1
-	Field	data2:Short,data3:Short
-	Field	data41:Byte
-	Field	data42:Byte
-	Field	data43:Byte
-	Field	data44:Byte
-	Field	data45:Byte
-	Field	data46:Byte
-	Field	data47:Byte
-	Field	data48:Byte
+	Field guidPtr:Byte Ptr
+
+	Method New()
+		guidPtr = bmx_win32_GUID_new()
+	End Method
+	
+	Method Delete()
+		If guidPtr Then
+			bmx_win32_GUID_free(guidPtr)
+			guidPtr = Null
+		End If
+	End Method	
+'	Field	data1
+'	Field	data2:Short,data3:Short
+'	Field	data41:Byte
+'	Field	data42:Byte
+'	Field	data43:Byte
+'	Field	data44:Byte
+'	Field	data45:Byte
+'	Field	data46:Byte
+'	Field	data47:Byte
+'	Field	data48:Byte
 End Type
 
 Type VARIANT

+ 35 - 5
win32.mod/com.cpp

@@ -1,20 +1,25 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-//#include <objbase.h>
-//#include <mmsystem.h>
 #include <stdio.h>
 #include <unknwn.h>
+#include <exdisp.h>
 
 extern "C" {
 
-	int bmx_win32_com_IUnknown_QueryInterface(IUnknown * unk, void * riid, void ** ppvObj);
+	int bmx_win32_com_IUnknown_QueryInterface(IUnknown * unk, REFIID riid, void ** ppvObj);
 	int bmx_win32_com_IUnknown_AddRef(IUnknown * unk);
 	int bmx_win32_com_IUnknown_Release(IUnknown * unk);
 
+	GUID * bmx_win32_GUID_new();
+	void bmx_win32_GUID_free(GUID * guid);
+
+	int bmx_win32_IWebBrowser_get_LocationURL(IWebBrowser * browser, BSTR * LocationURL);
+	int bmx_win32_IWebBrowser_get_LocationName(IWebBrowser * browser, BSTR * LocationName);
+	int bmx_win32_IWebBrowser_get_Document(IWebBrowser * browser, IDispatch ** disp);
 }
 
-int bmx_win32_com_IUnknown_QueryInterface(IUnknown * unk, void * riid, void ** ppvObj) {
-	return unk->QueryInterface((REFIID)riid, ppvObj);
+int bmx_win32_com_IUnknown_QueryInterface(IUnknown * unk, REFIID riid, void ** ppvObj) {
+	return unk->QueryInterface(riid, ppvObj);
 }
 
 int bmx_win32_com_IUnknown_AddRef(IUnknown * unk) {
@@ -24,3 +29,28 @@ int bmx_win32_com_IUnknown_AddRef(IUnknown * unk) {
 int bmx_win32_com_IUnknown_Release(IUnknown * unk) {
 	return unk->Release();
 }
+
+// ********************************************************
+
+GUID * bmx_win32_GUID_new() {
+	return (GUID *)malloc(sizeof(GUID));
+}
+
+void bmx_win32_GUID_free(GUID * guid) {
+	free(guid);
+}
+
+// ********************************************************
+
+int bmx_win32_IWebBrowser_get_LocationURL(IWebBrowser * browser, BSTR * LocationURL) {
+	return browser->get_LocationURL(LocationURL);
+}
+
+int bmx_win32_IWebBrowser_get_LocationName(IWebBrowser * browser, BSTR * LocationName) {
+	return browser->get_LocationName(LocationName);
+}
+
+int bmx_win32_IWebBrowser_get_Document(IWebBrowser * browser, IDispatch ** disp) {
+	return browser->get_Document(disp);
+}
+

+ 1 - 0
win32.mod/com.x

@@ -3,3 +3,4 @@ BBINT CoCreateInstance(BBBYTE * ,BBBYTE * ,BBINT ,BBBYTE * ,BBBYTE ** )!
 BBINT IIDFromString(BBSHORT * ,BBBYTE * )!
 BBSHORT * SysAllocStringLen(BBSHORT * ,BBINT )!
 BBINT SysFreeString(BBSHORT * )!
+HRESULT StringFromIID(REFIID, LPOLESTR *)!

+ 466 - 42
win32.mod/commctrl.bmx

@@ -284,15 +284,55 @@ Const CBEIF_DI_SETITEM=$10000000
 'Const CBEM_SETWINDOWTHEME=CCM_SETWINDOWTHEME
 
 ' Tab Control
-
+Extern
+	Function bmx_win32_TCITEMW_new:Byte Ptr()
+	Function bmx_win32_TCITEMW_free(handle:Byte Ptr)
+	Function bmx_win32_TCITEMW_Setmask(handle:Byte Ptr, mask:UInt)
+	Function bmx_win32_TCITEMW_SetpszText(handle:Byte Ptr, pszText:Short Ptr)
+	Function bmx_win32_TCITEMW_SetiImage(handle:Byte Ptr, iImage:Int)
+	Function bmx_win32_TCITEMW_pszText:Short Ptr(handle:Byte Ptr)
+End Extern
 Type TCITEMW
-	Field mask
-	Field dwState
-	Field dwStateMask
-	Field pszText:Short Ptr
-	Field cchTextMax
-	Field iImage
-	Field lParam
+	Field itemPtr:Byte Ptr
+
+	Method New()
+		itemPtr = bmx_win32_TCITEMW_new()
+	End Method
+	
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If itemPtr Then
+			bmx_win32_TCITEMW_free(itemPtr)
+			itemPtr = Null
+		End If
+	End Method
+	
+	Method Setmask(mask:Uint)
+		bmx_win32_TCITEMW_Setmask(itemPtr, mask)
+	End Method
+	
+	Method SetpszText(pszText:Short Ptr)
+		bmx_win32_TCITEMW_SetpszText(itemPtr, pszText)
+	End Method
+	
+	Method SetiImage(iImage:Int)
+		bmx_win32_TCITEMW_SetiImage(itemPtr, iImage)
+	End Method
+	
+	Method pszText:Short Ptr()
+		Return bmx_win32_TCITEMW_pszText(itemPtr)
+	End Method
+	
+'	Field mask
+'	Field dwState
+'	Field dwStateMask
+'	Field pszText:Short Ptr
+'	Field cchTextMax
+'	Field iImage
+'	Field lParam
 End Type
 
 ' TabberMessages
@@ -407,36 +447,231 @@ Const TCIF_PARAM=8
 Const TCIF_STATE=16
 
 'TreeView Control
-
+Extern
+	Function bmx_win32_TVITEMW_new:Byte Ptr()
+	Function bmx_win32_TVITEMW_free(handle:Byte Ptr)
+	Function bmx_win32_TVITEMW_Setmask(handle:Byte Ptr, mask:UInt)
+	Function bmx_win32_TVITEMW_SethItem(handle:Byte Ptr, hItem:Byte Ptr)
+	Function bmx_win32_TVITEMW_Setstate(handle:Byte Ptr, state:UInt)
+	Function bmx_win32_TVITEMW_SetstateMask(handle:Byte Ptr, stateMask:UInt)
+	Function bmx_win32_TVITEMW_SetpszText(handle:Byte Ptr, pszText:Short Ptr)
+	Function bmx_win32_TVITEMW_SetcchTextMax(handle:Byte Ptr, cchTextMax:Int)
+	Function bmx_win32_TVITEMW_SetiImage(handle:Byte Ptr, iImage:Int)
+	Function bmx_win32_TVITEMW_SetiSelectedImage(handle:Byte Ptr, iSelectedImage:Int)
+	Function bmx_win32_TVITEMW_SetcChildren(handle:Byte Ptr, cChildren:Int)
+	Function bmx_win32_TVITEMW_SetlParam(handle:Byte Ptr, lParam:Byte Ptr)
+	Function bmx_win32_TVITEMW_mask:Uint(handle:Byte Ptr)
+	Function bmx_win32_TVITEMW_hItem:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_TVITEMW_pszText:Short Ptr(handle:Byte Ptr)
+	Function bmx_win32_TVITEMW_iImage:Int(handle:Byte Ptr)
+	Function bmx_win32_TVITEMW_lParam:Byte Ptr(handle:Byte Ptr)
+End Extern
 Type TVITEMW
-	Field mask
-	Field hItem
-	Field state
-	Field stateMask
-	Field pszText:Short Ptr
-	Field cchTextMax
-	Field iImage
-	Field iSelectedImage
-	Field cChildren
-	Field lParam
-	Field iIntegral
+	Field itemPtr:Byte Ptr
+	
+	Method New()
+		itemPtr = bmx_win32_TVITEMW_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If itemPtr Then
+			bmx_win32_TVITEMW_free(itemPtr)
+			itemPtr = Null
+		End If
+	End Method
+	
+	Method Setmask(mask:UInt)
+		bmx_win32_TVITEMW_Setmask(itemPtr, mask)
+	End Method
+	
+	Method SethItem(hItem:Byte Ptr)
+		bmx_win32_TVITEMW_SethItem(itemPtr, hItem)
+	End Method
+	
+	Method Setstate(state:UInt)
+		bmx_win32_TVITEMW_Setstate(itemPtr, state)
+	End Method
+	
+	Method SetstateMask(stateMask:UInt)
+		bmx_win32_TVITEMW_SetstateMask(itemPtr, stateMask)
+	End Method
+	
+	Method SetpszText(pszText:Short Ptr)
+		bmx_win32_TVITEMW_SetpszText(itemPtr, pszText)
+	End Method
+	
+	Method SetcchTextMax(cchTextMax:Int)
+		bmx_win32_TVITEMW_SetcchTextMax(itemPtr, cchTextMax)
+	End Method
+	
+	Method SetiImage(iImage:Int)
+		bmx_win32_TVITEMW_SetiImage(itemPtr, iImage)
+	End Method
+	
+	Method SetiSelectedImage(iSelectedImage:Int)
+		bmx_win32_TVITEMW_SetiSelectedImage(itemPtr, iSelectedImage)
+	End Method
+	
+	Method SetcChildren(cChildren:Int)
+		bmx_win32_TVITEMW_SetcChildren(itemPtr, cChildren)
+	End Method
+	
+	Method SetlParam(lParam:Byte Ptr)
+		bmx_win32_TVITEMW_SetlParam(itemPtr, lParam)
+	End Method
+	
+	Method mask:Uint()
+		Return bmx_win32_TVITEMW_mask(itemPtr)
+	End Method
+	
+	Method hItem:Byte Ptr()
+		Return bmx_win32_TVITEMW_hItem(itemPtr)
+	End Method
+	
+	Method pszText:Short Ptr()
+		Return bmx_win32_TVITEMW_pszText(itemPtr)
+	End Method
+	
+	Method iImage:Int()
+		Return bmx_win32_TVITEMW_iImage(itemPtr)
+	End Method
+	
+	Method lParam:Byte Ptr()
+		Return bmx_win32_TVITEMW_lParam(itemPtr)
+	End Method
+'	Field mask
+'	Field hItem
+'	Field state
+'	Field stateMask
+'	Field pszText:Short Ptr
+'	Field cchTextMax
+'	Field iImage
+'	Field iSelectedImage
+'	Field cChildren
+'	Field lParam
+'	Field iIntegral
 End Type
 
+Extern
+	Function bmx_win32_TVINSERTSTRUCTW_new:Byte Ptr()
+	Function bmx_win32_TVINSERTSTRUCTW_free(handle:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_SethParent(handle:Byte Ptr, hParent:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_SethInsertAfter(handle:Byte Ptr, hInsertAfter:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_mask(handle:Byte Ptr, item_mask:UInt)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_hItem(handle:Byte Ptr, item_hItem:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_state(handle:Byte Ptr, item_state:UInt)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_stateMask(handle:Byte Ptr, item_stateMask:UInt)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_pszText(handle:Byte Ptr, item_pszText:Short Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_cchTextMax(handle:Byte Ptr, item_cchTextMax:Int)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_iImage(handle:Byte Ptr, item_iImage:Int)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_iSelectedImage(handle:Byte Ptr, item_iSelectedImage:Int)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_cChildren(handle:Byte Ptr, item_cChildren:Int)
+	Function bmx_win32_TVINSERTSTRUCTW_Setitem_lParam(handle:Byte Ptr, item_lParam:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_item_mask:UInt(handle:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_item_iImage:Int(handle:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_item_lparam:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_TVINSERTSTRUCTW_item_pszText:Short Ptr(handle:Byte Ptr)
+End Extern
 Type TVINSERTSTRUCTW
-	Field hParent
-	Field hInsertAfter
+	Field structPtr:Byte Ptr
+	
+	Method New()
+		structPtr = bmx_win32_TVINSERTSTRUCTW_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If structPtr Then
+			bmx_win32_TVINSERTSTRUCTW_free(structPtr)
+			structPtr = Null
+		End If
+	End Method
+	
+	Method SethParent(hParent:Byte Ptr)
+		bmx_win32_TVINSERTSTRUCTW_SethParent(structPtr, hParent)
+	End Method
+	
+	Method SethInsertAfter(hInsertAfter:Byte Ptr)
+		bmx_win32_TVINSERTSTRUCTW_SethInsertAfter(structPtr, hInsertAfter)
+	End Method
+	
+	Method Setitem_mask(item_mask:UInt)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_mask(structPtr, item_mask)
+	End Method
+	
+	Method Setitem_hItem(item_hItem:Byte Ptr)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_hItem(structPtr, item_hItem)
+	End Method
+	
+	Method Setitem_state(item_state:UInt)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_state(structPtr, item_state)
+	End Method
+	
+	Method Setitem_stateMask(item_stateMask:UInt)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_stateMask(structPtr, item_stateMask)
+	End Method
+	
+	Method Setitem_pszText(item_pszText:Short Ptr)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_pszText(structPtr, item_pszText)
+	End Method
+	
+	Method Setitem_cchTextMax(item_cchTextMax:Int)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_cchTextMax(structPtr, item_cchTextMax)
+	End Method
+	
+	Method Setitem_iImage(item_iImage:Int)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_iImage(structPtr, item_iImage)
+	End Method
+	
+	Method Setitem_iSelectedImage(item_iSelectedImage:Int)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_iSelectedImage(structPtr, item_iSelectedImage)
+	End Method
+	
+	Method Setitem_cChildren(item_cChildren:Int)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_cChildren(structPtr, item_cChildren)
+	End Method
+	
+	Method Setitem_lParam(item_lParam:Byte Ptr)
+		bmx_win32_TVINSERTSTRUCTW_Setitem_lParam(structPtr, item_lParam)
+	End Method
+	
+	Method item_mask:UInt()
+		Return bmx_win32_TVINSERTSTRUCTW_item_mask(structPtr)
+	End Method
+	
+	Method item_iImage:Int()
+		Return bmx_win32_TVINSERTSTRUCTW_item_iImage(structPtr)
+	End Method
+	
+	Method item_lparam:Byte Ptr()
+		Return bmx_win32_TVINSERTSTRUCTW_item_lparam(structPtr)
+	End Method
+	
+	Method item_pszText:Short Ptr()
+		Return bmx_win32_TVINSERTSTRUCTW_item_pszText(structPtr)
+	End Method
+	
+'	Field hParent
+'	Field hInsertAfter
 ' TVITEMW
-	Field item_mask
-	Field item_hItem
-	Field item_state
-	Field item_stateMask
-	Field item_pszText:Short Ptr
-	Field item_cchTextMax
- 	Field item_iImage
-	Field item_iSelectedImage
-	Field item_cChildren
-	Field item_lParam
-	Field itemx_iIntegral
+'	Field item_mask
+'	Field item_hItem
+'	Field item_state
+'	Field item_stateMask
+'	Field item_pszText:Short Ptr
+'	Field item_cchTextMax
+ '	Field item_iImage
+'	Field item_iSelectedImage
+'	Field item_cChildren
+'	Field item_lParam
+'	Field itemx_iIntegral
 End Type
 
 Const I_CHILDRENCALLBACK=-1
@@ -858,6 +1093,13 @@ Const TVM_SETINSERTMARKCOLOR=TV_FIRST+37
 Extern
 	Function bmx_win32_TOOLINFOW_new:Byte Ptr()
 	Function bmx_win32_TOOLINFOW_free(handle:Byte Ptr)
+	Function bmx_win32_TOOLINFOW_SetuFlags(handle:Byte Ptr, uFlags:UInt)
+	Function bmx_win32_TOOLINFOW_Sethwnd(handle:Byte Ptr, hwnd:Byte Ptr)
+	Function bmx_win32_TOOLINFOW_SetuId(handle:Byte Ptr, uId:Byte Ptr)
+	Function bmx_win32_TOOLINFOW_Sethinst(handle:Byte Ptr, hinst:Byte Ptr)
+	Function bmx_win32_TOOLINFOW_SetlpszText(handle:Byte Ptr, lpszText:Short Ptr)
+	Function bmx_win32_TOOLINFOW_rect:Int Ptr(handle:Byte Ptr)
+	Function bmx_win32_TOOLINFOW_lpszText:Short Ptr(handle:Byte Ptr)
 End Extern
 
 Type TOOLINFOW
@@ -879,19 +1121,32 @@ Type TOOLINFOW
 		End If
 	End Method
 	
-	Method SetuFlags(uFlags:Int)
+	Method SetuFlags(uFlags:UInt)
+		bmx_win32_TOOLINFOW_SetuFlags(infoPtr, uFlags)
 	End Method
 	
 	Method Sethwnd(hwnd:Byte Ptr)
+		bmx_win32_TOOLINFOW_Sethwnd(infoPtr, hwnd)
 	End Method
 	
 	Method SetuId(uId:Byte Ptr)
+		bmx_win32_TOOLINFOW_SetuId(infoPtr, uId)
 	End Method
 	
 	Method Sethinst(hinst:Byte Ptr)
+		bmx_win32_TOOLINFOW_Sethinst(infoPtr, hinst)
 	End Method
 	
 	Method SetlpszText(lpszText:Short Ptr)
+		bmx_win32_TOOLINFOW_SetlpszText(infoPtr, lpszText)
+	End Method
+	
+	Method rect:Int Ptr()
+		Return bmx_win32_TOOLINFOW_rect(infoPtr)
+	End Method
+	
+	Method lpszText:Short Ptr()
+		Return bmx_win32_TOOLINFOW_lpszText(infoPtr)
 	End Method
 	
 '	Field cbSize
@@ -1072,15 +1327,56 @@ Const TBSTYLE_TRANSPARENT=$8000
 
 Const TBSTYLE_EX_DRAWDDARROWS=$00000001
 
+Extern
+	Function bmx_win32_TBBUTTON_new:Byte Ptr()
+	Function bmx_win32_TBBUTTON_free(handle:Byte Ptr)
+	Function bmx_win32_TBBUTTON_SetiBitmap(handle:Byte Ptr, iBitmap:Int)
+	Function bmx_win32_TBBUTTON_SetidCommand(handle:Byte Ptr, idCommand:Int)
+	Function bmx_win32_TBBUTTON_SetfsState(handle:Byte Ptr, fsState:Int)
+	Function bmx_win32_TBBUTTON_SetfsStyle(handle:Byte Ptr, fsStyle:Int)
+End Extern
 Type TBBUTTON
-	Field iBitmap
-	Field idCommand;
-	Field fsState:Byte
-	Field fsStyle:Byte
-	Field pad0:Byte
-	Field pad1:Byte
-	Field dwData:Byte Ptr
-	Field iString:Byte Ptr
+	Field buttonPtr:Byte Ptr
+
+	Method New()
+		buttonPtr = bmx_win32_TBBUTTON_new()
+	End Method
+	
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If buttonPtr Then
+			bmx_win32_TBBUTTON_free(buttonPtr)
+			buttonPtr = Null
+		End If
+	End Method
+	
+	Method SetiBitmap(iBitmap:Int)
+		bmx_win32_TBBUTTON_SetiBitmap(buttonPtr, iBitmap)
+	End Method
+	
+	Method SetidCommand(idCommand:Int)
+		bmx_win32_TBBUTTON_SetidCommand(buttonPtr, idCommand)
+	End Method
+	
+	Method SetfsState(fsState:Int)
+		bmx_win32_TBBUTTON_SetfsState(buttonPtr, fsState)
+	End Method
+	
+	Method SetfsStyle(fsStyle:Int)
+		bmx_win32_TBBUTTON_SetfsStyle(buttonPtr, fsStyle)
+	End Method
+	
+'	Field iBitmap
+'	Field idCommand;
+'	Field fsState:Byte
+'	Field fsStyle:Byte
+'	Field pad0:Byte
+'	Field pad1:Byte
+'	Field dwData:Byte Ptr
+'	Field iString:Byte Ptr
 End Type
 
 
@@ -1814,4 +2110,132 @@ Extern
 	
 	Function bmx_win32_NMITEMACTIVATE_iItem:Int(handle:Byte Ptr)
 	
+	Function bmx_win32_NMTREEVIEW_itemNew:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_NMTREEVIEW_action:UInt(handle:Byte Ptr)
+	Function bmx_win32_NMTREEVIEW_x:Int(handle:Byte Ptr)
+	Function bmx_win32_NMTREEVIEW_y:Int(handle:Byte Ptr)
+	
+	Function bmx_win32_MSGFILTER_msg:UInt(handle:Byte Ptr)
+	Function bmx_win32_MSGFILTER_wParam:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_MSGFILTER_lParam:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_MSGFILTER_Setmsg(handle:Byte Ptr, msg:UInt)
+	
+End Extern
+
+Extern
+	Function bmx_win32_TCHITTESTINFO_new:Byte Ptr()
+	Function bmx_win32_TCHITTESTINFO_free(handle:Byte Ptr)
+	Function bmx_win32_TCHITTESTINFO_pt:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_TCHITTESTINFO_flags:UInt(handle:Byte Ptr)
+	Function bmx_win32_TCHITTESTINFO_Setx(handle:Byte Ptr, x:Int)
+	Function bmx_win32_TCHITTESTINFO_Sety(handle:Byte Ptr, y:Int)
+	Function bmx_win32_TCHITTESTINFO_x:Int(handle:Byte Ptr)
+	Function bmx_win32_TCHITTESTINFO_y:Int(handle:Byte Ptr)
+	Function bmx_win32_TCHITTESTINFO_Setflags(handle:Byte Ptr, flags:UInt)
 End Extern
+Type TCHITTESTINFO
+	Field infoPtr:Byte Ptr
+	
+	Method New()
+		infoPtr = bmx_win32_TCHITTESTINFO_new()
+	End Method
+	
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If infoPtr Then
+			bmx_win32_TCHITTESTINFO_free(infoPtr)
+			infoPtr = Null
+		End If
+	End Method
+
+	Method Setx(x:Int)
+		bmx_win32_TCHITTESTINFO_Setx(infoPtr, x)
+	End Method
+	
+	Method Sety(y:Int)
+		bmx_win32_TCHITTESTINFO_Sety(infoPtr, y)
+	End Method
+	
+	Method Setflags(flags:UInt)
+		bmx_win32_TCHITTESTINFO_Setflags(infoPtr, flags)
+	End Method
+
+	Method pt:Byte Ptr()
+		Return bmx_win32_TCHITTESTINFO_pt(infoPtr)
+	End Method
+	
+	Method x:Int()
+		Return bmx_win32_TCHITTESTINFO_x(infoPtr)
+	End Method
+	
+	Method y:Int()
+		Return bmx_win32_TCHITTESTINFO_y(infoPtr)
+	End Method
+	
+	Method flags:UInt()
+		Return bmx_win32_TCHITTESTINFO_flags(infoPtr)
+	End Method
+	
+End Type
+
+Extern
+	Function bmx_win32_TVHITTESTINFO_new:Byte Ptr()
+	Function bmx_win32_TVHITTESTINFO_free(handle:Byte Ptr)
+	Function bmx_win32_TVHITTESTINFO_Setx(handle:Byte Ptr, x:Int)
+	Function bmx_win32_TVHITTESTINFO_Sety(handle:Byte Ptr, y:Int)
+	Function bmx_win32_TVHITTESTINFO_x:Int(handle:Byte Ptr)
+	Function bmx_win32_TVHITTESTINFO_y:Int(handle:Byte Ptr)
+	Function bmx_win32_TVHITTESTINFO_Setflags(handle:Byte Ptr, flags:UInt)
+	Function bmx_win32_TVHITTESTINFO_flags:UInt(handle:Byte Ptr)
+	Function bmx_win32_TVHITTESTINFO_hItem:Byte Ptr(handle:Byte Ptr)
+End Extern
+Type TVHITTESTINFO
+	Field infoPtr:Byte Ptr
+	
+	Method New()
+		infoPtr = bmx_win32_TVHITTESTINFO_new()
+	End Method
+	
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If infoPtr Then
+			bmx_win32_TVHITTESTINFO_free(infoPtr)
+			infoPtr = Null
+		End If
+	End Method
+
+	Method Setx(x:Int)
+		bmx_win32_TVHITTESTINFO_Setx(infoPtr, x)
+	End Method
+	
+	Method Sety(y:Int)
+		bmx_win32_TVHITTESTINFO_Sety(infoPtr, y)
+	End Method
+	
+	Method Setflags(flags:UInt)
+		bmx_win32_TVHITTESTINFO_Setflags(infoPtr, flags)
+	End Method
+
+	Method x:Int()
+		Return bmx_win32_TVHITTESTINFO_x(infoPtr)
+	End Method
+	
+	Method y:Int()
+		Return bmx_win32_TVHITTESTINFO_y(infoPtr)
+	End Method
+	
+	Method flags:UInt()
+		Return bmx_win32_TVHITTESTINFO_flags(infoPtr)
+	End Method
+
+	Method hItem:Byte Ptr()
+		Return bmx_win32_TVHITTESTINFO_hItem(infoPtr)
+	End Method
+
+End Type

+ 432 - 10
win32.mod/commctrl.cpp

@@ -3,13 +3,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <commctrl.h>
+#include <richedit.h>
 
 extern "C" {
 
 	TOOLINFOW * bmx_win32_TOOLINFOW_new();
-	void bmx_win32_TOOLINFOW_free(TOOLINFOW * clas);
-	void bmx_win32_TOOLINFOW_free(TOOLINFOW * clas);
-
+	void bmx_win32_TOOLINFOW_free(TOOLINFOW * info);
+	void bmx_win32_TOOLINFOW_SetuFlags(TOOLINFOW * info, UINT uFlags);
+	void bmx_win32_TOOLINFOW_Sethwnd(TOOLINFOW * info, HWND hwnd);
+	void bmx_win32_TOOLINFOW_SetuId(TOOLINFOW * info, UINT_PTR uId);
+	void bmx_win32_TOOLINFOW_Sethinst(TOOLINFOW * info, HINSTANCE hinst);
+	void bmx_win32_TOOLINFOW_SetlpszText(TOOLINFOW * info, LPWSTR lpszText);
+	RECT* bmx_win32_TOOLINFOW_rect(TOOLINFOW * info);
+	LPWSTR bmx_win32_TOOLINFOW_lpszText(TOOLINFOW * info);
 
 	INITCOMMONCONTROLSEX * bmx_win32_TINITCOMMONCONTROLSEX_new();
 	void bmx_win32_TINITCOMMONCONTROLSEX_free(INITCOMMONCONTROLSEX * icc);
@@ -59,19 +65,127 @@ extern "C" {
 	
 	int bmx_win32_NMITEMACTIVATE_iItem(NMITEMACTIVATE * act);
 
+	TVITEMW * bmx_win32_NMTREEVIEW_itemNew(NMTREEVIEWW * view);
+	UINT bmx_win32_NMTREEVIEW_action(NMTREEVIEWW * view);
+	int bmx_win32_NMTREEVIEW_x(NMTREEVIEWW * view);
+	int bmx_win32_NMTREEVIEW_y(NMTREEVIEWW * view);
+
+	TBBUTTON * bmx_win32_TBBUTTON_new();
+	void bmx_win32_TBBUTTON_free(TBBUTTON * button);
+	void bmx_win32_TBBUTTON_SetiBitmap(TBBUTTON * button, int iBitmap);
+	void bmx_win32_TBBUTTON_SetidCommand(TBBUTTON * button, int idCommand);
+	void bmx_win32_TBBUTTON_SetfsState(TBBUTTON * button, int fsState);
+	void bmx_win32_TBBUTTON_SetfsStyle(TBBUTTON * button, int fsStyle);
+
+	TCHITTESTINFO * bmx_win32_TCHITTESTINFO_new();
+	void bmx_win32_TCHITTESTINFO_free(TCHITTESTINFO * info);
+	POINT * bmx_win32_TCHITTESTINFO_pt(TCHITTESTINFO * info);
+	UINT bmx_win32_TCHITTESTINFO_flags(TCHITTESTINFO * info);
+	void bmx_win32_TCHITTESTINFO_Setx(TCHITTESTINFO * info, int x);
+	void bmx_win32_TCHITTESTINFO_Sety(TCHITTESTINFO * info, int y);
+	int bmx_win32_TCHITTESTINFO_x(TCHITTESTINFO * info);
+	int bmx_win32_TCHITTESTINFO_y(TCHITTESTINFO * info);
+	void bmx_win32_TCHITTESTINFO_Setflags(TCHITTESTINFO * info, UINT flags);
+
+	TCITEMW * bmx_win32_TCITEMW_new();
+	void bmx_win32_TCITEMW_free(TCITEMW * item);
+	void bmx_win32_TCITEMW_Setmask(TCITEMW * item, UINT mask);
+	void bmx_win32_TCITEMW_SetpszText(TCITEMW * item, LPWSTR pszText);
+	void bmx_win32_TCITEMW_SetiImage(TCITEMW * item, int iImage);
+	LPWSTR bmx_win32_TCITEMW_pszText(TCITEMW * item);
+
+	TVITEMW * bmx_win32_TVITEMW_new();
+	void bmx_win32_TVITEMW_free(TVITEMW * item);
+	void bmx_win32_TVITEMW_Setmask(TVITEMW * item, UINT mask);
+	void bmx_win32_TVITEMW_SethItem(TVITEMW * item, HTREEITEM hItem);
+	void bmx_win32_TVITEMW_Setstate(TVITEMW * item, UINT state);
+	void bmx_win32_TVITEMW_SetstateMask(TVITEMW * item, UINT stateMask);
+	void bmx_win32_TVITEMW_SetpszText(TVITEMW * item, LPWSTR pszText);
+	void bmx_win32_TVITEMW_SetcchTextMax(TVITEMW * item, int cchTextMax);
+	void bmx_win32_TVITEMW_SetiImage(TVITEMW * item, int iImage);
+	void bmx_win32_TVITEMW_SetiSelectedImage(TVITEMW * item, int iSelectedImage);
+	void bmx_win32_TVITEMW_SetcChildren(TVITEMW * item, int cChildren);
+	void bmx_win32_TVITEMW_SetlParam(TVITEMW * item, LPARAM lParam);
+	UINT bmx_win32_TVITEMW_mask(TVITEMW * item);
+	LPWSTR bmx_win32_TVITEMW_pszText(TVITEMW * item);
+	int bmx_win32_TVITEMW_iImage(TVITEMW * item);
+	HTREEITEM bmx_win32_TVITEMW_hItem(TVITEMW * item);
+	LPARAM bmx_win32_TVITEMW_lParam(TVITEMW * item);
+
+	TVINSERTSTRUCTW * bmx_win32_TVINSERTSTRUCTW_new();
+	void bmx_win32_TVINSERTSTRUCTW_free(TVINSERTSTRUCTW * tv);
+	void bmx_win32_TVINSERTSTRUCTW_SethParent(TVINSERTSTRUCTW * tv, HTREEITEM hParent);
+	void bmx_win32_TVINSERTSTRUCTW_SethInsertAfter(TVINSERTSTRUCTW * tv, HTREEITEM hInsertAfter);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_mask(TVINSERTSTRUCTW * tv, UINT item_mask);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_hItem(TVINSERTSTRUCTW * tv, HTREEITEM item_hItem);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_state(TVINSERTSTRUCTW * tv, UINT item_state);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_stateMask(TVINSERTSTRUCTW * tv, UINT item_stateMask);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_pszText(TVINSERTSTRUCTW * tv, LPWSTR item_pszText);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_cchTextMax(TVINSERTSTRUCTW * tv, int item_cchTextMax);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_iImage(TVINSERTSTRUCTW * tv, int item_iImage);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_iSelectedImage(TVINSERTSTRUCTW * tv, int item_iSelectedImage);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_cChildren(TVINSERTSTRUCTW * tv, int item_cChildren);
+	void bmx_win32_TVINSERTSTRUCTW_Setitem_lParam(TVINSERTSTRUCTW * tv, LPARAM item_lParam);
+	UINT bmx_win32_TVINSERTSTRUCTW_item_mask(TVINSERTSTRUCTW * tv);
+	int bmx_win32_TVINSERTSTRUCTW_item_iImage(TVINSERTSTRUCTW * tv);
+	LPARAM bmx_win32_TVINSERTSTRUCTW_item_lparam(TVINSERTSTRUCTW * tv);
+	LPWSTR bmx_win32_TVINSERTSTRUCTW_item_pszText(TVINSERTSTRUCTW * tv);
+
+	TVHITTESTINFO * bmx_win32_TVHITTESTINFO_new();
+	void bmx_win32_TVHITTESTINFO_free(TVHITTESTINFO * info);
+	UINT bmx_win32_TVHITTESTINFO_flags(TVHITTESTINFO * info);
+	void bmx_win32_TVHITTESTINFO_Setx(TVHITTESTINFO * info, int x);
+	void bmx_win32_TVHITTESTINFO_Sety(TVHITTESTINFO * info, int y);
+	int bmx_win32_TVHITTESTINFO_x(TVHITTESTINFO * info);
+	int bmx_win32_TVHITTESTINFO_y(TVHITTESTINFO * info);
+	void bmx_win32_TVHITTESTINFO_Setflags(TVHITTESTINFO * info, UINT flags);
+	HTREEITEM bmx_win32_TVHITTESTINFO_hItem(TVHITTESTINFO * info);
+	
+	UINT bmx_win32_MSGFILTER_msg(MSGFILTER * filter);
+	WPARAM bmx_win32_MSGFILTER_wParam(MSGFILTER * filter);
+	LPARAM bmx_win32_MSGFILTER_lParam(MSGFILTER * filter);
+	void bmx_win32_MSGFILTER_Setmsg(MSGFILTER * filter, UINT msg);
+
 }
 
 // ********************************************************
 
 TOOLINFOW * bmx_win32_TOOLINFOW_new() {
-	TOOLINFOW * clas = (TOOLINFOW *)malloc(sizeof(TOOLINFOW));
-	memset(clas, 0, sizeof(TOOLINFOW));
-	clas->cbSize = sizeof(TOOLINFOW);
-	return clas;
+	TOOLINFOW * info = (TOOLINFOW *)calloc(1, sizeof(TOOLINFOW));
+	info->cbSize = sizeof(TOOLINFOW);
+	return info;
+}
+
+void bmx_win32_TOOLINFOW_free(TOOLINFOW * info) {
+	free(info);
+}
+
+void bmx_win32_TOOLINFOW_SetuFlags(TOOLINFOW * info, UINT uFlags) {
+	info->uFlags = uFlags;
 }
 
-void bmx_win32_TOOLINFOW_free(TOOLINFOW * clas) {
-	free(clas);
+void bmx_win32_TOOLINFOW_Sethwnd(TOOLINFOW * info, HWND hwnd) {
+	info->hwnd = hwnd;
+}
+
+void bmx_win32_TOOLINFOW_SetuId(TOOLINFOW * info, UINT_PTR uId) {
+	info->uId = uId;
+}
+
+void bmx_win32_TOOLINFOW_Sethinst(TOOLINFOW * info, HINSTANCE hinst) {
+	info->hinst = hinst;
+}
+
+void bmx_win32_TOOLINFOW_SetlpszText(TOOLINFOW * info, LPWSTR lpszText) {
+	info->lpszText = lpszText;
+}
+
+RECT* bmx_win32_TOOLINFOW_rect(TOOLINFOW * info) {
+	return &info->rect;
+}
+
+LPWSTR bmx_win32_TOOLINFOW_lpszText(TOOLINFOW * info) {
+	return info->lpszText;
 }
 
 // ********************************************************
@@ -154,7 +268,7 @@ LPWSTR bmx_win32_COMBOBOXEXITEMW_pszText(COMBOBOXEXITEMW * item) {
 // ********************************************************
 
 LVCOLUMNW * bmx_win32_LVCOLUMNW_new() {
-	return (LVCOLUMNW *)malloc(sizeof(LVCOLUMNW));
+	return (LVCOLUMNW *)calloc(1,sizeof(LVCOLUMNW));
 }
 
 void bmx_win32_LVCOLUMNW_free(LVCOLUMNW * col) {
@@ -249,3 +363,311 @@ int bmx_win32_NMITEMACTIVATE_iItem(NMITEMACTIVATE * act) {
 	return act->iItem;
 }
 
+// ********************************************************
+
+TVITEMW * bmx_win32_NMTREEVIEW_itemNew(NMTREEVIEWW * view) {
+	return &view->itemNew;
+}
+
+UINT bmx_win32_NMTREEVIEW_action(NMTREEVIEWW * view) {
+	return view->action;
+}
+
+int bmx_win32_NMTREEVIEW_x(NMTREEVIEWW * view) {
+	return view->ptDrag.x;
+}
+
+int bmx_win32_NMTREEVIEW_y(NMTREEVIEWW * view) {
+	return view->ptDrag.y;
+}
+
+// ********************************************************
+
+TBBUTTON * bmx_win32_TBBUTTON_new() {
+	return (TBBUTTON *)calloc(1,sizeof(TBBUTTON));
+}
+
+void bmx_win32_TBBUTTON_free(TBBUTTON * button) {
+	free(button);
+}
+
+void bmx_win32_TBBUTTON_SetiBitmap(TBBUTTON * button, int iBitmap) {
+	button->iBitmap = iBitmap;
+}
+
+void bmx_win32_TBBUTTON_SetidCommand(TBBUTTON * button, int idCommand) {
+	button->idCommand = idCommand;
+}
+
+void bmx_win32_TBBUTTON_SetfsState(TBBUTTON * button, int fsState) {
+	button->fsState = fsState;
+}
+
+void bmx_win32_TBBUTTON_SetfsStyle(TBBUTTON * button, int fsStyle) {
+	button->fsStyle = fsStyle;
+}
+
+// ********************************************************
+
+TCHITTESTINFO * bmx_win32_TCHITTESTINFO_new() {
+	return (TCHITTESTINFO *)calloc(1, sizeof(TCHITTESTINFO));
+}
+
+void bmx_win32_TCHITTESTINFO_free(TCHITTESTINFO * info) {
+	free(info);
+}
+
+POINT * bmx_win32_TCHITTESTINFO_pt(TCHITTESTINFO * info) {
+	return &info->pt;
+}
+
+UINT bmx_win32_TCHITTESTINFO_flags(TCHITTESTINFO * info) {
+	return info->flags;
+}
+
+void bmx_win32_TCHITTESTINFO_Setx(TCHITTESTINFO * info, int x) {
+	info->pt.x = x;
+}
+
+void bmx_win32_TCHITTESTINFO_Sety(TCHITTESTINFO * info, int y) {
+	info->pt.y = y;
+}
+
+int bmx_win32_TCHITTESTINFO_x(TCHITTESTINFO * info) {
+	return info->pt.x;
+}
+
+int bmx_win32_TCHITTESTINFO_y(TCHITTESTINFO * info) {
+	return info->pt.y;
+}
+
+void bmx_win32_TCHITTESTINFO_Setflags(TCHITTESTINFO * info, UINT flags) {
+	info->flags = flags;
+}
+
+// ********************************************************
+
+TCITEMW * bmx_win32_TCITEMW_new() {
+	return (TCITEMW *)calloc(1, sizeof(TCITEMW));
+}
+
+void bmx_win32_TCITEMW_free(TCITEMW * item) {
+	free(item);
+}
+
+void bmx_win32_TCITEMW_Setmask(TCITEMW * item, UINT mask) {
+	item->mask = mask;
+}
+
+void bmx_win32_TCITEMW_SetpszText(TCITEMW * item, LPWSTR pszText) {
+	item->pszText = pszText;
+}
+
+void bmx_win32_TCITEMW_SetiImage(TCITEMW * item, int iImage) {
+	item->iImage = iImage;
+}
+
+LPWSTR bmx_win32_TCITEMW_pszText(TCITEMW * item) {
+	return item->pszText;
+}
+
+// ********************************************************
+
+TVITEMW * bmx_win32_TVITEMW_new() {
+	return (TVITEMW *)calloc(1, sizeof(TVITEMW));
+}
+
+void bmx_win32_TVITEMW_free(TVITEMW * item) {
+	free(item);
+}
+
+void bmx_win32_TVITEMW_Setmask(TVITEMW * item, UINT mask) {
+	item->mask = mask;
+}
+
+void bmx_win32_TVITEMW_SethItem(TVITEMW * item, HTREEITEM hItem) {
+	item->hItem = hItem;
+}
+
+void bmx_win32_TVITEMW_Setstate(TVITEMW * item, UINT state) {
+	item->state = state;
+}
+
+void bmx_win32_TVITEMW_SetstateMask(TVITEMW * item, UINT stateMask) {
+	item->stateMask = stateMask;
+}
+
+void bmx_win32_TVITEMW_SetpszText(TVITEMW * item, LPWSTR pszText) {
+	item->pszText = pszText;
+}
+
+void bmx_win32_TVITEMW_SetcchTextMax(TVITEMW * item, int cchTextMax) {
+	item->cchTextMax = cchTextMax;
+}
+
+void bmx_win32_TVITEMW_SetiImage(TVITEMW * item, int iImage) {
+	item->iImage = iImage;
+}
+
+void bmx_win32_TVITEMW_SetiSelectedImage(TVITEMW * item, int iSelectedImage) {
+	item->iSelectedImage = iSelectedImage;
+}
+
+void bmx_win32_TVITEMW_SetcChildren(TVITEMW * item, int cChildren) {
+	item->cChildren = cChildren;
+}
+
+void bmx_win32_TVITEMW_SetlParam(TVITEMW * item, LPARAM lParam) {
+	item->lParam = lParam;
+}
+
+UINT bmx_win32_TVITEMW_mask(TVITEMW * item) {
+	return item->mask;
+}
+
+LPWSTR bmx_win32_TVITEMW_pszText(TVITEMW * item) {
+	return item->pszText;
+}
+
+int bmx_win32_TVITEMW_iImage(TVITEMW * item) {
+	return item->iImage;
+}
+
+HTREEITEM bmx_win32_TVITEMW_hItem(TVITEMW * item) {
+	return item->hItem;
+}
+
+LPARAM bmx_win32_TVITEMW_lParam(TVITEMW * item) {
+	return item->lParam;
+}
+
+// ********************************************************
+
+TVINSERTSTRUCTW * bmx_win32_TVINSERTSTRUCTW_new() {
+	return (TVINSERTSTRUCTW *)calloc(1, sizeof(TVINSERTSTRUCTW));
+}
+
+void bmx_win32_TVINSERTSTRUCTW_free(TVINSERTSTRUCTW * tv) {
+	free(tv);
+}
+
+void bmx_win32_TVINSERTSTRUCTW_SethParent(TVINSERTSTRUCTW * tv, HTREEITEM hParent) {
+	tv->hParent = hParent;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_SethInsertAfter(TVINSERTSTRUCTW * tv, HTREEITEM hInsertAfter) {
+	tv->hInsertAfter = hInsertAfter;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_mask(TVINSERTSTRUCTW * tv, UINT item_mask) {
+	tv->item.mask = item_mask;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_hItem(TVINSERTSTRUCTW * tv, HTREEITEM item_hItem) {
+	tv->item.hItem = item_hItem;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_state(TVINSERTSTRUCTW * tv, UINT item_state) {
+	tv->item.state = item_state;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_stateMask(TVINSERTSTRUCTW * tv, UINT item_stateMask) {
+	tv->item.stateMask = item_stateMask;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_pszText(TVINSERTSTRUCTW * tv, LPWSTR item_pszText) {
+	tv->item.pszText = item_pszText;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_cchTextMax(TVINSERTSTRUCTW * tv, int item_cchTextMax) {
+	tv->item.cchTextMax = item_cchTextMax;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_iImage(TVINSERTSTRUCTW * tv, int item_iImage) {
+	tv->item.iImage = item_iImage;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_iSelectedImage(TVINSERTSTRUCTW * tv, int item_iSelectedImage) {
+	tv->item.iSelectedImage = item_iSelectedImage;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_cChildren(TVINSERTSTRUCTW * tv, int item_cChildren) {
+	tv->item.cChildren = item_cChildren;
+}
+
+void bmx_win32_TVINSERTSTRUCTW_Setitem_lParam(TVINSERTSTRUCTW * tv, LPARAM item_lParam) {
+	tv->item.lParam = item_lParam;
+}
+
+UINT bmx_win32_TVINSERTSTRUCTW_item_mask(TVINSERTSTRUCTW * tv) {
+	return tv->item.mask;
+}
+
+int bmx_win32_TVINSERTSTRUCTW_item_iImage(TVINSERTSTRUCTW * tv) {
+	return tv->item.iImage;
+}
+
+LPARAM bmx_win32_TVINSERTSTRUCTW_item_lparam(TVINSERTSTRUCTW * tv) {
+	return tv->item.lParam;
+}
+
+LPWSTR bmx_win32_TVINSERTSTRUCTW_item_pszText(TVINSERTSTRUCTW * tv) {
+	return tv->item.pszText;
+}
+
+// ********************************************************
+
+TVHITTESTINFO * bmx_win32_TVHITTESTINFO_new() {
+	return (TVHITTESTINFO *)calloc(1, sizeof(TVHITTESTINFO));
+}
+
+void bmx_win32_TVHITTESTINFO_free(TVHITTESTINFO * info) {
+	free(info);
+}
+
+UINT bmx_win32_TVHITTESTINFO_flags(TVHITTESTINFO * info) {
+	return info->flags;
+}
+
+void bmx_win32_TVHITTESTINFO_Setx(TVHITTESTINFO * info, int x) {
+	info->pt.x = x;
+}
+
+void bmx_win32_TVHITTESTINFO_Sety(TVHITTESTINFO * info, int y) {
+	info->pt.y = y;
+}
+
+int bmx_win32_TVHITTESTINFO_x(TVHITTESTINFO * info) {
+	return info->pt.x;
+}
+
+int bmx_win32_TVHITTESTINFO_y(TVHITTESTINFO * info) {
+	return info->pt.y;
+}
+
+void bmx_win32_TVHITTESTINFO_Setflags(TVHITTESTINFO * info, UINT flags) {
+	info->flags = flags;
+}
+
+HTREEITEM bmx_win32_TVHITTESTINFO_hItem(TVHITTESTINFO * info) {
+	return info->hItem;
+}
+
+// ********************************************************
+
+UINT bmx_win32_MSGFILTER_msg(MSGFILTER * filter) {
+	return filter->msg;
+}
+
+WPARAM bmx_win32_MSGFILTER_wParam(MSGFILTER * filter) {
+	return filter->wParam;
+}
+
+LPARAM bmx_win32_MSGFILTER_lParam(MSGFILTER * filter) {
+	return filter->lParam;
+}
+
+void bmx_win32_MSGFILTER_Setmsg(MSGFILTER * filter, UINT msg) {
+	filter->msg = msg;
+}
+

+ 88 - 19
win32.mod/commdlg.bmx

@@ -1,4 +1,6 @@
+Strict
 
+Import "commdlg.cpp"
 
 Const CC_RGBINIT=1
 Const CC_FULLOPEN=2
@@ -52,29 +54,96 @@ Const CF_BOTH=CF_SCREENFONTS|CF_PRINTERFONTS
 Const CF_SCRIPTSONLY=CF_ANSIONLY
 Const CF_NOOEMFONTS=CF_NOVECTORFONTS
 
-Type CHOOSEFONT
-	Field lStructSize
-	Field hwndOwner
-	Field hDC
-	Field lpLogFont:Byte Ptr
-	Field iPointSize
-	Field Flags
-	Field rgbColors
-	Field lCustData
-	Field lpfnHook:Byte Ptr
-	Field lpTemplateName:Short Ptr
-	Field hInstance
-	Field lpszStyle:Short Ptr
-	Field nFontType:Short
-	Field _align_:Short
-	Field nSizeMin
-	Field nSizeMax
+Extern
+	Function bmx_win32_CHOOSEFONTW_new:Byte Ptr()
+	Function bmx_win32_CHOOSEFONTW_free(handle:Byte Ptr)
+	Function bmx_win32_CHOOSEFONTW_SethwndOwner(handle:Byte Ptr, hwndOwner:Byte Ptr)
+	Function bmx_win32_CHOOSEFONTW_SethDC(handle:Byte Ptr, hDC:Byte Ptr)
+	Function bmx_win32_CHOOSEFONTW_SetlpLogFont(handle:Byte Ptr, lpLogFont:Byte Ptr)
+	Function bmx_win32_CHOOSEFONTW_SetiPointSize(handle:Byte Ptr, iPointSize:Int)
+	Function bmx_win32_CHOOSEFONTW_SetFlags(handle:Byte Ptr, Flags:Int)
+	Function bmx_win32_CHOOSEFONTW_SetrgbColors(handle:Byte Ptr, rgbColors:Int)
+	Function bmx_win32_CHOOSEFONTW_iPointSize:Int(handle:Byte Ptr)
+	Function bmx_win32_CHOOSEFONTW_Flags:Int(handle:Byte Ptr)
+	Function bmx_win32_CHOOSEFONTW_nFontType:Int(handle:Byte Ptr)
+End Extern
+Type CHOOSEFONTW
+	Field fontPtr:Byte Ptr
+	
+	Method New()
+		fontPtr = bmx_win32_CHOOSEFONTW_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If fontPtr Then
+			bmx_win32_CHOOSEFONTW_free(fontPtr)
+			fontPtr = Null
+		End If
+	End Method
+	
+	Method SethwndOwner(hwndOwner:Byte Ptr)
+		bmx_win32_CHOOSEFONTW_SethwndOwner(fontPtr, hwndOwner)
+	End Method
+	
+	Method SethDC(hDC:Byte Ptr)
+		bmx_win32_CHOOSEFONTW_SethDC(fontPtr, hDC)
+	End Method
+	
+	Method SetlpLogFont(lpLogFont:Byte Ptr)
+		bmx_win32_CHOOSEFONTW_SetlpLogFont(fontPtr, lpLogFont)
+	End Method
+	
+	Method SetiPointSize(iPointSize:Int)
+		bmx_win32_CHOOSEFONTW_SetiPointSize(fontPtr, iPointSize)
+	End Method
+	
+	Method SetFlags(Flags:Int)
+		bmx_win32_CHOOSEFONTW_SetFlags(fontPtr, Flags)
+	End Method
+	
+	Method SetrgbColors(rgbColors:Int)
+		bmx_win32_CHOOSEFONTW_SetrgbColors(fontPtr, rgbColors)
+	End Method
+	
+	
+	Method iPointSize:Int()
+		Return bmx_win32_CHOOSEFONTW_iPointSize(fontPtr)
+	End Method
+	
+	Method Flags:Int()
+		Return bmx_win32_CHOOSEFONTW_Flags(fontPtr)
+	End Method
+	
+	Method nFontType:Int()
+		Return bmx_win32_CHOOSEFONTW_nFontType(fontPtr)
+	End Method
+
+'	Field lStructSize
+'	Field hwndOwner
+'	Field hDC
+'	Field lpLogFont:Byte Ptr
+'	Field iPointSize
+'	Field Flags
+'	Field rgbColors
+'	Field lCustData
+'	Field lpfnHook:Byte Ptr
+'	Field lpTemplateName:Short Ptr
+'	Field hInstance
+'	Field lpszStyle:Short Ptr
+'	Field nFontType:Short
+'	Field _align_:Short
+'	Field nSizeMin
+'	Field nSizeMax
 End Type
 
 Extern "Win32"
 
-Function ChooseColorW( lpcc:Byte Ptr )
-Function ChooseFontW( lpcc:Byte Ptr )
+Function ChooseColorW_( lpcc:Byte Ptr )="ChooseColorW"
+Function ChooseFontW_( lpcc:Byte Ptr )="ChooseFontW"
 
 
 End Extern

+ 64 - 0
win32.mod/commdlg.cpp

@@ -0,0 +1,64 @@
+#include "windows.h"
+
+extern "C" {
+
+	CHOOSEFONTW * bmx_win32_CHOOSEFONTW_new();
+	void bmx_win32_CHOOSEFONTW_free(CHOOSEFONTW * cf);
+	void bmx_win32_CHOOSEFONTW_SethwndOwner(CHOOSEFONTW * cf, HWND hwndOwner);
+	void bmx_win32_CHOOSEFONTW_SethDC(CHOOSEFONTW * cf, HDC hDC);
+	void bmx_win32_CHOOSEFONTW_SetlpLogFont(CHOOSEFONTW * cf, LOGFONTW * lpLogFont);
+	void bmx_win32_CHOOSEFONTW_SetiPointSize(CHOOSEFONTW * cf, int iPointSize);
+	void bmx_win32_CHOOSEFONTW_SetFlags(CHOOSEFONTW * cf, int Flags);
+	void bmx_win32_CHOOSEFONTW_SetrgbColors(CHOOSEFONTW * cf, int rgbColors);
+	int bmx_win32_CHOOSEFONTW_iPointSize(CHOOSEFONTW * cf);
+	int bmx_win32_CHOOSEFONTW_Flags(CHOOSEFONTW * cf);
+	int bmx_win32_CHOOSEFONTW_nFontType(CHOOSEFONTW * cf);
+
+}
+
+CHOOSEFONTW * bmx_win32_CHOOSEFONTW_new() {
+	CHOOSEFONTW * cf = (CHOOSEFONTW *)calloc(1, sizeof(CHOOSEFONTW));
+	cf->lStructSize = sizeof(CHOOSEFONTW);
+	return cf;
+}
+
+void bmx_win32_CHOOSEFONTW_free(CHOOSEFONTW * cf) {
+	free(cf);
+}
+
+void bmx_win32_CHOOSEFONTW_SethwndOwner(CHOOSEFONTW * cf, HWND hwndOwner) {
+	cf->hwndOwner = hwndOwner;
+}
+
+void bmx_win32_CHOOSEFONTW_SethDC(CHOOSEFONTW * cf, HDC hDC) {
+	cf->hDC = hDC;
+}
+
+void bmx_win32_CHOOSEFONTW_SetlpLogFont(CHOOSEFONTW * cf, LOGFONTW * lpLogFont) {
+	cf->lpLogFont = lpLogFont;
+}
+
+void bmx_win32_CHOOSEFONTW_SetiPointSize(CHOOSEFONTW * cf, int iPointSize) {
+	cf->iPointSize = iPointSize;
+}
+
+void bmx_win32_CHOOSEFONTW_SetFlags(CHOOSEFONTW * cf, int Flags) {
+	cf->Flags = Flags;
+}
+
+void bmx_win32_CHOOSEFONTW_SetrgbColors(CHOOSEFONTW * cf, int rgbColors) {
+	cf->rgbColors = rgbColors;
+}
+
+int bmx_win32_CHOOSEFONTW_iPointSize(CHOOSEFONTW * cf) {
+	return cf->iPointSize;
+}
+
+int bmx_win32_CHOOSEFONTW_Flags(CHOOSEFONTW * cf) {
+	return cf->Flags;
+}
+
+int bmx_win32_CHOOSEFONTW_nFontType(CHOOSEFONTW * cf) {
+	return cf->nFontType;
+}
+

+ 168 - 6
win32.mod/gdi32.bmx

@@ -1,3 +1,6 @@
+Strict
+
+Import "gdi32.cpp"
 
 Const OUT_DEFAULT_PRECIS=0
 Const OUT_STRING_PRECIS=1
@@ -397,7 +400,138 @@ Type BITMAPINFOHEADER
 	Field biClrImportant
 End Type
 
+Extern
+	Function bmx_win32_LOGFONTW_new:Byte Ptr()
+	Function bmx_win32_LOGFONTW_free(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_SetlfHeight(handle:Byte Ptr, lfHeight:Int)
+	Function bmx_win32_LOGFONTW_SetlfWidth(handle:Byte Ptr, lfWidth:Int)
+	Function bmx_win32_LOGFONTW_SetlfWeight(handle:Byte Ptr, lfWeight:Int)
+	Function bmx_win32_LOGFONTW_SetlfItalic(handle:Byte Ptr, lfItalic:Int)
+	Function bmx_win32_LOGFONTW_SetlfUnderline(handle:Byte Ptr, lfUnderline:Int)
+	Function bmx_win32_LOGFONTW_SetlfStrikeOut(handle:Byte Ptr, lfStrikeOut:Int)
+	Function bmx_win32_LOGFONTW_lfHeight:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfWidth:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfEscapement:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfOrientation:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfWeight:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfItalic:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfUnderline:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfStrikeOut:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfCharSet:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfOutPrecision:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfClipPrecision:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfQuality:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfPitchAndFamily:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_lfFaceName:Int(handle:Byte Ptr)
+End Extern
 Type LOGFONTW
+	Field fontPtr:Byte Ptr
+	
+	Field _owner:Int = True
+	
+	Method New()
+		fontPtr = bmx_win32_LOGFONTW_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If fontPtr And _owner Then
+			bmx_win32_LOGFONTW_free(fontPtr)
+		End If
+		fontPtr = Null
+	End Method
+	
+	Function _create:LOGFONTW(fontPtr:Byte Ptr)
+		Local this:LOGFONTW = New LOGFONTW
+		this.Free()
+		this.fontPtr = fontPtr
+		this._owner = False
+		Return this
+	End Function
+	
+	Method SetlfHeight(lfHeight:Int)
+		bmx_win32_LOGFONTW_SetlfHeight(fontPtr, lfHeight)
+	End Method
+	
+	Method SetlfWidth(lfWidth:Int)
+		bmx_win32_LOGFONTW_SetlfWidth(fontPtr, lfWidth)
+	End Method
+	
+	Method SetlfWeight(lfWeight:Int)
+		bmx_win32_LOGFONTW_SetlfWeight(fontPtr, lfWeight)
+	End Method
+	
+	Method SetlfItalic(lfItalic:Int)
+		bmx_win32_LOGFONTW_SetlfItalic(fontPtr, lfItalic)
+	End Method
+	
+	Method SetlfUnderline(lfUnderline:Int)
+		bmx_win32_LOGFONTW_SetlfUnderline(fontPtr, lfUnderline)
+	End Method
+	
+	Method SetlfStrikeOut(lfStrikeOut:Int)
+		bmx_win32_LOGFONTW_SetlfStrikeOut(fontPtr, lfStrikeOut)
+	End Method
+	
+	Method lfHeight:Int()
+		Return bmx_win32_LOGFONTW_lfHeight(fontPtr)
+	End Method
+	
+	Method lfWidth:Int()
+		Return bmx_win32_LOGFONTW_lfWidth(fontPtr)
+	End Method
+	
+	Method lfEscapement:Int()
+		Return bmx_win32_LOGFONTW_lfEscapement(fontPtr)
+	End Method
+	
+	Method lfOrientation:Int()
+		Return bmx_win32_LOGFONTW_lfOrientation(fontPtr)
+	End Method
+	
+	Method lfWeight:Int()
+		Return bmx_win32_LOGFONTW_lfWeight(fontPtr)
+	End Method
+	
+	Method lfItalic:Int()
+		Return bmx_win32_LOGFONTW_lfItalic(fontPtr)
+	End Method
+	
+	Method lfUnderline:Int()
+		Return bmx_win32_LOGFONTW_lfUnderline(fontPtr)
+	End Method
+	
+	Method lfStrikeOut:Int()
+		Return bmx_win32_LOGFONTW_lfStrikeOut(fontPtr)
+	End Method
+	
+	Method lfCharSet:Int()
+		Return bmx_win32_LOGFONTW_lfCharSet(fontPtr)
+	End Method
+	
+	Method lfOutPrecision:Int()
+		Return bmx_win32_LOGFONTW_lfOutPrecision(fontPtr)
+	End Method
+	
+	Method lfClipPrecision:Int()
+		Return bmx_win32_LOGFONTW_lfClipPrecision(fontPtr)
+	End Method
+	
+	Method lfQuality:Int()
+		Return bmx_win32_LOGFONTW_lfQuality(fontPtr)
+	End Method
+	
+	Method lfPitchAndFamily:Int()
+		Return bmx_win32_LOGFONTW_lfPitchAndFamily(fontPtr)
+	End Method
+	
+	Method lfFaceName:Short Ptr()
+		Return bmx_win32_LOGFONTW_lfFaceName(fontPtr)
+	End Method
+Rem
 	Field lfHeight
 	Field lfWidth
 	Field lfEscapement
@@ -443,9 +577,36 @@ Type LOGFONTW
 	Field lfFaceName1d:Short
 	Field lfFaceName1e:Short
 	Field lfFaceName1f:Short
+End Rem
 End Type
 
-Type TEXTMETRIC
+Extern
+	Function bmx_win32_TEXTMETRIC_new:Byte Ptr()
+	Function bmx_win32_TEXTMETRIC_free(handle:Byte Ptr)
+	Function bmx_win32_TEXTMETRIC_tmAveCharWidth:Int(handle:Byte Ptr)
+End Extern
+Type TEXTMETRICW
+	Field metricPtr:Byte Ptr
+	
+	Method New()
+		metricPtr = bmx_win32_TEXTMETRIC_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If metricPtr Then
+			bmx_win32_TEXTMETRIC_free(metricPtr)
+		End If
+		metricPtr = Null
+	End Method
+	
+	Method tmAveCharWidth:Int()
+		Return bmx_win32_TEXTMETRIC_tmAveCharWidth(metricPtr)
+	End Method
+Rem
 	Field tmHeight
 	Field tmAscent
 	Field tmDescent
@@ -469,6 +630,7 @@ Type TEXTMETRIC
 	Field pad0:Byte
 	Field pad1:Byte
 	Field pad2:Byte
+End Rem
 End Type
 
 
@@ -488,20 +650,20 @@ Function BitBlt(hdc:Byte Ptr,x,y,w,h,src_dc:Byte Ptr,src_x,src_y,dwrop)
 Function GetDeviceCaps(hdc:Byte Ptr,indec)
 
 
-Function CreateFontA(cHeight,cWidth,cEscapement,cOrientation,cWeight,bItalic,bUnderline,bStrikeOut,..
+Function CreateFontA:Byte Ptr(cHeight,cWidth,cEscapement,cOrientation,cWeight,bItalic,bUnderline,bStrikeOut,..
 	iCharSet,iOutPrecision,iClipPrecision,iQuality,iPitchAndFamily,pszFaceName:Byte Ptr)
 	
-Function CreateFontW(cHeight,cWidth,cEscapement,cOrientation,cWeight,bItalic,bUnderline,bStrikeOut,..
+Function CreateFontW:Byte Ptr(cHeight,cWidth,cEscapement,cOrientation,cWeight,bItalic,bUnderline,bStrikeOut,..
 	iCharSet,iOutPrecision,iClipPrecision,iQuality,iPitchAndFamily,pszFaceName:Short Ptr)
 
 Function SelectObject:Byte Ptr(hdc:Byte Ptr,obj:Byte Ptr)
 
 Function DeleteObject( hObject:Byte Ptr )
 
-Function CreateSolidBrush( crColor )
+Function CreateSolidBrush:Byte Ptr( crColor )
 
-Function CreateCompatibleDC( hdc:Byte Ptr )
-Function CreateCompatibleBitmap( hdc:Byte Ptr,nWidth,nHeight )
+Function CreateCompatibleDC:Byte Ptr( hdc:Byte Ptr )
+Function CreateCompatibleBitmap:Byte Ptr( hdc:Byte Ptr,nWidth,nHeight )
 
 Function SetDIBits( hdc:Byte Ptr,hbmp,uStartScan,cScanLines,lpvBits:Byte Ptr,lpbmi:Byte Ptr,fuColorUse )
 Function DeleteDC( hdc:Byte Ptr )

+ 136 - 0
win32.mod/gdi32.cpp

@@ -0,0 +1,136 @@
+#include "windows.h"
+
+extern "C" {
+
+	LOGFONTW * bmx_win32_LOGFONTW_new();
+	void bmx_win32_LOGFONTW_free(LOGFONTW * font);
+	void bmx_win32_LOGFONTW_SetlfHeight(LOGFONTW * font, int lfHeight);
+	void bmx_win32_LOGFONTW_SetlfWidth(LOGFONTW * font, int lfWidth);
+	void bmx_win32_LOGFONTW_SetlfWeight(LOGFONTW * font, int lfWeight);
+	void bmx_win32_LOGFONTW_SetlfItalic(LOGFONTW * font, int lfItalic);
+	void bmx_win32_LOGFONTW_SetlfUnderline(LOGFONTW * font, int lfUnderline);
+	void bmx_win32_LOGFONTW_SetlfStrikeOut(LOGFONTW * font, int lfStrikeOut);
+	int bmx_win32_LOGFONTW_lfHeight(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfWidth(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfEscapement(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfOrientation(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfWeight(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfItalic(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfUnderline(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfStrikeOut(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfCharSet(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfOutPrecision(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfClipPrecision(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfQuality(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_lfPitchAndFamily(LOGFONTW * font);
+	WCHAR * bmx_win32_LOGFONTW_lfFaceName(LOGFONTW * font);
+
+	TEXTMETRIC * bmx_win32_TEXTMETRIC_new();
+	void bmx_win32_TEXTMETRIC_free(TEXTMETRIC * metric);
+	int bmx_win32_TEXTMETRIC_tmAveCharWidth(TEXTMETRIC * metric);
+}
+
+// ********************************************************
+
+LOGFONTW * bmx_win32_LOGFONTW_new() {
+	return (LOGFONTW *)calloc(1, sizeof(LOGFONTW));
+}
+
+void bmx_win32_LOGFONTW_free(LOGFONTW * font) {
+	free(font);
+}
+
+void bmx_win32_LOGFONTW_SetlfHeight(LOGFONTW * font, int lfHeight) {
+	font->lfHeight= lfHeight;
+}
+
+void bmx_win32_LOGFONTW_SetlfWidth(LOGFONTW * font, int lfWidth) {
+	font->lfWidth= lfWidth;
+}
+
+void bmx_win32_LOGFONTW_SetlfWeight(LOGFONTW * font, int lfWeight) {
+	font->lfWeight= lfWeight;
+}
+
+void bmx_win32_LOGFONTW_SetlfItalic(LOGFONTW * font, int lfItalic) {
+	font->lfItalic= lfItalic;
+}
+
+void bmx_win32_LOGFONTW_SetlfUnderline(LOGFONTW * font, int lfUnderline) {
+	font->lfUnderline= lfUnderline;
+}
+
+void bmx_win32_LOGFONTW_SetlfStrikeOut(LOGFONTW * font, int lfStrikeOut) {
+	font->lfStrikeOut= lfStrikeOut;
+}
+
+int bmx_win32_LOGFONTW_lfHeight(LOGFONTW * font) {
+	return font->lfHeight;
+}
+
+int bmx_win32_LOGFONTW_lfWidth(LOGFONTW * font) {
+	return font->lfWidth;
+}
+
+int bmx_win32_LOGFONTW_lfEscapement(LOGFONTW * font) {
+	return font->lfEscapement;
+}
+
+int bmx_win32_LOGFONTW_lfOrientation(LOGFONTW * font) {
+	return font->lfOrientation;
+}
+
+int bmx_win32_LOGFONTW_lfWeight(LOGFONTW * font) {
+	return font->lfWeight;
+}
+
+int bmx_win32_LOGFONTW_lfItalic(LOGFONTW * font) {
+	return font->lfItalic;
+}
+
+int bmx_win32_LOGFONTW_lfUnderline(LOGFONTW * font) {
+	return font->lfUnderline;
+}
+
+int bmx_win32_LOGFONTW_lfStrikeOut(LOGFONTW * font) {
+	return font->lfStrikeOut;
+}
+
+int bmx_win32_LOGFONTW_lfCharSet(LOGFONTW * font) {
+	return font->lfCharSet;
+}
+
+int bmx_win32_LOGFONTW_lfOutPrecision(LOGFONTW * font) {
+	return font->lfOutPrecision;
+}
+
+int bmx_win32_LOGFONTW_lfClipPrecision(LOGFONTW * font) {
+	return font->lfClipPrecision;
+}
+
+int bmx_win32_LOGFONTW_lfQuality(LOGFONTW * font) {
+	return font->lfQuality;
+}
+
+int bmx_win32_LOGFONTW_lfPitchAndFamily(LOGFONTW * font) {
+	return font->lfPitchAndFamily;
+}
+
+WCHAR * bmx_win32_LOGFONTW_lfFaceName(LOGFONTW * font) {
+	return font->lfFaceName;
+}
+
+// ********************************************************
+
+TEXTMETRIC * bmx_win32_TEXTMETRIC_new() {
+	return (TEXTMETRIC *)calloc(1, sizeof(TEXTMETRIC));
+}
+
+void bmx_win32_TEXTMETRIC_free(TEXTMETRIC * metric) {
+	free(metric);
+}
+
+int bmx_win32_TEXTMETRIC_tmAveCharWidth(TEXTMETRIC * metric) {
+	return metric->tmAveCharWidth;
+}
+

+ 7 - 7
win32.mod/kernel32.bmx

@@ -24,8 +24,8 @@ Const GMEM_ZEROINT=$40
 
 Function Sleep( dwMilliseconds )
 Function Beep( dwFreq,dwDuration )
-Function GetModuleHandleA( lpModuleName:Byte Ptr  )
-Function GetModuleHandleW( lpModuleName:Short Ptr )
+Function GetModuleHandleA:Byte Ptr( lpModuleName:Byte Ptr  )
+Function GetModuleHandleW:Byte Ptr( lpModuleName:Short Ptr )
 Function SetFileAttributesA( lpFileName$z,dwFileAttributes )
 Function SetFileAttributesW( lpFileName$z,dwFileAttributes )
 Function GetFileAttributesA( lpFileName$z )
@@ -33,11 +33,11 @@ Function GetFileAttributesW( lpFileName$z )
 
 Function GetCurrentThreadId()
 
-Function GlobalAlloc(uFlags,dwBytes)
-Function GlobalSize(hMem)
-Function GlobalFree(hMem)
-Function GlobalLock:Byte Ptr(hMem)
-Function GlobalUnlock(hMem)
+Function GlobalAlloc:Byte Ptr(uFlags,dwBytes)
+Function GlobalSize(hMem:Byte Ptr)
+Function GlobalFree(hMem:Byte Ptr)
+Function GlobalLock:Byte Ptr(hMem:Byte Ptr)
+Function GlobalUnlock(hMem:Byte Ptr)
 
 Const STD_INPUT_HANDLE=-10
 Const STD_OUTPUT_HANDLE=-11

+ 78 - 2
win32.mod/richedit.bmx

@@ -2,6 +2,8 @@ Strict
 
 Import "user32.bmx"
 
+Import "richtext.cpp"
+
 Const EN_MSGFILTER=$0700
 Const EN_REQUESTRESIZE=$0701
 Const EN_SELCHANGE=$0702
@@ -382,12 +384,85 @@ Type TEXTRANGEW
 	Field	lpStrText:Short Ptr
 End Type
 
+Extern
+	Function bmx_win32_CHARRANGE_new:Byte Ptr()
+	Function bmx_win32_CHARRANGE_free(handle:Byte Ptr)
+	Function bmx_win32_CHARRANGE_SetcpMin(handle:Byte Ptr, cpMin:Int)
+	Function bmx_win32_CHARRANGE_SetcpMax(handle:Byte Ptr, cpMax:Int)
+	Function bmx_win32_CHARRANGE_cpMin:Int(handle:Byte Ptr)
+	Function bmx_win32_CHARRANGE_cpMax:Int(handle:Byte Ptr)
+End Extern
 Type CHARRANGE
-	Field	cpMin
-	Field	cpMax
+	Field rangePtr:Byte Ptr
+	
+	Method New()
+		rangePtr = bmx_win32_CHARRANGE_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If rangePtr Then
+			bmx_win32_CHARRANGE_free(rangePtr)
+			rangePtr = Null
+		End If
+	End Method
+	
+	Method SetcpMin(cpMin:Int)
+		bmx_win32_CHARRANGE_SetcpMin(rangePtr, cpMin)
+	End Method
+	
+	Method SetcpMax(cpMax:Int)
+		bmx_win32_CHARRANGE_SetcpMax(rangePtr, cpMax)
+	End Method
+	
+	Method cpMin:Int()
+		Return bmx_win32_CHARRANGE_cpMin(rangePtr)
+	End Method
+	
+	Method cpMax:Int()
+		Return bmx_win32_CHARRANGE_cpMax(rangePtr)
+	End Method
+	
+'	Field	cpMin
+'	Field	cpMax
 End Type
 
+Extern
+	Function bmx_win32_CHARFORMATW_new:Byte Ptr()
+	Function bmx_win32_CHARFORMATW_free(handle:Byte Ptr)
+	Function bmx_win32_CHARFORMATW_SetdwMask(handle:Byte Ptr, dwMask:Int)
+	Function bmx_win32_CHARFORMATW_SetcrTextColor(handle:Byte Ptr, crTextColor:Int)
+End Extern
 Type CHARFORMATW
+	Field formatPtr:Byte Ptr
+	
+	Method New()
+		formatPtr = bmx_win32_CHARFORMATW_new()
+	End Method
+
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If formatPtr Then
+			bmx_win32_CHARFORMATW_free(formatPtr)
+			formatPtr = Null
+		End If
+	End Method
+	
+	Method SetdwMask(dwMask:Int)
+		bmx_win32_CHARFORMATW_SetdwMask(formatPtr, dwMask)
+	End Method
+	
+	Method SetcrTextColor(crTextColor:Int)
+		bmx_win32_CHARFORMATW_SetcrTextColor(formatPtr, crTextColor)
+	End Method
+	
+Rem
 	Field	cbSize
 	Field	dwMask
 	Field	dwEffects
@@ -429,6 +504,7 @@ Type CHARFORMATW
 	Field lfFaceName1e:Short
 	Field lfFaceName1f:Short
 	Field	pad:Short
+End Rem
 End Type
 
 Type CHARFORMAT

+ 65 - 0
win32.mod/richtext.cpp

@@ -0,0 +1,65 @@
+#include <windows.h>
+#include <richedit.h>
+
+extern "C" {
+
+	CHARRANGE * bmx_win32_CHARRANGE_new();
+	void bmx_win32_CHARRANGE_free(CHARRANGE * range);
+	void bmx_win32_CHARRANGE_SetcpMin(CHARRANGE * range, int cpMin);
+	void bmx_win32_CHARRANGE_SetcpMax(CHARRANGE * range, int cpMax);
+	int bmx_win32_CHARRANGE_cpMin(CHARRANGE * range);
+	int bmx_win32_CHARRANGE_cpMax(CHARRANGE * range);
+
+	CHARFORMATW * bmx_win32_CHARFORMATW_new();
+	void bmx_win32_CHARFORMATW_free(CHARFORMATW * format);
+	void bmx_win32_CHARFORMATW_SetdwMask(CHARFORMATW * format, int dwMask);
+	void bmx_win32_CHARFORMATW_SetcrTextColor(CHARFORMATW * format, int crTextColor);
+
+}
+
+// ********************************************************
+
+CHARRANGE * bmx_win32_CHARRANGE_new() {
+	return (CHARRANGE *)calloc(1, sizeof(CHARRANGE));
+}
+
+void bmx_win32_CHARRANGE_free(CHARRANGE * range) {
+	free(range);
+}
+
+void bmx_win32_CHARRANGE_SetcpMin(CHARRANGE * range, int cpMin) {
+	range->cpMin = cpMin;
+}
+
+void bmx_win32_CHARRANGE_SetcpMax(CHARRANGE * range, int cpMax) {
+	range->cpMax = cpMax;
+}
+
+int bmx_win32_CHARRANGE_cpMin(CHARRANGE * range) {
+	return range->cpMin;
+}
+
+int bmx_win32_CHARRANGE_cpMax(CHARRANGE * range) {
+	return range->cpMax;
+}
+
+// ********************************************************
+
+CHARFORMATW * bmx_win32_CHARFORMATW_new() {
+	CHARFORMATW * format = (CHARFORMATW *)calloc(1, sizeof(CHARFORMATW));
+	format->cbSize = sizeof(CHARFORMATW);
+	return format;
+}
+
+void bmx_win32_CHARFORMATW_free(CHARFORMATW * format) {
+	free(format);
+}
+
+void bmx_win32_CHARFORMATW_SetdwMask(CHARFORMATW * format, int dwMask) {
+	format->dwMask = dwMask;
+}
+
+void bmx_win32_CHARFORMATW_SetcrTextColor(CHARFORMATW * format, int crTextColor) {
+	format->crTextColor = crTextColor;
+}
+

+ 46 - 21
win32.mod/user32.bmx

@@ -853,17 +853,43 @@ Type MINMAXINFO
 	Field minx,miny
 End Type
 
+Extern
+	Function bmx_win32_WINDOWINFO_new:Byte Ptr()
+	Function bmx_win32_WINDOWINFO_free(handle:Byte Ptr)
+	Function bmx_win32_WINDOWINFO_dwStyle:Int(handle:Byte Ptr)
+End Extern
 Type WINDOWINFO
-	Field cbSize
-	Field rcWindowl,rcWindowt,rcWindowr,rcWindowb
-	Field rcClientl,rcClientt,rcClientr,rcClientb	
-	Field dwStyle
-    Field dwExStyle
-    Field dwWindowStatus
-    Field cxWindowBorders
-    Field cyWindowBorders
-    Field atomWindowType
-    Field wCreatorVersion:Short	
+	Field infoPtr:Byte Ptr
+	
+	Method New()
+		infoPtr = bmx_win32_WINDOWINFO_new()
+	End Method
+	
+	Method Delete()
+		Free()
+	End Method
+	
+	Method Free()
+		If infoPtr Then
+			bmx_win32_WINDOWINFO_free(infoPtr)
+			infoPtr = Null
+		End If
+	End Method
+
+	Method dwStyle:Int()
+		Return bmx_win32_WINDOWINFO_dwStyle(infoPtr)
+	End Method
+	
+'	Field cbSize
+'	Field rcWindowl,rcWindowt,rcWindowr,rcWindowb
+'	Field rcClientl,rcClientt,rcClientr,rcClientb	
+'	Field dwStyle
+'    Field dwExStyle
+'    Field dwWindowStatus
+'    Field cxWindowBorders
+'    Field cyWindowBorders
+'    Field atomWindowType
+'    Field wCreatorVersion:Short	
 End Type
 
 Type PAINTSTRUCT
@@ -1016,7 +1042,6 @@ Type ICONINFO
 '    Field hbmColor
 EndType
 
-
 Extern "Win32"
 
 Function SetCapture( hWnd:Byte Ptr )
@@ -1026,8 +1051,8 @@ Function RegisterClassA( lpWndClass:Byte Ptr )
 Function RegisterClassW( lpWndClass:Byte Ptr )
 Function CreateWindowExA:Byte Ptr( dwExStyle,lpClassName:Byte Ptr,lpWindowName:Byte Ptr,dwStyle,x,y,nWidth,nHeight,hWndParent,hmenu:Byte Ptr,hInstance:Byte Ptr,lpParam:Byte Ptr )
 Function CreateWindowExW:Byte Ptr( dwExStyle,lpClassName$w,lpWindowName$w,dwStyle,x,y,nWidth,nHeight,hWndParent:Byte Ptr,hmenu:Byte Ptr,hInstance:Byte Ptr,lpParam:Byte Ptr )
-Function DefWindowProcA( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
-Function DefWindowProcW( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
+Function DefWindowProcA:Byte Ptr( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
+Function DefWindowProcW:Byte Ptr( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
 Function DispatchMessageA( lpMsg:Byte Ptr )
 Function DispatchMessageW( lpMsg:Byte Ptr )
 Function GetMessageA( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax )
@@ -1036,7 +1061,7 @@ Function PeekMessageA( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax,
 Function PeekMessageW( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax,wRemoveMsg )
 Function PostMessageA( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
 Function PostMessageW( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
-Function SendMessageA( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
+Function SendMessageA( hWnd:Byte Ptr,MSG:UInt,wParam:Byte Ptr,lParam:Byte Ptr )
 Function SendMessageW( hWnd:Byte Ptr,MSG:UInt,wParam:Byte Ptr,lParam:Byte Ptr )
 Function PostThreadMessageA( idThread,Msg,wParam:Byte Ptr,lParam:Byte Ptr )
 Function PostThreadMessageW( idThread,Msg,wParam:Byte Ptr,lParam:Byte Ptr )
@@ -1052,11 +1077,11 @@ Function LoadCursorA:Byte Ptr( hInstance:Byte Ptr,lpCursorName:Byte Ptr )
 Function LoadCursorW:Byte Ptr( hInstance:Byte Ptr,lpCursorName:Short Ptr )
 Function ShowCursor( visible )
 Function SetCursor( hCursor:Byte Ptr )
-Function LoadIconA:Byte Ptr( resourceid,lpIconName:Byte Ptr )
-Function LoadIconW:Byte Ptr( resourceid,lpIconName:Short Ptr )
-Function LoadLibraryA( dll$z )
+Function LoadIconA:Byte Ptr( resourceid:Byte Ptr,lpIconName:Byte Ptr )
+Function LoadIconW:Byte Ptr( resourceid:Byte Ptr,lpIconName:Short Ptr )
+Function LoadLibraryA:Byte Ptr( dll$z )
 Function GetProcAddress:Byte Ptr( libhandle:Byte Ptr,func$z )
-Function LoadLibraryW( dll$w )
+Function LoadLibraryW:Byte Ptr( dll$w )
 Function GetClientRect( hWnd:Byte Ptr,lpRect:Int Ptr )
 Function GetWindowRect( hWnd:Byte Ptr,lpRect:Int Ptr )
 Function GetDesktopWindow()
@@ -1080,7 +1105,7 @@ Function SetMenuItemInfoW( hmenu:Byte Ptr,item,fByPosition,info:Byte Ptr )
 Function GetMenuItemCount( hmenu:Byte Ptr )
 Function SetWindowTextA( hWnd:Byte Ptr,text$z )
 Function SetWindowTextW( hWnd:Byte Ptr,text$w )
-Function SetWindowPos( hWnd:Byte Ptr,hWndInsertAfter,x,y,cx,cy,uFlags )
+Function SetWindowPos( hWnd:Byte Ptr,hWndInsertAfter:Byte Ptr,x,y,cx,cy,uFlags )
 Function GetForegroundWindow()
 Function SetForegroundWindow(hWnd:Byte Ptr)
 Function IsIconic(hWnd:Byte Ptr)
@@ -1136,8 +1161,8 @@ Function EnumChildWindows( hWnd:Byte Ptr,lpfn:Byte Ptr,lp:Byte Ptr )
 
 Function OpenClipboard(hWnd:Byte Ptr)
 Function CloseClipboard()
-Function SetClipboardData(uFormat,hMem)
-Function GetClipboardData(uFormat)
+Function SetClipboardData:Byte Ptr(uFormat:UInt,hMem:Byte Ptr)
+Function GetClipboardData:Byte Ptr(uFormat:UInt)
 Function EmptyClipboard()
 Function IsClipboardFormatAvailable(format)
 

+ 17 - 0
win32.mod/user32.cpp

@@ -54,6 +54,10 @@ extern "C" {
 	int bmx_win32_SCROLLINFO_nPos(SCROLLINFO * info);
 	int bmx_win32_SCROLLINFO_nTrackPos(SCROLLINFO * info);
 
+	WINDOWINFO * bmx_win32_WINDOWINFO_new();
+	void bmx_win32_WINDOWINFO_free(WINDOWINFO * info);
+	int bmx_win32_WINDOWINFO_dwStyle(WINDOWINFO * info);
+
 }
 
 // ********************************************************
@@ -250,4 +254,17 @@ int bmx_win32_SCROLLINFO_nTrackPos(SCROLLINFO * info) {
 	return info->nTrackPos;
 }
 
+// ********************************************************
+
+WINDOWINFO * bmx_win32_WINDOWINFO_new() {
+	return (WINDOWINFO *)calloc(1, sizeof(WINDOWINFO));
+}
+
+void bmx_win32_WINDOWINFO_free(WINDOWINFO * info) {
+	free(info);
+}
+
+int bmx_win32_WINDOWINFO_dwStyle(WINDOWINFO * info) {
+	return info->dwStyle;
+}
 

+ 8 - 8
win32.mod/user32.x

@@ -12,12 +12,12 @@ BOOL GetMessageA(LPMSG,HWND,UINT,UINT)!
 BOOL GetMessageW(LPMSG,HWND,UINT,UINT)!
 BBINT PeekMessageA(BBBYTE * ,BBINT ,BBINT ,BBINT ,BBINT )!
 BBINT PeekMessageW(BBBYTE * ,BBINT ,BBINT ,BBINT ,BBINT )!
-BBINT PostMessageA(BBINT ,BBINT ,BBINT ,BBINT )!
-BBINT PostMessageW(BBINT ,BBINT ,BBINT ,BBINT )!
-BBINT SendMessageA(BBINT ,BBINT ,BBINT ,BBINT )!
-BBINT SendMessageW(BBINT ,BBINT ,BBINT ,BBINT )!
-BBINT PostThreadMessageA(BBINT ,BBINT ,BBINT ,BBINT )!
-BBINT PostThreadMessageW(BBINT ,BBINT ,BBINT ,BBINT )!
+BBINT PostMessageA(HWND ,UINT ,WPARAM ,LPARAM )!
+BBINT PostMessageW(HWND ,UINT ,WPARAM ,LPARAM )!
+BBINT SendMessageA(HWND ,UINT ,WPARAM ,LPARAM )!
+BBINT SendMessageW(HWND ,UINT ,WPARAM ,LPARAM )!
+BBINT PostThreadMessageA(BBINT ,UINT ,WPARAM ,LPARAM )!
+BBINT PostThreadMessageW(BBINT ,UINT ,WPARAM ,LPARAM )!
 BBINT GetDC(BBINT )!
 BBINT PostQuitMessage(BBINT )!
 BBINT TranslateMessage(BBBYTE * )!
@@ -33,8 +33,8 @@ BBINT SetCursor(BBINT )!
 BBINT LoadIconA(BBINT ,BBBYTE * )!
 BBINT LoadIconW(BBINT ,BBSHORT * )!
 BBINT LoadLibraryA(BBBYTE * )!
-BBBYTE * GetProcAddress(BBINT ,BBBYTE * )!
-BBINT LoadLibraryW(BBSHORT * )!
+FARPROC __stdcall GetProcAddress(HMODULE ,LPCSTR )!
+HMODULE __stdcall LoadLibraryW(LPCTSTR )!
 BBINT GetClientRect(BBINT ,BBINT * )!
 BBINT GetWindowRect(BBINT ,BBINT * )!
 HWND GetDesktopWindow()!