예제 #1
0
파일: GApp.cs 프로젝트: nwtajcky/RDManager
        private unsafe static bool TryToSend(IntPtr hwnd, string filename)
        {
            char[] data = filename.ToCharArray();
            char * b    = stackalloc char[data.Length + 1];

            for (int i = 0; i < data.Length; i++)
            {
                b[i] = data[i];
            }
            b[data.Length] = '\0';

            //string t = ReadFileName(hglobal);
            Win32.COPYDATASTRUCT cddata = new Win32.COPYDATASTRUCT();
            cddata.dwData = OPEN_SHORTCUT;
            cddata.cbData = (uint)(sizeof(char) * (data.Length + 1));
            cddata.lpData = b;

            int lresult = Win32.SendMessage(hwnd, Win32.WM_COPYDATA, IntPtr.Zero, new IntPtr(&cddata));

            //Debug.WriteLine("TryToSend "+lresult);
            return(lresult == OPEN_SHORTCUT_OK);
        }
예제 #2
0
파일: GApp.cs 프로젝트: nospy/EasyConnect
        private static unsafe bool TryToSend(IntPtr hwnd, string filename)
        {
            char[] data = filename.ToCharArray();
            char* b = stackalloc char[data.Length+1];
            for(int i=0; i<data.Length; i++) b[i] = data[i];
            b[data.Length] = '\0';

            //string t = ReadFileName(hglobal);
            Win32.COPYDATASTRUCT cddata = new Win32.COPYDATASTRUCT();
            cddata.dwData = OPEN_SHORTCUT;
            cddata.cbData = (uint)(sizeof(char) * (data.Length+1));
            cddata.lpData = b;

            int lresult = Win32.SendMessage(hwnd, Win32.WM_COPYDATA, IntPtr.Zero, new IntPtr(&cddata));
            //Debug.WriteLine("TryToSend "+lresult);
            return lresult==OPEN_SHORTCUT_OK;
        }