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.

Variablen in MessageBox anzeigen

Empfohlene Antworten

Veröffentlicht

Hallo Forumer...

Wie kann man z. B. die Bildschirmauflösung in einer Messagebox anzeigen lassen?

(Borland C++Builder)

a = Screen->Height;

b = Screen->Width;

MessageBox(NULL,"Die Bildschirmauflösung ist" ...........,"Auflösung",

MB_ICONINFORMATION | MB_OK | MB_DEFBUTTON1);

Dies war meine Idee, aber ich weiß nicht, wo ich die Variablen "a" & "b" eintragen muss.

Geht das überhaupt in einer MessageBox?

Hab in der Hilfe nichts gefunden...

THANKS

KID

string Nachricht = "Die Bildschirmauflösung ist " + a + "x" + b;

Jetzt weiß ich grad net auswendig, ob MessageBox nen string oder ein char-Array will:

1. String: MessageBox(NULL,Nachricht,"...

2. char-Array: MessageBox(NULL,Nachricht.c_str(),"...

Gruß

Hi,

hab ich versucht, aber er schreibt mir dann

"Undefiniertes Symbol: 'string' "

"In Anweisung fehlt ';' "

"Undefiniertes Symbol: 'Nachricht' "

Das ist der Source:

#include <vcl.h>

#include <string.h>

#include <stdio.h>

#pragma hdrstop

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm1 *Form1;

//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)

{

int a = Screen->Height;

int b = Screen->Width;

string Nachricht("Die Bildschirmauflösung ist " + a + "x" + B);

MessageBox(NULL, Nachricht.c_str(),

"Auflösung",

MB_ICONINFORMATION | MB_OKCANCEL | MB_DEFBUTTON1);

}

So ging es auch nicht:

string Nachricht = "Die Bildschirmauflösung ist " + a + "x" + b;

:confused:

KID

Nimm entweder AnsiString oder std::string, dann musst du aber den header von string.h in string umbennen!

AnsiString as("Die Auflösung ist ");

as = as + IntToString(Screen->Height) + "x";

as = as +IntToString(Screen->Width);


MessageBox(NULL, as.c_str(),

"Auflösung",

MB_ICONINFORMATION | MB_OKCANCEL | MB_DEFBUTTON1);

Hallo,

hab in einem anderen Forum Hilfe bekommen.

Das hat auch funktioniert...

void __fastcall TForm1::Button1Click(TObject *Sender)

{

int a = Screen->Height;

int b = Screen->Width;

AnsiString test = "Die Auflösung ist ";

test += b;

test += "*";

test += a;

MessageDlg(test, mtInformation, TMsgDlgButtons() << mbOK, 0);

}

Thanks @all

KID

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.