Page 1 of 1
Leraning Windows Programming & PureBASIC
Posted: Wed Jun 30, 2004 12:29 pm
by Raymund
Hello Gentlemen,
thank you for the very prompt answers to my questions here. This is really very very encouraging, especially to Beginners like me. So, if you will pardon the audacity,...
here's another question;
I learned Structured Programming when i was at college. At that time, writing programs with 32K of RAM was a big thing and we did this on a BBC micro.
I have Charles Petzhold's Book on Windows Programming and am trying to marry what he says about how to program in Widows with writing programs in PureBASIC. My question is;
To what extent do i have to understand Windows Programming to write programs in PureBASIC that are Windows Programs? (er,...let me know if all this is a little confusing, I'll straighten it out if asked to)
Thank you.
Raymund
Re: Leraning Windows Programming & PureBASIC
Posted: Wed Jun 30, 2004 12:43 pm
by freedimension
Raymund wrote:To what extent do i have to understand Windows Programming to write programs in PureBASIC that are Windows Programs? (er,...let me know if all this is a little confusing, I'll straighten it out if asked to)
Depends on what you want to do. Are you planning to programm a complex UserInterface with special features than you are definitely forced to dug some more into the matter. Are your Programs more of the simple kind, than you could cope just with the commands PB gives you.
There are a many examples on Programming extended UserInterfaces in the CodeArchive by André
http://www.pure-area.net
Posted: Wed Jun 30, 2004 12:44 pm
by Kale
To what extent do i have to understand Windows Programming to write programs in PureBASIC that are Windows Programs?
You dont really need to learn any WinAPI programming to write full windows programs in PB. The WinAPI is supported for use within PB for augmenting your code to have access to more advanced commands. Charles Petzold's book is a great one on the WinAPI and you will learn alot by reading it.
An Example of a program which has been given extra functionality by using a few WinAPI commands:
Code: Select all
Enumeration
#WINDOW_0
#WINDOW_1
#STRING_0
#BUTTON_0
#BUTTON_1
EndEnumeration
Procedure OpenModalWindow()
CallerID = WindowID(#WINDOW_0)
CallerNumber = EventWindowID()
If OpenWindow(#WINDOW_1, 300, 300, 200, 200, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar, "Modal Window")
EnableWindow_(CallerID, #FALSE)
SetWindowPos_(WindowID(#WINDOW_1), #HWND_TOPMOST, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE)
SetForegroundWindow_(WindowID(#WINDOW_1))
If CreateGadgetList(WindowID(#WINDOW_1))
ButtonGadget(#BUTTON_1, 40, 65, 110, 35, "Close")
EndIf
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventGadget
Select EventGadgetID()
Case #BUTTON_1
Quit = 1
EndSelect
Case #PB_EventCloseWindow
Quit = 1
EndSelect
Until Quit = 1
CloseWindow(#WINDOW_1)
EndIf
EnableWindow_(CallerID, #TRUE)
SetForegroundWindow_(CallerID)
UseWindow(CallerNumber)
EndProcedure
;Open main window
If OpenWindow(#WINDOW_0, 200, 200, 200, 200, #PB_Window_SystemMenu | #PB_Window_TitleBar , "Parent Window")
If CreateGadgetList(WindowID())
ButtonGadget(#BUTTON_0, 40, 65, 110, 35, "open new window")
EndIf
EndIf
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetID = EventGadgetID()
If GadgetID = #BUTTON_0
OpenModalWindow()
EndIf
EndIf
Until EventID = #PB_EventCloseWindow
End