Skip to main content

[archive] Changing Cursors

  • November 21, 2007
  • 14 replies
  • 0 views

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.

14 replies

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
HINSTANCE is the handle to the current process. E.g. if you were calling this from ACUCOBOL-GT it would be the handle of the particular instance of ACUCOBOL-GT.
You may get it by:
hInst = GetModuleHandle("C:\\MyDirectory\\Wrun32.exe");

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
HINSTANCE is the handle to the current process. E.g. if you were calling this from ACUCOBOL-GT it would be the handle of the particular instance of ACUCOBOL-GT.
You may get it by:
hInst = GetModuleHandle("C:\\MyDirectory\\Wrun32.exe");

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thanks for the info.
I tried your suggestion with the attached code but did not succeed.
I am just starting to use the windows dlls so it is probably something basic.

I get the following error
GetModuleHandle: Program Missing or Inaccessible

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thanks for the info.
I tried your suggestion with the attached code but did not succeed.
I am just starting to use the windows dlls so it is probably something basic.

I get the following error
GetModuleHandle: Program Missing or Inaccessible

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Two suggestions:
Since GetModuleHandle is using a string, it appears in two versions, this fact is hidden for developers in Microsoft documentation. So, you have to suffix with the 'A' to indicate you want to use the ANSI version:CALL "GetModuleHandleA" USING ...
Second suggestion, I would use PIC X(4) COMP-N rather than PIC 9(9) COMP-5, while the latter will truncate any number larger than 9 digits unless you compile with the -truncANSI switch.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Two suggestions:
Since GetModuleHandle is using a string, it appears in two versions, this fact is hidden for developers in Microsoft documentation. So, you have to suffix with the 'A' to indicate you want to use the ANSI version:CALL "GetModuleHandleA" USING ...
Second suggestion, I would use PIC X(4) COMP-N rather than PIC 9(9) COMP-5, while the latter will truncate any number larger than 9 digits unless you compile with the -truncANSI switch.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Two suggestions:
Since GetModuleHandle is using a string, it appears in two versions, this fact is hidden for developers in Microsoft documentation. So, you have to suffix with the 'A' to indicate you want to use the ANSI version:CALL "GetModuleHandleA" USING ...
Second suggestion, I would use PIC X(4) COMP-N rather than PIC 9(9) COMP-5, while the latter will truncate any number larger than 9 digits unless you compile with the -truncANSI switch.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thank you, the "A" at the end worked. I am slowly making progress.
I have a further question as to w$mouse and the data group MOUSE-INFO.

In the def file MOUSE-INFO has mouse-row-ex, mouse-col-ex, mouse-row-pixel and mouse-col-pixel. I have not been able to find if these contain values returned by w$mouse, and if they are what are they?

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thank you, the "A" at the end worked. I am slowly making progress.
I have a further question as to w$mouse and the data group MOUSE-INFO.

In the def file MOUSE-INFO has mouse-row-ex, mouse-col-ex, mouse-row-pixel and mouse-col-pixel. I have not been able to find if these contain values returned by w$mouse, and if they are what are they?

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
The *-pixel values does that, return the pixel value. The *-ex values are offsets adjusted to the cell height of the current font of the window. While the * value is returning the character position.
In some cases, the character position has turned out to be less accurate for positioning, therefore the *-ex values were introduced. You may ask why both pixel and ex values, the answer is in that the pixel coordinate is perhaps too accurate in many contextes and not at least, it is more difficult to calculate.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
The *-pixel values does that, return the pixel value. The *-ex values are offsets adjusted to the cell height of the current font of the window. While the * value is returning the character position.
In some cases, the character position has turned out to be less accurate for positioning, therefore the *-ex values were introduced. You may ask why both pixel and ex values, the answer is in that the pixel coordinate is perhaps too accurate in many contextes and not at least, it is more difficult to calculate.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thank you gforseth for all the help so far.
I have made a reasonable amount of progress but have now hit upon a stumbling block.
How do I position a mouse using w$mouse and SET-MOUSE-POSITION if I only have the MOUSE-ROW-EX and MOUSE-COL-EX values, ie I do not have the equivalent MOUSE-ROW and MOUSE-ROW-PIXELS values.

It seems that w$mouse only recognizes the MOUSE-ROW, MOUSE-COL when positioning the mouse.

I am trying to inhibit the mouse movement to a rectangle when the left-button is down by setting the row-ex and col-ex and the using SET-MOUSE-POSITION.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thank you gforseth for all the help so far.
I have made a reasonable amount of progress but have now hit upon a stumbling block.
How do I position a mouse using w$mouse and SET-MOUSE-POSITION if I only have the MOUSE-ROW-EX and MOUSE-COL-EX values, ie I do not have the equivalent MOUSE-ROW and MOUSE-ROW-PIXELS values.

It seems that w$mouse only recognizes the MOUSE-ROW, MOUSE-COL when positioning the mouse.

I am trying to inhibit the mouse movement to a rectangle when the left-button is down by setting the row-ex and col-ex and the using SET-MOUSE-POSITION.

[Migrated content. Thread originally posted on 21 November 2007]

I am trying to use 'createcursor' and have found from MSDN that the following is required:

HCURSOR CreateCursor(
HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
const VOID *pvANDPlane,
const VOID *pvXORPlane
);
Parameters

hInst
[in] Handle to the current instance of the application creating the cursor.
...

Does anyone know how to get the value of the 'current instance', and what is the data type?

I have found a zipfile called splitter.zip on this forum that was supposed to show how the change the cursor shapes depending on the cursor position, but this does not seem to work. However it seems to give an indication as to what the other parameters are.

Any help would be greatly appreciated.
Thank you gforseth for all the help so far.
I have made a reasonable amount of progress but have now hit upon a stumbling block.
How do I position a mouse using w$mouse and SET-MOUSE-POSITION if I only have the MOUSE-ROW-EX and MOUSE-COL-EX values, ie I do not have the equivalent MOUSE-ROW and MOUSE-ROW-PIXELS values.

It seems that w$mouse only recognizes the MOUSE-ROW, MOUSE-COL when positioning the mouse.

I am trying to inhibit the mouse movement to a rectangle when the left-button is down by setting the row-ex and col-ex and the using SET-MOUSE-POSITION.