Api Constant Value

Windows specific forum
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Api Constant Value

Post by Konne »

Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
Apart from that Mrs Lincoln, how was the show?
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Re: Api Constant Value

Post by Kale »

Konne wrote:Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
'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.

http://msdn.microsoft.com/library/defau ... _using.asp
--Kale

Image
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

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?
Apart from that Mrs Lincoln, how was the show?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Examples in the CodeArchiv. Controls with API a created by:

Code: Select all

CreateWindowEx_(
see: http://msdn.microsoft.com/library/defau ... ndowex.asp
Constands for Controls mostly declared in: commctrl.h
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Could someone show me an example how to create a Listview in PB via Api?
OK, why not, I'm bored anyway:

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 

End
BERESHEIT
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great instructional moments for us learners! Thanks! :D
Last edited by mskuma on Tue Aug 08, 2006 11:28 am, edited 1 time in total.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

mskuma wrote:netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great intructional moments for us learners! Thanks! :D
Yeah! :lol: :lol: Hope netmaestro is bored a lot! :lol:
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

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?
'Alt-S' in the IDE.
--Kale

Image
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

Kale wrote:
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?
'Alt-S' in the IDE.
Not all Constants are declared in PB.

And thanks for the great example ;)
Apart from that Mrs Lincoln, how was the show?
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

I'm trying to Make a Row Editable like in the Api description but it doesn't work.
Here the Link to the message
http://msdn.microsoft.com/library/defau ... tlabel.asp
and here my code

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

End
Apart from that Mrs Lincoln, how was the show?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

OK, here's a working example of an editable listview control created in API. Just double-click any item to edit its contents:

Code: 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
BERESHEIT
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

Wow thx very much!!!" :D
Apart from that Mrs Lincoln, how was the show?
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

Ok one last question. Where do u get the class name, like: "SysListView32" ?
In msdn they use tell me I have to use WC_TABCONTROL for tabs for example. So where do u get the String?
Apart from that Mrs Lincoln, how was the show?
Post Reply