Example using "Common Controls"
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Well, i don't have one, but just started writing one .
It looks like a lot of work, but it's fun.
I'll post the results, if i succeed...
Timo
--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
...So far, the universe is winning.
Well, i don't have one, but just started writing one .
It looks like a lot of work, but it's fun.
I'll post the results, if i succeed...
Timo
--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
...So far, the universe is winning.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Hope this is somewhat useful...
Have fun 
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Hope this is somewhat useful...
Code: Select all
; (c) 2002 - Franco's template - absolutely freeware
; Win-API Calendar
; coded under WinXP
; (hope it works also on other M$-OS, but you never know...)
OpenWindow(0,150,150,200,200,#PB_Window_SystemMenu,"API-Calendar")
CreateWindowEx_(0,"SysMonthCal32",0,#WS_CHILD|#WS_VISIBLE|#WS_CLIPCHILDREN|#WS_CLIPSIBLINGS,0,0,200,200, WindowID(),0,GetModuleHandle_(0),0)
Repeat
EventID.l = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow
End
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> Sorry, doesn't work under Win2K.
> Just an empty window
Same... Franco, which versions of these files do you have on XP:
User32.dll (I have 5.0.2195.2821).
Comctl32.dll (I have 5.81.4704.1100).
Because according to http://tinyurl.com/16cr the SysMonthCal32 item
is part of Comctl32.dll v4.70 (or perhaps User32.dll).
PB - Registered PureBasic Coder
> Sorry, doesn't work under Win2K.
> Just an empty window
Same... Franco, which versions of these files do you have on XP:
User32.dll (I have 5.0.2195.2821).
Comctl32.dll (I have 5.81.4704.1100).
Because according to http://tinyurl.com/16cr the SysMonthCal32 item
is part of Comctl32.dll v4.70 (or perhaps User32.dll).
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by H.Brill.
Hi,
It not works on WIN 98. It is a mistake by the API-functions or
styles. i have a demo program in IBasic and it works, but i have
not any experience with API calls and API styles. if you want, i
can send you the demo for looking the sourcecode.
perhaps you can need it to translate to PB.
[url]mailto:H.Brill@t-online.de[/url]
Hi,
It not works on WIN 98. It is a mistake by the API-functions or
styles. i have a demo program in IBasic and it works, but i have
not any experience with API calls and API styles. if you want, i
can send you the demo for looking the sourcecode.
perhaps you can need it to translate to PB.
[url]mailto:H.Brill@t-online.de[/url]
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by H.Brill.
or download it :
http://www.pyxia.com
- forums
- Software Projects
- Date Dialog Component
or download it :
http://www.pyxia.com
- forums
- Software Projects
- Date Dialog Component
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
Franco always forgets to initialize the ShellCC
cya,
...Danilo
(registered PureBasic user)
Franco always forgets to initialize the ShellCC
Code: Select all
; (c) 2002 - Franco's template - absolutely freeware
; Win-API Calendar
; coded under WinXP
; (hope it works also on other M$-OS, but you never know...)
Structure INITCOMMONCONTROLSEX
dwSize.l
dwICC.l
EndStructure
my.INITCOMMONCONTROLSEX
my\dwSize = 8
my\dwICC = $100
InitCommonControlsEx_(@my)
OpenWindow(0,150,150,200,250,#PB_Window_SystemMenu,"API-Calendar")
CreateWindowEx_(0,"SysDateTimePick32","DateTime",#WS_CHILD|#WS_VISIBLE|4,0,0,200,25, WindowID(),0,GetModuleHandle_(0),0)
CreateWindowEx_(0,"SysMonthCal32","DateTime",#WS_CHILD|#WS_VISIBLE|#WS_BORDER,0,50,200,200, WindowID(),0,GetModuleHandle_(0),0)
Repeat
EventID.l = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow
End...Danilo
(registered PureBasic user)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Good morning
@home I have a normal WinXP installation, nothing fancy.
I purchased my SONY Notebook Nov/Dec 2001 and AFAIK there are no different versions of User32.dll and Comctl32.dll - well not that I know of (the Service Pack 1 should come in fall).
I read once that the DLL's coming with WinXP are different than all the other OS before.
All previous versions of DLL's are combined in ONE DLL - this way M$ wanted to get out of the DLL hell.
Now @work I have Win2k-Sp3 and my code doesn't work either

I found C code and I converted the CreateWindowEx call to PureBasic, tested it, and it worked.
Was really surprised that it worked without initializing InitCommonControlsEx so I didn't add it to the code - couldn't test the difference, it always worked. (I was not able to tell if the initialization failed or not...)
Danilo thanks for your help.
My conclusion now is that WinXP is a miserable programming environment - or is there a WinXP user that was not able to run my initial code
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Good morning
@home I have a normal WinXP installation, nothing fancy.
I purchased my SONY Notebook Nov/Dec 2001 and AFAIK there are no different versions of User32.dll and Comctl32.dll - well not that I know of (the Service Pack 1 should come in fall).
I read once that the DLL's coming with WinXP are different than all the other OS before.
All previous versions of DLL's are combined in ONE DLL - this way M$ wanted to get out of the DLL hell.
Now @work I have Win2k-Sp3 and my code doesn't work either
Sorry folksOriginally posted by Danilo
Franco always forgets to initialize the ShellCC![]()
I found C code and I converted the CreateWindowEx call to PureBasic, tested it, and it worked.
Was really surprised that it worked without initializing InitCommonControlsEx so I didn't add it to the code - couldn't test the difference, it always worked. (I was not able to tell if the initialization failed or not...)
Danilo thanks for your help.
My conclusion now is that WinXP is a miserable programming environment - or is there a WinXP user that was not able to run my initial code
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> Franco always forgets to initialize the ShellCC
Thanks Danilo -- it now works for me (W2K).
Now, if only we knew which date the user clicked on...?
Is there a way to determine the day/month/year currently selected?
PB - Registered PureBasic Coder
> Franco always forgets to initialize the ShellCC
Thanks Danilo -- it now works for me (W2K).
Now, if only we knew which date the user clicked on...?
Is there a way to determine the day/month/year currently selected?
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
First get the HAndle to the control by putting something like
'hCal.l =' in front of CreateWindowEx_(), then to get the date,
use this:
You'll now have the date stored in the time Structure.
Here are it's contents:
wYear
Specifies the current year. The year must be greater than 1601.
Windows XP: The year cannot be greater than 30827.
wMonth
Specifies the current month; January = 1, February = 2, and so on.
wDayOfWeek
Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.
wDay
Specifies the current day of the month.
wHour
Specifies the current hour.
wMinute
Specifies the current minute.
wSecond
Specifies the current second.
wMilliseconds
Specifies the current millisecond.
First get the HAndle to the control by putting something like
'hCal.l =' in front of CreateWindowEx_(), then to get the date,
use this:
Code: Select all
#MCM_GETCURSEL = $1001
SendMessage_(hCal, #MCM_GETCURSEL, 0, @time.SYSTEMTIME)
Here are it's contents:
wYear
Specifies the current year. The year must be greater than 1601.
Windows XP: The year cannot be greater than 30827.
wMonth
Specifies the current month; January = 1, February = 2, and so on.
wDayOfWeek
Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.
wDay
Specifies the current day of the month.
wHour
Specifies the current hour.
wMinute
Specifies the current minute.
wSecond
Specifies the current second.
wMilliseconds
Specifies the current millisecond.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by TerryHough.
the same thing.
Freak,
Thanks for the pointers. But I am still confused. I can't get the
date info even with this. But, remember, I am a novice so I don't
even understand all of this.
I want to get the date info, and then be able to manipulate it.
Somehow, I still can't access the SYSTEMTIME information. Maybe
you could expand your explanation to show how to actually access
wYear, etc.
BTW, is there a way to grab the Julian date?
Appreciate your help and advice.
Terry
PB, you must have been reading my mind. I was trying to figure outNow, if only we knew which date the user clicked on...?
Is there a way to determine the day/month/year currently selected?
PB - Registered PureBasic Coder
the same thing.
Freak,
Thanks for the pointers. But I am still confused. I can't get the
date info even with this. But, remember, I am a novice so I don't
even understand all of this.
I want to get the date info, and then be able to manipulate it.
Somehow, I still can't access the SYSTEMTIME information. Maybe
you could expand your explanation to show how to actually access
wYear, etc.
BTW, is there a way to grab the Julian date?
Appreciate your help and advice.
Terry
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
Does this make a little more sense? ...
As far as I know you have to calculate Julian date yourself (but I could be wrong) 
Does this make a little more sense? ...
Code: Select all
; (c) 2002 - Franco's template - absolutely freeware
; Win-API Calendar
; coded under WinXP
; (hope it works also on other M$-OS, but you never know...)
#MCM_GETCURSEL = $1001
#ok=1
Structure INITCOMMONCONTROLSEX
dwSize.l
dwICC.l
EndStructure
my.INITCOMMONCONTROLSEX
my\dwSize = 8
my\dwICC = $100
InitCommonControlsEx_(@my)
hWnd=OpenWindow(0,150,150,200,250,#PB_Window_SystemMenu,"API-Calendar")
If hWnd=0 Or CreateGadgetList(hWnd)=0:End:EndIf
hCal=CreateWindowEx_(0,"SysMonthCal32","DateTime",#WS_CHILD|#WS_VISIBLE|#WS_BORDER,0,0,200,200,hWnd,0,GetModuleHandle_(0),0)
ButtonGadget(#ok,100,220,50,20,"Get Time")
Repeat
EventID.l = WaitWindowEvent()
If EventID=#PB_EventGadget
If EventGadgetID()=#ok
SendMessage_([url]mailto:hCal,#MCM_GETCURSEL,0,@time.SYSTEMTIME[/url])
year=time\wYear
month=time\wMonth
day=time\wDay
info.s=Str(month)+"/"+Str(day)+"/"+str(year)
MessageRequester("",info,0)
EndIf
EndIf
Until EventID = #PB_EventCloseWindow
End