What's wrong with this function?

BlitzPlus Forums/BlitzPlus Programming/What's wrong with this function?

Hey guys. Can anyone tell me what's wrong with this set of functions? Whenever I try to use this function to create a button with the createwindowex userlib. Why can't I do this? Is there something weird about the way blitz controls UI things? Here's my code.

Function createapibutton(title,x,y,w,h,p,hinst)
	BtnClass=cstr("BUTTON")
	BtnTitle=cstr(title)
	button=CreateWindowEx(0,BtnClass,BtnTitle,WS_VISIBLE Or WS_CHILD Or BS_PUSHBUTTON,x,y,w,h,p,0,hInst,0)
	FreeBank(btnclass)
	FreeBank(btntitle)
	Return button
End Function

Function togglestyle(control,style)
	tmphwnd=QueryObject(control,1)
	SetWindowLong(tmphwnd,GWL_STYLE,GetWindowLong(tmphwnd,GWL_STYLE) Xor style)
	SetWindowPos(tmphwnd,0,0,0,0,0,SWP_NOMOVE Or SWP_NOZORDER Or SWP_NOSIZE Or SWP_FRAMECHANGED)
End Function

Function CStr(convert$)
	retbank=CreateBank(Len(convert)+1)
	For I=0 To Len(convert)-1
		PokeByte(retbank,I,Asc(Mid$(convert,I+1,1)))
	Next
	Return retbank
End Function