|
Thank you DavidCrow!
I have followed your suggestion and I have solved all the problems except what means far and near. For example, in the following code segment of windef.h.
<br />
#define far<br />
#define near<br />
#if (!defined(_MAC)) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))<br />
#define pascal __stdcall<br />
#else<br />
#define pascal<br />
#endif<br />
Can you help please?
regards,
George
|
|
|
|
|
George_George wrote: ...what means far and near.
With 16-bit Windows and its segmented memory model, you had 16-bit near pointers and 32-bit far pointers. A far reference refers to a function or data object (or a pointer to a function or data object) that is in a different segment than the current one. Memory was referenced like:
segment:offset
Accessing code or data with a near reference is much quicker than accessing it with a far reference. When you use a far reference, your program must first find the segment and then find the code or data within that segment. When you use a near reference, your program only needs to find the code or data.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
In nowadays, whether memory is still working in the same way?
regards,
George
|
|
|
|
|
16-bit Windows will always behave in this fashion. 32-bit Windows does not. It uses a simple, 32-bit address.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
I think in nowadays, there is no 16-bit Windows. Right?
regards,
George
|
|
|
|
|
George_George wrote: I think in nowadays, there is no 16-bit Windows. Right?
How could I possibly know? Whether something exists and whether it is used are two different things.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
A good answer!
regards,
George
|
|
|
|
|
|
Hi Sarath,
The link describes something like __stdcall. There is no information about FARPROC.
regards,
George
|
|
|
|
|
It is a typedef that, when you boil down all the macros, expands to the following:
typedef int (__stdcall* FARPROC)();
In other words, any function with the following signature could be pointed to by a FARPROC pointer:
int __stdcall f();
To make it portable, you would just remove the __stdcall part of the line. For example, if you want it to work in Linux, define CALLBACK as nothing:
#ifndef CALLBACK<br />
#define CALLBACK<br />
#endif // CALLBACK
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi Zac,
Excellent!
regards,
George
|
|
|
|
|
Hi Zac,
I have found some new question about FARPROC. I found that in the definition in windef.h, FARPROC is dealing with a macro called far/near, for example, the following code segment,
<br />
#define far<br />
#define near<br />
#if (!defined(_MAC)) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))<br />
#define pascal __stdcall<br />
#else<br />
#define pascal<br />
#endif<br />
Do you know what means far and near?
regards,
George
|
|
|
|
|
In Win32, FAR and NEAR are defined as nothing. In Win16, they were used to define the type of pointer (that is, where the pointer was in memory).
In other words, the following declarations are the same in Win32:
int FAR * myInt;<br />
int NEAR * myInt;<br />
int* myInt;
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thank you Zac,
What do you mean "where the pointer was in memory"?
regards,
George
|
|
|
|
|
Back in the Win16 days, the hardware was 32-bits, but the OS was written for 16-bits. Thus, the actual area of memory you could address with a typical pointer was addressed in 16-bit address space. The OS simulated 32-bit pointers by using NEAR and FAR to specify whether it was in the lower or upper realm of memory. (In a nutshell). Neither of them have any meaning in portable code nor in Win32.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Cool, Zac!
You have answered my question.
regards,
George
|
|
|
|
|
Hi all
Now I want to lock the mouse in a dialog box. ClipCursor(&rect) is used in CMyDialog::InitialDialog(), and the mouse is locked in the dialog. However, if I move the dialog with dragging the title bar, the mouse is not locked this time. So I think WM_MOVE should be responsed, and ClipCursor is used again in CMyDialog::OnMove(), however, mouse is locked after moving in debug mode, but when I run the program free, the mouse is free as before, why is this? Should I set capture in the dialog?
CMyDialog::InitialDialog()
{
......
GetWindowRect(&rect);
ClipCursor(&rect);
}
CMyDialog::OnMove()
{
......
GetWindowRect(&rect);
ClipCursor(&rect);
}
|
|
|
|
|
zouchao1112 wrote: Now I want to lock the mouse in a dialog box.
Why not use SetCapture() ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
SetCapture( ):
Causes all subsequent mouse input to be sent to the current CWnd object regardless of the position of the cursor.
From MSDN
It only captures the input of mouse, but do not confine the mouse move
|
|
|
|
|
|
|
Hi all,
i need help about a problem:
i wanted to chance the dialog style of SHBrowseForFolder, i need to use BIF_NEWDIALOG STYLE. The right shlobj.h file that allow me to use BIF_NEWDIALOG STYLE is in the platform sdk. So i have to use that file and add it in my project but i can't overwrite the old one placed in v98 directory. How can i do this?
I hope someone can help me....
thanks in advance
vasmvr
|
|
|
|
|
Change your include path to look in C:\Program Files\Microsoft SDK\include first.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
thanks for your prompt answer but i can't do that, i need other way to do that...
I hope it exist
|
|
|
|
|