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.

Icon?

Empfohlene Antworten

Veröffentlicht

Hi,

ich bin ein totaler Nap in Sachen C++, ich habe gerade erst angefangen. Jetzt habe ich folgenden Code...wie kann ich dem Fenster das Icon symbol16.ico (existiert schon) geben?

#include <windows.h>

/* Declare Windows procedure */

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/* Make the class name into a global variable */

char szClassName[ ] = "one";

int WINAPI WinMain (HINSTANCE hThisInstance,

HINSTANCE hPrevInstance,

LPSTR lpszArgument,

int nFunsterStil)

{

HWND hwnd; /* This is the handle for our window */

MSG messages; /* Here messages to the application are saved */

WNDCLASSEX wincl; /* Data structure for the windowclass */

/* The Window structure */

wincl.hInstance = hThisInstance;

wincl.lpszClassName = szClassName;

wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */

wincl.style = CS_DBLCLKS; /* Catch double-clicks */

wincl.cbSize = sizeof (WNDCLASSEX);

/* Use default icon and mouse-pointer */

wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);

wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);

wincl.hCursor = LoadCursor (NULL, IDC_ARROW);

wincl.lpszMenuName = NULL; /* No menu */

wincl.cbClsExtra = 0; /* No extra bytes after the window class */

wincl.cbWndExtra = 0; /* structure or the window instance */

/* Use Windows's default color as the background of the window */

wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

/* Register the window class, and if it fails quit the program */

if (!RegisterClassEx (&wincl))

return 0;

/* The class is registered, let's create the program*/

hwnd = CreateWindowEx (

0, /* Extended possibilites for variation */

szClassName, /* Classname */

"[ig.] invincible-gamerz gamimg tool - v1.0 by RumbleFish", /* Title Text */

WS_OVERLAPPEDWINDOW, /* default window */

CW_USEDEFAULT, /* Windows decides the position */

CW_USEDEFAULT, /* where the window ends up on the screen */

544, /* The programs width */

375, /* and height in pixels */

HWND_DESKTOP, /* The window is a child-window to desktop */

NULL, /* No menu */

hThisInstance, /* Program Instance handler */

NULL /* No Window Creation data */

);

/* Make the window visible on the screen */

ShowWindow (hwnd, nFunsterStil);

/* Run the message loop. It will run until GetMessage() returns 0 */

while (GetMessage (&messages, NULL, 0, 0))

{

/* Translate virtual-key messages into character messages */

TranslateMessage(&messages);

/* Send message to WindowProcedure */

DispatchMessage(&messages);

}

/* The program return-value is 0 - The value that PostQuitMessage() gave */

return messages.wParam;

}

/* This function is called by the Windows function DispatchMessage() */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

{

switch (message) /* handle the messages */

{

case WM_DESTROY:

PostQuitMessage (0); /* send a WM_QUIT to the message queue */

break;

default: /* for messages that we don't deal with */

return DefWindowProc (hwnd, message, wParam, lParam);

}

return 0;

}

invincible-gamerz

Nur mal so ne Frage: Wenn du noch Anfänger in C++ bist, wieso fängst du dann bereits mit der Windows Programmierung an?

Das wird einfach nicht gut gehen wenn du noch nicht die Grunlagen von C++ beherscht.

Falls du es trotzdem probieren willst:

Als erstens fügst du deinem Projekt eine Resource File (.rc) hinzu, dort fügst du dann dein Icon ein.

Und für "wndclass.hIcon = " gibst du dann

LoadIcon (hThisInstance, MAKEINTRESOURCE (IDI_symbol16));

an.

Ich habe ja schon mal mit der Konsolen-Programmierung angefangen und das lief auch ganz gut. Und da ich PHP beherrsche und die Konsolen-Programmierung dadurch kein Problem für mich war, hab ich mich gleich an die Windows-Programmierung rangesetzt.

Danke Split,

invincible-gamerz

Noch eine Frage:

Kann man Konsolenanwendungen auch Icons geben?

Ich habe Dev-C++, habe eine Resource File erstellt, aber wie kriege ich jetzt das Logo da rein?

invincible-gamerz

Die Beschreibung vorhin war für VC++. Hab deswegen grade beim Dev-C++ nachgeguckt wie es dort geht und dort ist das ganze noch ein bisschen einfacher.

Dort muss man nur auf Projekt -> Projekt Optionen gehen, dort öffnet sich das Projekt Menü wo man dann auf Durchsuchen klickt und das Icon auswählt.

Jo, das funktioniert ja auch. Nur das Icon oben links im Programm bleibt immer gleich.

Wie kann ich das denn umändern?

MfG

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.