Page 1 of 1
CONTEXT MENU on wrong Monitor
Posted: Mon Aug 30, 2021 6:52 am
by AUGE_OHR
hi,
i do have 2nd Monitor on "Left" Side so X Value become NEGATIVE
when run App on "Left" Side and call
it will display on "Right" Monitor
Question : can CONTEXT MENU have negative Value ?
---
as Popup Menu display at "GetCursorPos" i try to find it in Source ...
is that the Code to "Pop-Up" at Cursor Position

Re: CONTEXT MENU on wrong Monitor
Posted: Mon Aug 30, 2021 3:05 pm
by andyglezl
Re: CONTEXT MENU on wrong Monitor
Posted: Mon Aug 30, 2021 11:35 pm
by AUGE_OHR
Hi,
thx for Answer.
i have used "IN WINDOW" so App work correct on 2nd Monitor with NEGATIVE Value
but i don´t "see" how to "manipulate" Position of CONTEXT MENU when it "Pop-Up"
---
i got in c:\hmg.3.4.4\SOURCE\c_windows.c
Code: Select all
HB_FUNC ( GETCURSORROW )
{
POINT pt;
GetCursorPos( &pt );
hb_retni( pt.y );
}
Code: Select all
HB_FUNC ( GETCURSORCOL )
{
POINT pt;
GetCursorPos( &pt );
hb_retni( pt.x );
}
but it is different in GETCURSORPOS
Code: Select all
HB_FUNC ( GETCURSORPOS )
{
POINT pt;
GetCursorPos( &pt );
if (HB_ISBYREF(1))
hb_stornl ((LONG) pt.x, 1);
if (HB_ISBYREF(2))
hb_stornl ((LONG) pt.y, 2);
hb_reta( 2 );
hb_storvni( pt.y, -1, 1 );
hb_storvni( pt.x, -1, 2 );
}
what does
Code: Select all
hb_storvni( pt.y, -1, 1 );
hb_storvni( pt.x, -1, 2 );
do

Re: CONTEXT MENU on wrong Monitor
Posted: Tue Aug 31, 2021 4:44 am
by AUGE_OHR
hi,
i have make more Test with CONTEXT MENU
just have 1 x CONTEXT MENU in MAIN ( Win_1 )
have check GetCursorRow() / GetCursorCol() <-> GetCursorPos (@nCol, @nRow) -> OK and negative Value
now i place my App 50 % left Side and 50 % right Side so App is between both Monitor
if i right click on right Side it will work correct
if i right click on left Side Popup will show on right Monitor
---
i have try to manipulate HB_FUNC ( TRACKPOPUPMENU ) in c:\hmg.3.4.4\SOURCE\c_menu.c
i follow Sample from
https://docs.microsoft.com/en-us/window ... kpopupmenu
i have try to enable this line
Code: Select all
PostMessage(hDlg, WM_NULL, 0, 0);
but nothing help
as it work with my Xbase++ App there must be a Solution ... need Idea

Re: CONTEXT MENU on wrong Monitor
Posted: Tue Aug 31, 2021 5:31 am
by AUGE_OHR
hi,
i "think" i got the Answer :
c:\hmg.3.4.4\SOURCE\h_windows.prg
Code: Select all
CASE nMsg == WM_CONTEXTMENU
_HMG_MouseRow := HIWORD( lParam )
_HMG_MouseCol := LOWORD( lParam )
_HMG_SYSDATA[ 191 ] := HIWORD( lParam )
_HMG_SYSDATA[ 192 ] := LOWORD( lParam )
HIWORD and LOWORD return signed value -> NO NEGATIVE Value
i "think" we have to use POINT Structure like HB_FUNC ( GETCURSORPOS )
Re: CONTEXT MENU on wrong Monitor
Posted: Tue Aug 31, 2021 7:39 am
by AUGE_OHR
hi,
GOT IT
use c:\hmg.3.4.4\SOURCE\
h_windows.prg
search under WM_LBUTTONDOWN and WM_MOUSEMOVE for
Code: Select all
_HMG_SYSDATA[ 191 ] := HIWORD( lParam )
_HMG_SYSDATA[ 192 ] := LOWORD( lParam )
also under WM_CONTEXTMENU
Code: Select all
_HMG_MouseRow := HIWORD( lParam )
_HMG_MouseCol := LOWORD( lParam )
and replace it with
Code: Select all
aPos := GETCURSORPOS()
_HMG_SYSDATA[ 191 ] := aPos[1]
_HMG_SYSDATA[ 192 ] := aPos[2]
or
Code: Select all
aPos := GETCURSORPOS()
_HMG_MouseRow := aPos[1]
_HMG_MouseCol := aPos[2]
---
search for
Code: Select all
TrackPopupMenu( _HMG_SYSDATA[ 74 ] [ i ], LOWORD( lparam ), HIWORD( lparam ), hWnd )
and replace it with
Code: Select all
TrackPopupMenu( _HMG_SYSDATA[ 74 ] [ i ], aPos[ 1 ], aPos[ 2 ], hWnd )
---
use c:\hmg.3.4.4\SOURCE\
c_windows.c
in HB_FUNC ( GETCURSORPOS )
change
Code: Select all
hb_storvni( pt.y, -1, 1 );
hb_storvni( pt.x, -1, 2 );
to
Code: Select all
hb_storvni( pt.x, -1, 1 );
hb_storvni( pt.y, -1, 2 );
rebuild LIB and it work with NEGATIVE Value
p.s. you can use attached Files to overwrite (!) c:\hmg.3.4.4\SOURCE\c_windows.c and c:\hmg.3.4.4\SOURCE\h_windows.prg but make BACKUP FIRST
Re: CONTEXT MENU on wrong Monitor
Posted: Tue Aug 31, 2021 9:58 pm
by AUGE_OHR
hi,
Note : file NOHIWORD.ZIP is Version 3.4.4
it might be that in HMG 3.5 something have change but i can´t compare it (yet) as i have to CLICK it first.
please make those Change to c:\HMG.3.5\SOURCE\h_windows.prg "manual" to be sure not to brake Code.
Re: CONTEXT MENU on wrong Monitor
Posted: Wed Sep 01, 2021 1:15 am
by AUGE_OHR
hi,
it seems there is a "better" Way to get "negative" Value
i have read at
https://docs.microsoft.com/en-us/window ... sing-menus
Code: Select all
case WM_CONTEXTMENU:
if (!OnContextMenu(hwnd, GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam)))
return DefWindowProc(hwnd, uMsg, wParam, lParam);
break;
so instead of
Code: Select all
_HMG_SYSDATA[ 191 ] := HIWORD( lParam )
_HMG_SYSDATA[ 192 ] := LOWORD( lParam )
we can use ( not tested yet )
Code: Select all
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
which is
Code: Select all
_HMG_SYSDATA[ 191 ] := GET_X_LPARAM(lParam);
_HMG_SYSDATA[ 192 ] := GET_Y_LPARAM(lParam);