Konvertieren Sie den C ++ - Code in C#: sendMessAgetimeout ()C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Konvertieren Sie den C ++ - Code in C#: sendMessAgetimeout ()

Post by Anonymous »

gemäß der Dokumentation für sendMessAgetimeout () :
Ich habe den folgenden C ++ - Code, und ich möchte ihn in C#:
konvertieren

Code: Select all

LRESULT success = SendMessageTimeout(
HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM) "Environment",
SMTO_ABORTIFHUNG,
5000,
NULL
);
< /code>
Was ich in C# getan habe, ist wie folgt und ich habe meine Probleme als Kommentare hinzugefügt: < /p>
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr SendMessageTimeout(
IntPtr hWnd,
uint Msg,
UIntPtr wParam,
IntPtr lParam,
uint fuFlags,
uint uTimeout,
out UIntPtr lpdwResult
);

SendMessageTimeout(
(IntPtr)0xFFFFFFFF,    // HWND_BROADCAST
0x001A,                // WM_SETTINGCHANGE
(UIntPtr)0,
(IntPtr)"Environment", // ERROR_1: can't convert string to IntPtr
0x0002,                // SMTO_ABORTIFHUNG
5000,
out UIntPtr.Zero       // ERROR_2: a static readonly field can not be passed ref or out
);

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post