Highlighted
Absent Member.
Absent Member.
328 views

[archive] Changing Cursors

[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.
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Changing Cursors

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");
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Changing Cursors

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
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Changing Cursors

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Changing Cursors

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?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Changing Cursors

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Changing Cursors

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.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.