U
Ulises Vega.
I'm using the following code to override the default GREEN KEY
behavior:
/
*******************************************************************************************************************/
BEGIN OF SAMPLE CODE
/
*******************************************************************************************************************/
// needed constants
private const Int16 SHMBOF_NODEFAULT = 0x00000001;
private const Int16 SHMBOF_NOTIFY = 0x00000002;
private const Int32 flags = 0x00030003;
private const int WM_USER = 0x0400;
private const int SHCMBM_OVERRIDEKEY = WM_USER + 403;
const int VK_TTALK = 7 * 16 + 2;
const int VK_TEND = 7 * 16 + 3;
const int VK_TBACK = 0x08;
//inside form load.
if(null == this.Handle )
{
throw new SystemException(String.Format("Handle to the
window is null"));
}
IntPtr i = SHFindMenuBar(this.Handle);
if(null == i)
{
code = Marshal.GetLastWin32Error();
serr = Marshal.GetLastWin32Error().ToString();
throw new SystemException( String.Format("Failed
SendMessage, Error string " + serr + " Error code: {0} ", code));
}
long res = (long)SendMessage(i, SHCMBM_OVERRIDEKEY, VK_TBACK,flags);
if (res == 0)
{
code = Marshal.GetLastWin32Error();
serr = Marshal.GetLastWin32Error().ToString();
throw new SystemException(String.Format("Failed
SendMessage, SHCMBM_OVERRIDEKEY Error string" + serr + " Error code:
{0} ", code));
}
[DllImport("coredll.dll", CharSet = CharSet.Auto, SetLastError =
true)]
private static extern int SendMessage(IntPtr hWnd, int wMsg,
int wParam, int lParam);
/
*******************************************************************************************************************/
END OF SAMPLE CODE
/
*******************************************************************************************************************/
However the value oF res, return value of SendMessage, is 0 and the
error is either 6, or 1400.
Could anyone shed some ligth on what I-m doing wrong?
Point me to the error return codes for SendMessage?
Thanks for your help.
Ulises Vega
behavior:
/
*******************************************************************************************************************/
BEGIN OF SAMPLE CODE
/
*******************************************************************************************************************/
// needed constants
private const Int16 SHMBOF_NODEFAULT = 0x00000001;
private const Int16 SHMBOF_NOTIFY = 0x00000002;
private const Int32 flags = 0x00030003;
private const int WM_USER = 0x0400;
private const int SHCMBM_OVERRIDEKEY = WM_USER + 403;
const int VK_TTALK = 7 * 16 + 2;
const int VK_TEND = 7 * 16 + 3;
const int VK_TBACK = 0x08;
//inside form load.
if(null == this.Handle )
{
throw new SystemException(String.Format("Handle to the
window is null"));
}
IntPtr i = SHFindMenuBar(this.Handle);
if(null == i)
{
code = Marshal.GetLastWin32Error();
serr = Marshal.GetLastWin32Error().ToString();
throw new SystemException( String.Format("Failed
SendMessage, Error string " + serr + " Error code: {0} ", code));
}
long res = (long)SendMessage(i, SHCMBM_OVERRIDEKEY, VK_TBACK,flags);
if (res == 0)
{
code = Marshal.GetLastWin32Error();
serr = Marshal.GetLastWin32Error().ToString();
throw new SystemException(String.Format("Failed
SendMessage, SHCMBM_OVERRIDEKEY Error string" + serr + " Error code:
{0} ", code));
}
[DllImport("coredll.dll", CharSet = CharSet.Auto, SetLastError =
true)]
private static extern int SendMessage(IntPtr hWnd, int wMsg,
int wParam, int lParam);
/
*******************************************************************************************************************/
END OF SAMPLE CODE
/
*******************************************************************************************************************/
However the value oF res, return value of SendMessage, is 0 and the
error is either 6, or 1400.
Could anyone shed some ligth on what I-m doing wrong?
Point me to the error return codes for SendMessage?
Thanks for your help.
Ulises Vega