Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

"SetWindowText" als Methodenname

Empfohlene Antworten

Veröffentlicht

Hallo Zusammen,

ich habe mir seit längerer zeit eine Klassensammlung zusammengestellt wo ich Win32 - Api Methoden gekapselt habe.

Diese Klassensammlung ist in C++ (mit MFC unterstützung) geschrieben.

Das ganze verwende ich jetzt in C# wieder. Dazu schreibe ich mir managed c++ wrapperklassen.

=> Die Original C++ Klasse hat eine Methode "SetWindowText".

Wenn jetzt der Wrapper diese Methode aufruft, schlägt mir die Hilfe plötzlich "SetWindowTextA" als Methodennamen vor :confused:.

Wie gibts denn sowas?

WEnn meine C# Methode die SetWindowText des Wrappers aufrufen will, dann heißt die SetWindowText des Wrappers plötzlich "SetWindowTextW"?

Kann mir das jemand erklären?

Viele Grüße

Stefan

P.S. Wenn ich die Methodennamen in "SetTHEWindowText" umbennen oder sowas, dann gehts.. aber ich würde trotzdem 1. gerne einen grund wissen und 2. meine Methodennnamen beibehalten :)

Es gibt eine WinAPI-Funktion namens SetWindowText, d.h eigentlich gibt es die nicht ;). Es gibt die Multi-Byte-Variante (SetWindowTextA) und die Wide-Character-Variante (SetWindowTextW). SetWindowText ist nur ein Präprozessorsymbol, das je nachdem, wie die UNICODE-Einstellungen im C++-Projekt definiert sind, entweder auf SetWindowTextA oder SetWindowTextW verweist.

Und da Präprozessormakros dumm sind und keine Scopes beachten, passiert diese Ersetzung auch in deinem Code, sobald du die Windows-Header einbindest.

Das gilt übrigens für praktisch alle WinAPI-Funktionen, die mit C-Strings arbeiten.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.