API CALLS
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by blueb.
Ricardo...I'm not sure what you mean.
All the WinAPI calls are available as a help file that works with PB.
e.g.
The GetSystemMetrics command is a WinAPI call.
Note that you must use the '_' in PureBasic.
There is a Win32.hlp (~ 8 megs) file that can be downloaded from the Internet that is available from:
http://www.borland.com/devsupport/delphi/downloads/
(It's located at the bottom of a *very* long page of downloads)
Download this file, unzip it and place it in:
c:\PUREBASIC\Help
After this simply place your cursor on the GetSystemMetrics word and press the 'F1' (Help) key. The Win API help for that function will be displayed.
Hope that helps,
--Bob
Ricardo...I'm not sure what you mean.
All the WinAPI calls are available as a help file that works with PB.
e.g.
Code: Select all
Procedure.l ScreenWidth ()
ProcedureReturn GetSystemMetrics_(#SM_CYSCREEN)
EndProcedure
Note that you must use the '_' in PureBasic.
There is a Win32.hlp (~ 8 megs) file that can be downloaded from the Internet that is available from:
http://www.borland.com/devsupport/delphi/downloads/
(It's located at the bottom of a *very* long page of downloads)
Download this file, unzip it and place it in:
c:\PUREBASIC\Help
After this simply place your cursor on the GetSystemMetrics word and press the 'F1' (Help) key. The Win API help for that function will be displayed.
Hope that helps,
--Bob
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Yes Bob, i know it and it did have this Win32, but maybe some of us don't know exactly how to use every API CALL, thats my point, when some of us learn how to use some specific API we can share this to others.
One example is the RichEdit Example that i made.
Other example:
And one question:
This fails because i need to send the address of SECURITY_ATTRIBUTES structure that are declared at win32,inc. How can i get the address of this structure?
I know where to find the code, im looking for the address in memory:
Thanks
Yes Bob, i know it and it did have this Win32, but maybe some of us don't know exactly how to use every API CALL, thats my point, when some of us learn how to use some specific API we can share this to others.
One example is the RichEdit Example that i made.
Other example:
Code: Select all
;This example GET/SET the priority
;read your WIN32.HELP for more info
hProcess = GetCurrentProcess_()
ret = GetPriorityClass_(hProcess)
MessageRequester("GetPriority",Str(ret),0)
SetPriorityClass_(hProcess, #REALTIME_PRIORITY_CLASS)
ret = GetPriorityClass_(hProcess)
MessageRequester("NewPriority",Str(ret),0)
And one question:
This fails because i need to send the address of SECURITY_ATTRIBUTES structure that are declared at win32,inc. How can i get the address of this structure?
I know where to find the code, im looking for the address in memory:
Code: Select all
Dim security.SECURITY_ATTRIBUTES(1)
Chwn = CreateConsoleScreenBuffer_(#GENERIC_READ,#FILE_SHARE_READ,SECURITY_ATTRIBUTES,#CONSOLE_TEXTMODE_BUFFER,0)
messagerequester("",str(Chwn),0); gives -1
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
API CALLS
Restored from previous forum. Originally posted by ricardo.
EDIT MULTILINE:
Tthos code will create a Edit with Multiline attribute
In the other hand, im trying to change the attributes of the StringGadget with this lines, but something dosent works:
Any idea?
Regards,
Ricardo
EDIT MULTILINE:
Tthos code will create a Edit with Multiline attribute
Code: Select all
class$ = "Class1" ;this is the class of the PB forms
exe$ = "app" ;the name of your application
result = FindWindow_(class$,exe$)
hwn = CreateWindowEx_(#WS_EX_CLIENTEDGE ,"edit","EditMultile Example",#WS_CHILD | #WS_VISIBLE | #ES_MULTILINE |#ES_AUTOHSCROLL,40,40,200,250,result,1,0,0)
;------------------------------------------------------------------------------
Code: Select all
clase$ = "Edit"
name$ = "edit"
RESULTADO = FindWindowEx_(RESULTADO,0,clase$,name$)
CURSTYLE = GetWindowLong_(RESULTADO,#GWL_STYLE)
CURSTYLE = CURSTYLE|#WS_CHILD | #WS_VISIBLE | #ES_MULTILINE|#ES_AUTOHSCROL
SetWindowLong_(RESULTADO,#GWL_STYLE,CURSTYLE)
Regards,
Ricardo
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Sorry, i miss some lines in the code, but this is not why the example dosent works. Here is complete
Any idea?
Regards,
Ricardo
Sorry, i miss some lines in the code, but this is not why the example dosent works. Here is complete
Code: Select all
class$ = "Class1" ;this is the class of the PB forms
exe$ = "app" ;the name of your application
result = FindWindow_(class$,exe$)
clase$ = "Edit" ;Edit class
name$ = "edit" ;name of the gadget
RESULTADO = FindWindowEx_(result,0,clase$,name$)
CURSTYLE = GetWindowLong_(RESULTADO,#GWL_STYLE)
CURSTYLE = CURSTYLE|#WS_CHILD | #WS_VISIBLE | #ES_MULTILINE|#ES_AUTOHSCROL
SetWindowLong_(RESULTADO,#GWL_STYLE,CURSTYLE)
Regards,
Ricardo
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by blueb.
Ricardo,
The WinAPI call FindWindow requires that use use pointers to get the resulting handle to the window.
Therefore:
Ricardo,
The WinAPI call FindWindow requires that use use pointers to get the resulting handle to the window.
Therefore:
Code: Select all
class.s = "Class1" ;this is the class of the PB forms
exe.s = "IconTray.exe" ;the name of your application
result = FindWindow_(*class,*exe)
;NOTE: The parameters above MUST be string pointers.
MessageRequester("Handle of Window", str(result), 0) ; I used an actual file name here to be sure I got a good result.
clase.s = "Edit" ; Edit class
name.s = "edit" ;name of the gadget
RESULTADO = FindWindowEx_( result, 0, *clase, *name)
MessageRequester("Handle of Window", str(RESULTADO), 0) ;Since the gadget 'name' is not specific....expect a ZERO resultado
CURSTYLE = GetWindowLong_(RESULTADO, #GWL_STYLE)
CURSTYLE = CURSTYLE & #WS_CHILD | #WS_VISIBLE | #ES_MULTILINE | #ES_AUTOHSCROLL
SetWindowLong_(RESULTADO, #GWL_STYLE, CURSTYLE )
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Hi, Bob !!
Did it works in that way? im gonna test it Bob,
its a little strange, because i use FindWindow and FindWindowEx with succes so many times (in PureBasic) just with variables, no pointers.
Per example, you can use it to move, resize, hide,etc any control (gadget) during moving time with out pointers.
Good work my friend : )
Ricardo Arias
Hi, Bob !!
Did it works in that way? im gonna test it Bob,
its a little strange, because i use FindWindow and FindWindowEx with succes so many times (in PureBasic) just with variables, no pointers.
Per example, you can use it to move, resize, hide,etc any control (gadget) during moving time with out pointers.
Good work my friend : )
Ricardo Arias
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Hi Friend : )
Well, i think that we are usiing some pointer when we write
class$ = "Edit"
then Class$ is a pointer to a NULL terminated string, its exactly the same to write
*class$ = "Edit"
I have tested with the * addittion and it dont works.
Im trying to change the attributes of the StrinGadget to make it multiline capable... if soem one can help us
Thanks Bob !!
Ricardo Arias
Hi Friend : )
Well, i think that we are usiing some pointer when we write
class$ = "Edit"
then Class$ is a pointer to a NULL terminated string, its exactly the same to write
*class$ = "Edit"
I have tested with the * addittion and it dont works.
Im trying to change the attributes of the StrinGadget to make it multiline capable... if soem one can help us
Thanks Bob !!
Ricardo Arias
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Mr.Skunk.
Try this :
class$ = "Edit"
and then to modify
pokes(@class$,"the new string")
Hope it helps
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
Try this :
class$ = "Edit"
and then to modify
pokes(@class$,"the new string")
Hope it helps
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Hi folks,
here you can download a Win API reference (specially for VB)
http://www.vbapi.com/apiguide.zip
There is no SEARCH function in this forum,
so I can't say if somebody mentioned it before.
API calls for Win2000 are included.
Hope this is helpful.
Have a nice day...
Franco
Hi folks,
here you can download a Win API reference (specially for VB)
http://www.vbapi.com/apiguide.zip
There is no SEARCH function in this forum,
so I can't say if somebody mentioned it before.
API calls for Win2000 are included.
Hope this is helpful.
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Mr.Skunk.
HI
there is a search in that forum, look at the top of the page (just before FAQ)
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
HI
there is a search in that forum, look at the top of the page (just before FAQ)
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm