Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #3533 > unrolled thread
| Started by | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| First post | 2012-05-31 08:46 +0000 |
| Last post | 2012-06-04 07:22 +0000 |
| Articles | 8 — 2 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Function _WINCALL and CALLBACK "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2012-05-31 08:46 +0000
Re: Function _WINCALL and CALLBACK "Valery N." <mustangsoftcom@gmail.com> - 2012-05-31 05:30 -0700
Re: Function _WINCALL and CALLBACK "Valery N." <mustangsoftcom@gmail.com> - 2012-05-31 05:50 -0700
Re: Function _WINCALL and CALLBACK "Valery N." <mustangsoftcom@gmail.com> - 2012-05-31 05:28 -0700
Re: Function _WINCALL and CALLBACK "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2012-06-01 07:30 +0000
Re: Function _WINCALL and CALLBACK "Valery N." <mustangsoftcom@gmail.com> - 2012-06-01 03:00 -0700
Re: Function _WINCALL and CALLBACK "Valery N." <mustangsoftcom@gmail.com> - 2012-06-01 03:09 -0700
Re: Function _WINCALL and CALLBACK "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2012-06-04 07:22 +0000
| From | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| Date | 2012-05-31 08:46 +0000 |
| Subject | Function _WINCALL and CALLBACK |
| Message-ID | <jq7b5o$dhe$1@dont-email.me> |
Hi Everybody, Is there someone who could explain to me what the difference is between FUNCTION xxx() AS VOID FUNCTION yyy() AS VOID CALLBACK FUNCTION zzz() AS VOID _WINCALL When do we need to use these extra 'words' ? Thanks for any response. Dirk --
[toc] | [next] | [standalone]
| From | "Valery N." <mustangsoftcom@gmail.com> |
|---|---|
| Date | 2012-05-31 05:30 -0700 |
| Message-ID | <05d85a5c-d7ee-4560-a5ed-9d8b8f410b3a@n33g2000vbi.googlegroups.com> |
| In reply to | #3533 |
On 31 май, 11:46, "Dirk (Belgium)" <dirk.dot.herijg...@pbprojects.dot.be> wrote: > Hi Everybody, > > Is there someone who could explain to me what the difference is between > > FUNCTION xxx() AS VOID > FUNCTION yyy() AS VOID CALLBACK > FUNCTION zzz() AS VOID _WINCALL > > When do we need to use these extra 'words' ? > > Thanks for any response. > > Dirk > > -- FUNCTION xxx() AS VOID => Function returns nothing. I.e., RETURN. Actually, function works as procedure. In CA-Vo it is recommended to use procedures instead of such functions. FUNCTION yyy() AS VOID CALLBACK http://www.firststeps.ru/mfc/winapi/r.php?55 Normally such functions are called as callback functions. It is simple. If Windows cause your function, you shall specify it parameter passing type as to CALLBACK. This type of a call is described in WinDef.H as: #define CALLBACK __ stdcall That is, parameter passing type - PASCAL. The normal call of functions is carried out in WIN32 API style. How Windows learns, what this function can be executed? You (knowing it or not) transfer it in parameters. If you create a window in Win32, transfer window function. Windows causes this function, when controls a window. All is simple. Told to system that if it is necessary to address to a window - here to you function. After that Windows knows that if it is necessary to draw again a window, it will cause this function and transfers to it in the WM_PAINT parameters. Idea quite simple. The operating system shall be able to cause some functions in application to release you as the programmer from tracking the program. Who wrote for DOS – knows, how it is inconvenient to think of what window is visible on the screen and what isn't present. Let the operating system cares. So, in any program for Windows (by the way, and not only in understanding of the graphic interface) there are functions which will be caused by an operating system. As example principal function of a window. This function shall be correctly issued in the program, namely CALLBACK. Normally we transfer it in the form of parameters by a call of the WIN32 API functions. We look the file of the help of CA-Vo (Function statement): CALLBACK calling convention: To specify this calling convention, use CALLBACK as the last keyword in the FUNCTION declaration statement. This is a special PASCAL calling convention with Windows prologue and epilogue. It is used for low-level interfacing with Windows. I hope, it will help you. :) Valery.
[toc] | [prev] | [next] | [standalone]
| From | "Valery N." <mustangsoftcom@gmail.com> |
|---|---|
| Date | 2012-05-31 05:50 -0700 |
| Message-ID | <4d1e5202-409e-4585-b556-a84db268b8d5@q2g2000vbv.googlegroups.com> |
| In reply to | #3537 |
Both CALLBACK, and WINAPI set the correct agreements on a call
(calling convention) for function. Both macroes reveal in __ stdcall
so the basic difference in between isn't present. Traditionally WINAPI
is used with "direct call" functions, such as the Win32 API functions,
and CALLBACK — with functions of "callback" (callback functions), for
example, window and dialogue procedures.
AS LONG _WINCALL
Value of a call of Window-procedure. Example from Geoff Schaller:
FUNCTION GCSComboBoxWindowProc(hWnd AS PTR,dwMessage AS DWORD,wParam
AS
DWORD,lParam AS LONG) AS LONG _WINCALL
LOCAL hBackgroundComboBoxBrush AS PTR
LOCAL hDCLB AS PTR
LOCAL oControl AS GCSComboBox
LOCAL oGlobal AS GCSGlobalObjectBase
oControl := GetObjectByHandle(hWnd)
oGlobal := GetGlobal()
DO CASE
CASE oControl = NULL_OBJECT
RETURN 0L
CASE dwMessage == WM_LBUTTONDBLCLK
IF oControl:ReadOnly
// DebugOutput("Disable button click")
// disable when in READONLY mode
RETURN 0L
ENDIF
CASE dwMessage == WM_LBUTTONDOWN
IF oControl:ReadOnly
// DebugOutput("Disable button double click")
// disable when in READONLY mode
RETURN 0L
ENDIF
CASE dwMessage==WM_CTLCOLORLISTBOX
hDCLB := PTR(_CAST,wParam)
SetTextColor(hDCLB, oGlobal:sle_editcolour:ColorRef)
SetBkColor(hDCLB, oGlobal:sle_editbrushc:ColorRef)
IF hBackgroundComboBoxBrush == NULL_PTR
hBackgroundComboBoxBrush :=
CreateSolidBrush(oGlobal:sle_editbrushc:ColorRef)
END
RETURN LONG(_CAST,hBackgroundComboBoxBrush)
ENDCASE
RETURN
CallWindowProc(oControl:lpfnDefaultProc,hWnd,dwMessage,wParam,lParam)
[toc] | [prev] | [next] | [standalone]
| From | "Valery N." <mustangsoftcom@gmail.com> |
|---|---|
| Date | 2012-05-31 05:28 -0700 |
| Message-ID | <c539450c-660b-4dcf-abb0-66cdfe807452@l5g2000vbo.googlegroups.com> |
| In reply to | #3533 |
On 31 май, 11:46, "Dirk (Belgium)" <dirk.dot.herijg...@pbprojects.dot.be> wrote: > Hi Everybody, > > Is there someone who could explain to me what the difference is between > > FUNCTION xxx() AS VOID > FUNCTION yyy() AS VOID CALLBACK > FUNCTION zzz() AS VOID _WINCALL > > When do we need to use these extra 'words' ? > > Thanks for any response. > > Dirk > > -- FUNCTION xxx() AS VOID => Function returns nothing. I.e., RETURN. Actually, function works as procedure. In CA-Vo it is recommended to use procedures instead of such functions. FUNCTION yyy() AS VOID CALLBACK http://www.firststeps.ru/mfc/winapi/r.php?55 Normally such functions are called as callback functions. It is simple. If Windows cause your function, you shall specify it parameter passing type as to CALLBACK. This type of a call is described in WinDef.H as: #define CALLBACK __ stdcall That is, parameter passing type - PASCAL. The normal call of functions is carried out in WIN32 API style. How Windows learns, what this function can be executed? You (knowing it or not) transfer it in parameters. If you create a window in Win32, transfer window function. Windows causes this function, when controls a window. All is simple. Told to system that if it is necessary to address to a window - here to you function. After that Windows knows that if it is necessary to draw again a window, it will cause this function and transfers to it in the WM_PAINT parameters. Idea quite simple. The operating system shall be able to cause some functions in application to release you as the programmer from tracking the program. Who wrote for DOS – knows, how it is inconvenient to think of what window is visible on the screen and what isn't present. Let the operating system cares. So, in any program for Windows (by the way, and not only in understanding of the graphic interface) there are functions which will be caused by an operating system. As example principal function of a window. This function shall be correctly issued in the program, namely CALLBACK. Normally we transfer it in the form of parameters by a call of the WIN32 API functions. We look the file of the help of CA-Vo (Function statement): CALLBACK calling convention: To specify this calling convention, use CALLBACK as the last keyword in the FUNCTION declaration statement. This is a special PASCAL calling convention with Windows prologue and epilogue. It is used for low-level interfacing with Windows. I hope, it will help you. :) Valery.
[toc] | [prev] | [next] | [standalone]
| From | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| Date | 2012-06-01 07:30 +0000 |
| Message-ID | <jq9r2f$bot$1@dont-email.me> |
| In reply to | #3538 |
Hi Valery, a) Do you say that there is no difference between CALLBACK and _WINCALL? b) Is there a difference between FUCNTION aaa() AS VOID PASCAL FUNCTION bbb() AS VOID PASCAL CALLBACK (see following link:à http://www.codeguru.com/cpp/cpp/cpp_mfc/callbacks/article.php/c10557/Cal lback-Functions-Tutorial.htm c) How do you know this things? Have you experience with the differences? Thanks for your answners, Dirk ======================== Valery N. wrote: > On 31 май, 11:46, "Dirk (Belgium)" > <dirk.dot.herijg...@pbprojects.dot.be> wrote: > > Hi Everybody, > > > > Is there someone who could explain to me what the difference is > > between > > > > FUNCTION xxx() AS VOID > > FUNCTION yyy() AS VOID CALLBACK > > FUNCTION zzz() AS VOID _WINCALL > > > > When do we need to use these extra 'words' ? > > > > Thanks for any response. > > > > Dirk > > > > -- > > FUNCTION xxx() AS VOID > => Function returns nothing. I.e., RETURN. > Actually, function works as procedure. In CA-Vo it is recommended to > use procedures instead of such functions. > > FUNCTION yyy() AS VOID CALLBACK > > http://www.firststeps.ru/mfc/winapi/r.php?55 > Normally such functions are called as callback functions. It is > simple. If Windows cause your function, you shall specify it parameter > passing type as to CALLBACK. This type of a call is described in > WinDef.H as: > #define CALLBACK __ stdcall > > That is, parameter passing type - PASCAL. The normal call of functions > is carried out in WIN32 API style. How Windows learns, what this > function can be executed? You (knowing it or not) transfer it in > parameters. If you create a window in Win32, transfer window function. > Windows causes this function, when controls a window. All is simple. > Told to system that if it is necessary to address to a window - here > to you function. After that Windows knows that if it is necessary to > draw again a window, it will cause this function and transfers to it > in the WM_PAINT parameters. Idea quite simple. The operating system > shall be able to cause some functions in application to release you as > the programmer from tracking the program. Who wrote for DOS – knows, > how it is inconvenient to think of what window is visible on the > screen and what isn't present. Let the operating system cares. So, in > any program for Windows (by the way, and not only in understanding of > the graphic interface) there are functions which will be caused by an > operating system. As example principal function of a window. This > function shall be correctly issued in the program, namely CALLBACK. > Normally we transfer it in the form of parameters by a call of the > WIN32 API functions. > > We look the file of the help of CA-Vo (Function statement): > CALLBACK calling convention: To specify this calling convention, use > CALLBACK as the last keyword in the FUNCTION declaration statement. > This is a special PASCAL calling convention with Windows prologue and > epilogue. It is used for low-level interfacing with Windows. > > I hope, it will help you. :) > > Valery. --
[toc] | [prev] | [next] | [standalone]
| From | "Valery N." <mustangsoftcom@gmail.com> |
|---|---|
| Date | 2012-06-01 03:00 -0700 |
| Message-ID | <17e6642a-4f22-4342-bd50-d7174a632a59@w24g2000vby.googlegroups.com> |
| In reply to | #3547 |
Hi Dirk! > a) Do you say that there is no difference between CALLBACK and _WINCALL? No, I didn't tell it. Look attentively. It was told about CALLBACK and WINAPI. I told about _WINCALL another, and gave an example. We read the file of the help of CA-Vo (FUNCTION Statement): PASCAL calling convention: To specify this calling convention, use PASCAL as the last keyword in the FUNCTION declaration statement. Syntactically, the PASCAL calling convention is identical to STRICT and the usage restrictions are the same, but internally it is handled differently. It is identical to the Microsoft Pascal calling convention, and its primary use is for low-level interfacing with Windows. CALLBACK calling convention: To specify this calling convention, use CALLBACK as the last keyword in the FUNCTION declaration statement. This is a special PASCAL calling convention with Windows prologue and epilogue. It is used for low-level interfacing with Windows. > b) Is there a difference between > FUCNTION aaa() AS VOID PASCAL > FUNCTION bbb() AS VOID PASCAL CALLBACK > (see following link:àhttp://www.codeguru.com/cpp/cpp/cpp_mfc/callbacks/article.php/c10557/Cal > lback-Functions-Tutorial.htm Generally, let's be defined: we assort syntax of CA-Vo or With ++? If, CA-Vo 28, is enough to make pair of examples: Example #1 Not correctly: //FUNCTION test() AS VOID PASCAL //RETURN Correctly: PROCEDURE test() RETURN Example #2 Not correctly: //FUNCTION test2() AS VOID PASCAL CALLBACK //RETURN Correctly: FUNCTION test2() AS INT CALLBACK RETURN 0L For CA-Vo 28 instead of "function xxx() as void pascal" it is necessary to use "procedure xxx()". If you write CALLBACK, it already means PASCAL. Therefore to write PASCAL CALLBACK it is not necessary. Enough CALLBACK. > c) How do you know this things? Have you experience with the > differences? From where I know? I read, I check, I experiment. I use third-party DLL in the operations (http://www.mustang-soft.com/ru/node/54 forgive, article while only in Russian). Good Luck! Valery.
[toc] | [prev] | [next] | [standalone]
| From | "Valery N." <mustangsoftcom@gmail.com> |
|---|---|
| Date | 2012-06-01 03:09 -0700 |
| Message-ID | <848ab7ba-5a68-4bcc-aaa2-bce2c18a5820@m3g2000vbl.googlegroups.com> |
| In reply to | #3547 |
Hi Dirk! > a) Do you say that there is no difference between CALLBACK and _WINCALL? No, I didn't tell it. WINAPI and _WINCALL - this one and too? > b) Is there a difference between > FUCNTION aaa() AS VOID PASCAL > FUNCTION bbb() AS VOID PASCAL CALLBACK > (see following link:àhttp://www.codeguru.com/cpp/cpp/cpp_mfc/callbacks/article.php/c10557/Cal > lback-Functions-Tutorial.htm Generally, let's be defined: we assort syntax of CA-Vo or C++? We read the file of the help of CA-Vo (FUNCTION Statement): PASCAL calling convention: To specify this calling convention, use PASCAL as the last keyword in the FUNCTION declaration statement. Syntactically, the PASCAL calling convention is identical to STRICT and the usage restrictions are the same, but internally it is handled differently. It is identical to the Microsoft Pascal calling convention, and its primary use is for low-level interfacing with Windows. CALLBACK calling convention: To specify this calling convention, use CALLBACK as the last keyword in the FUNCTION declaration statement. This is a special PASCAL calling convention with Windows prologue and epilogue. It is used for low-level interfacing with Windows. If, CA-Vo 28, is enough to make pair of examples: Example #1 Not correctly: //FUNCTION test() AS VOID PASCAL //RETURN Correctly: PROCEDURE test() RETURN Example #2 Not correctly: //FUNCTION test2() AS VOID PASCAL CALLBACK //RETURN Correctly: FUNCTION test2() AS INT CALLBACK RETURN 0L For CA-Vo 28 instead of "function xxx() as void pascal" it is necessary to use "procedure xxx()". If you write CALLBACK, it already means PASCAL. Therefore to write PASCAL CALLBACK it is not necessary. Enough CALLBACK. > c) How do you know this things? Have you experience with the > differences? From where I know? I read, I check, I experiment. I use third-party DLL in the operations (http://www.mustang-soft.com/ru/node/54 forgive, article while only in Russian). Good Luck! Valery.
[toc] | [prev] | [next] | [standalone]
| From | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| Date | 2012-06-04 07:22 +0000 |
| Message-ID | <jqhnnl$qh$1@dont-email.me> |
| In reply to | #3549 |
Hi Valery, Thanks for all your replys. I will experient a little bit, and hope the problems went away. Dirk ==== Valery N. wrote: > Hi Dirk! > > > a) Do you say that there is no difference between CALLBACK and > > _WINCALL? > > No, I didn't tell it. WINAPI and _WINCALL - this one and too? > > > b) Is there a difference between > > FUCNTION aaa() AS VOID PASCAL > > FUNCTION bbb() AS VOID PASCAL CALLBACK > > (see following > > link:àhttp://www.codeguru.com/cpp/cpp/cpp_mfc/callbacks/article.php/ > > c10557/Cal lback-Functions-Tutorial.htm > > Generally, let's be defined: we assort syntax of CA-Vo or C++? > > We read the file of the help of CA-Vo (FUNCTION Statement): > > PASCAL calling convention: To specify this calling convention, use > PASCAL as the last keyword in the FUNCTION declaration statement. > Syntactically, the PASCAL calling convention is identical to STRICT > and the usage restrictions are the same, but internally it is handled > differently. It is identical to the Microsoft Pascal calling > convention, and its primary use is for low-level interfacing with > Windows. > > CALLBACK calling convention: To specify this calling convention, use > CALLBACK as the last keyword in the FUNCTION declaration statement. > This is a special PASCAL calling convention with Windows prologue and > epilogue. It is used for low-level interfacing with Windows. > > If, CA-Vo 28, is enough to make pair of examples: > > Example #1 > > Not correctly: > //FUNCTION test() AS VOID PASCAL > //RETURN > > Correctly: > PROCEDURE test() > RETURN > > > Example #2 > > Not correctly: > //FUNCTION test2() AS VOID PASCAL CALLBACK > //RETURN > > Correctly: > FUNCTION test2() AS INT CALLBACK > RETURN 0L > > For CA-Vo 28 instead of "function xxx() as void pascal" it is > necessary to use "procedure xxx()". > If you write CALLBACK, it already means PASCAL. Therefore to write > PASCAL CALLBACK it is not necessary. Enough CALLBACK. > > > c) How do you know this things? Have you experience with the > > differences? > > From where I know? I read, I check, I experiment. I use third-party > DLL in the operations (http://www.mustang-soft.com/ru/node/54 forgive, > article while only in Russian). > > Good Luck! > > Valery. --
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web