关于64位机器中对话框消息的问题 [英] a question about dialog message in 64 bit machine

查看:72
本文介绍了关于64位机器中对话框消息的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有

我们正在使用C#和可扩展对话框来创建我们自己的对话框。

它在32位机器上运行良好。

问题是,我可以捕获对话框Notify消息,当我将lParam转换为OFNotify时

IntPtr ipNotify = new IntPtr(lParam) ;
OfNotify ofNot =(OfNotify)Marshal.PtrToStructure(ipNotify,
typeof(OfNotify));
UInt16 code = ofNot.code;

在64位机器中,代码始终为零。

我为OfNotify结构尝试了两种不同的结构

[StructLayout(LayoutKind.Explicit)]
内部结构OfNotify_1
{
[ FieldOffset(0)]公共NMHDR hdr;
[FieldOffset(12)] public IntPtr ipOfn;
[FieldOffset(16)] public IntPtr ipFile;
};

///< summary>
///公共对话框发送的部分通知消息
///< / summary>
[StructLayout(LayoutKind.Explicit)]
内部结构NMHDR
{
[FieldOffset(0)] public IntPtr hWndFrom;
[FieldOffset(4)] public UInt16 idFrom;
[FieldOffset(8)]公共UInt16代码;
};


[StructLayout(LayoutKind.Sequential,CharSet = CharSet.Ansi)]
内部结构OfNotify
{
//内部NMHDR hdr; // FIXME:无法封送
内部IntPtr hwndFrom;
internal int idFrom;
内部UInt16代码;
内部IntPtr lpOFN;
//内部字符串pszFile; // FIXME:不能被编组
内部IntPtr pszFile;
}

它们不起作用。代码始终为零。

以前有人有同样的问题吗?

谢谢!

解决方案

我解决了!

我解决了!

我解决了!

我自己!

我自己!

我自己!
搜索结果

hi, all

We are using C# with the Extensible Dialog to make our own dialog.

It makes fine in 32 bit machine.

The problem is, I can catch the dialog Notify message, when I convert
the lParam to OFNotify

    IntPtr ipNotify = new IntPtr(lParam);
    OfNotify ofNot = (OfNotify)Marshal.PtrToStructure(ipNotify,
typeof(OfNotify));
    UInt16 code = ofNot.code;

in 64 bit machine, code is always zero.

I tried two different structure for OfNotify structure

        [StructLayout(LayoutKind.Explicit)]
        internal struct OfNotify_1
        {
                [FieldOffset(0)]        public NMHDR    hdr;
                [FieldOffset(12)]       public IntPtr   ipOfn;
                [FieldOffset(16)]       public IntPtr   ipFile;
        };

        /// <summary>
        /// Part of the notification messages sent by the common dialogs
        /// </summary>
        [StructLayout(LayoutKind.Explicit)]
        internal struct NMHDR
        {
                [FieldOffset(0)]        public IntPtr   hWndFrom;
                [FieldOffset(4)]        public UInt16   idFrom;
                [FieldOffset(8)]        public UInt16   code;
        };

and

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    internal struct OfNotify
    {
        //internal NMHDR         hdr;   // FIXME: cannot be marshaled
        internal IntPtr hwndFrom;
        internal int idFrom;
        internal UInt16 code;
        internal IntPtr lpOFN;
        //internal string        pszFile;       // FIXME: cannot be
marshaled
        internal IntPtr pszFile;
    }

they don't work. the code is always zero.

Any one had the same issue before?

Thanks!

解决方案

I resolved it !

I resolved it !

I resolved it !

by myself !

by myself !

by myself !



这篇关于关于64位机器中对话框消息的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆