Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

COPYDATASTRUCT (Structures)
 
.
Summary
TODO - a short description

C# Definition:

[StructLayout(LayoutKind.Sequential)]
struct COPYDATASTRUCT
{
    public IntPtr dwData;
    public int cbData;
    public IntPtr lpData;
}

const int WM_COPYDATA = 0x004A;

VB.NET Definition:

<StructLayout(LayoutKind.Sequential)> _
Structure COPYDATASTRUCT
   Public dwData As IntPtr
   Public cdData As Integer
   Public lpData As IntPtr
End Structure

User-Defined Field Types:

None.

Documentation

    public static IntPtr IntPtrAlloc<T>(T param)
    {
    IntPtr retval = Marshal.AllocHGlobal(Marshal.SizeOf(param));
    Marshal.StructureToPtr(param, retval, false);
    return (retval);
    }

    public static void IntPtrFree(IntPtr preAllocated)
    {
    if (IntPtr.Zero == preAllocated) throw (new Exception("Go Home"));
    Marshal.FreeHGlobal(preAllocated); preAllocated = IntPtr.Zero;
    }

    [StructLayout(LayoutKind.Sequential)]
    struct COPYDATASTRUCT
    {
    public IntPtr dwData;
    public int cbData;
    public IntPtr lpData;
    }

    public SendMessage()
    {
    IntPtr buffer = IntPtrAlloc(txStruct);
    COPYDATASTRUCT copyData = new COPYDATASTRUCT();
    copyData.dwData = IntPtr.Zero;
    copyData.lpData = buffer;
    copyData.cbData = Marshal.SizeOf(txStruct);
    IntPtr copyDataBuff= IntPtrAlloc(copyData);
    SendMessage(hWnd, WM_COPYDATA, IntPtr.Zero, copyDataBuff);
    IntPtrFree(copyDataBuff); copyDataBuff = IntPtr.Zero;
    IntPtrFree(buffer); buffer = IntPtr.Zero;
    }

    protected override void WndProc(ref Message m)
    {
    switch (m.Msg)
    {
        case (int)WM.COPYDATA:
        var msg = Marshal.PtrToStructure<COPYDATASTRUCT>(m.LParam);
        var pData = Marshal.PtrToStructure<GEORECT>(msg.lpData);
        if (pData.Falconview != FalconShu.FALCONVIEW)
            break;
        if (MessageType.FV_RUBBERBAND_GEORECT_MSG == pData.Type
            && this.messageId == pData.MessageId)
        {
            this.Simulation.WeatherArea.N = new LatLong(this.ctrlLatitudeN.Latitude = pData.NW_Latitude, LL.Latitude);
            this.Simulation.WeatherArea.W = new LatLong(this.ctrlLongitudeW.Longitude = pData.NW_Longitude, LL.Longitude);
            this.Simulation.WeatherArea.S = new LatLong(this.ctrlLatitudeS.Latitude = pData.SE_Latitude, LL.Latitude);
            this.Simulation.WeatherArea.E = new LatLong(this.ctrlLongitudeE.Longitude = pData.SE_Longitude, LL.Longitude);
            CheckForReadiness();
            Externals.SetForegroundWindow(this.Handle);
            return;
        }
        else if (MessageType.FV_RUBBERBAND_GEORECT_CANCELED == pData.Type)
        {
            // Message overwritten by another attempt to get it
            return;
        }

        break;
    }

    base.WndProc(ref m);
    }

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions