Api Constant Value
Posted: Mon Aug 07, 2006 10:53 pm
Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
For Example #WC_LISTVIEW?
http://www.purebasic.com
https://www.purebasic.fr/english/
'WC_LISTVIEW' is a window class that is used as a parameter of the 'CreateWindowEx()' API command. It's used basically to tell the command to create a list view gadget.Konne wrote:Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
Code: Select all
CreateWindowEx_(OK, why not, I'm bored anyway:Could someone show me an example how to create a Listview in PB via Api?
Code: Select all
colinfo.LV_COLUMN
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT
colinfo\fmt = #LVCFMT_LEFT
colinfo\cx = 195
colinfo\pszText = @"Column Header"
hwnd = OpenWindow(0,0,0,320,300, "Listview API Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
lv=CreateWindowEx_(#WS_EX_CLIENTEDGE, "SysListView32", "MyListView", #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 60,50,200,200,hwnd,0,GetModuleHandle_(0),0)
SendMessage_(lv, #LVM_INSERTCOLUMN, 0, @colinfo)
line.LV_ITEM
line\Mask = #LVIF_TEXT
line\iItem = 0
line\iSubItem = 0
line\pszText = @"Line 1"
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
line\iItem = 1
line\iSubItem = 0
line\pszText = @"Line 2"
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
Repeat
EventID=WaitWindowEvent()
Until EventID=#PB_Event_CloseWindow
EndYeah!mskuma wrote:netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great intructional moments for us learners! Thanks!
'Alt-S' in the IDE.Konne wrote:So how do I have to write it in PB? Could someone show me an example how to create a Listview in PB via Api?
And is still the question is there a list of the Constant Values?
Not all Constants are declared in PB.Kale wrote:'Alt-S' in the IDE.Konne wrote:So how do I have to write it in PB? Could someone show me an example how to create a Listview in PB via Api?
And is still the question is there a list of the Constant Values?
Code: Select all
Procedure SetView(hwnd,View)
dwStyle=GetWindowLong_(Wnd, #GWL_STYLE);
SetWindowLong_(hwnd,#GWL_STYLE, (dwStyle & ~#LVS_TYPEMASK) | View)
EndProcedure
colinfo.LV_COLUMN
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT
colinfo\fmt = #LVCFMT_LEFT
colinfo\cx = 195
colinfo\pszText = @"Column Header"
hwnd = OpenWindow(0,0,0,320,300, "Listview API Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
lv=CreateWindowEx_(#WS_EX_CLIENTEDGE, "SysListView32", "MyListView", #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 60,50,200,200,hwnd,0,GetModuleHandle_(0),0)
SendMessage_(lv, #LVM_INSERTCOLUMN, 0, @colinfo)
line.LV_ITEM
line\Mask = #LVIF_TEXT
line\iItem = 0
line\iSubItem = 0
line\pszText = @"Line 1"
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
line\iItem = 1
line\pszText = @"Line 2"
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
SendMessage_(lv,#LVM_EDITLABEL,1,0);this isn't working ;(
Repeat
EventID=WaitWindowEvent()
Until EventID=#PB_Event_CloseWindow
EndCode: Select all
Global editcontrol, edititem
colinfo.LV_COLUMN
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT
colinfo\fmt = #LVCFMT_LEFT
colinfo\cx = 195
colinfo\pszText = @"Column Header"
hwnd = OpenWindow(0,0,0,320,300, "Listview API Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
Global lv=CreateWindowEx_(#WS_EX_CLIENTEDGE, "SysListView32", "MyListView", #LVS_EDITLABELS | #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 60,50,200,200,hwnd,0,GetModuleHandle_(0),0)
SendMessage_(lv, #LVM_INSERTCOLUMN, 0, @colinfo)
line.LV_ITEM
line\Mask = #LVIF_TEXT
For i=1 To 10
linetxt.s = "Line "+Str(i)
line\iitem = i
line\pszText = @linetxt
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
Next
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #WM_LBUTTONDBLCLK
lvi.lvhittestinfo
GetCursorPos_(@lvi\pt)
GetWindowRect_(lv,@lvpos.rect)
lvi\pt\x-lvpos\left
lvi\pt\y-lvpos\top
SendMessage_(lv, #LVM_HITTEST, 0, @lvi)
edititem = lvi\iitem
editcontrol = SendMessage_(lv,#LVM_EDITLABEL,edititem,0)
Case #WM_KEYUP
If editcontrol
If EventwParam()<>#VK_RETURN
editstring.s=Space(255)
PokeW(@editstring, 255)
SendMessage_(editcontrol,#EM_GETLINE,0,@editstring)
Else
editcontrol = 0
line.LV_ITEM
line\Mask = #LVIF_TEXT
line\pszText = @editstring
SendMessage_(lv, #LVM_SETITEMTEXT, edititem, @line)
EndIf
EndIf
EndSelect
Until EventID=#PB_Event_CloseWindow
End