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.

Problem bei Fensterprogrammierung

Empfohlene Antworten

Veröffentlicht

Könnt ihr mir vlt. helfen

Dieser Quelltext kann ich nicht kopieren

es lässt sich nicht kompilieren es steht :

[Linker error] undefined reference to `WndProc@16'

ld returned 1 exit status

C:\Dev-Cpp\Makefile.win [build Error] [Fenster.exe] Error 1

Wisst ihr vlt. was zu tun ist?

oder was falsch ist?:confused:

Danke im Voraus:confused:

#include <windows.h>

#include <stdlib.h>

#include <time.h>

#define PIXEL 1

#define LINIE 2

#define RECHTECK 3

#define VIELECK 4

#define ELLIPSE 5

#define INVALIDATE 6

#define BEENDEN 7

HWND bPixel, bLinie, bRechteck, bVieleck, bEllipse, bInvalidate, bBeenden;

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

LPCSTR MainClassName = "Malen und Zeichnen";

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

PSTR szCmdLine, int iCmdShow)

{

WNDCLASSEX wc;

HWND hWnd;

MSG wmsg;

wc.cbSize = sizeof(WNDCLASSEX);

wc.style = 0;

wc.lpfnWndProc = WndProc;

wc.cbClsExtra = 0;

wc.cbWndExtra = 0;

wc.hInstance = hInstance;

wc.hIcon = LoadIcon(GetModuleHandle(NULL), IDI_APPLICATION);

wc.hCursor = LoadCursor(NULL, IDC_CROSS);

wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

wc.lpszMenuName = MainClassName;

wc.lpszClassName = MainClassName;

wc.hIconSm = LoadIcon(GetModuleHandle(NULL), IDI_APPLICATION);

if(!RegisterClassEx(&wc))

{

MessageBox(NULL, "Windows Registrations Fehler", "Error!",

MB_ICONEXCLAMATION | MB_OK);

return 0;

}

hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, MainClassName,

"Gerätekontext Beispiel",

WS_SYSMENU | WS_VISIBLE,

CW_USEDEFAULT, CW_USEDEFAULT,

400, 300, NULL, NULL, hInstance, NULL);

bPixel = CreateWindow("button", "Pixel", WS_CHILD | WS_VISIBLE |

BS_DEFPUSHBUTTON, 310, 0, 80, 30,

hWnd, (HMENU)PIXEL, hInstance, NULL);

bLinie = CreateWindow("button", "Linie", WS_CHILD | WS_VISIBLE |

BS_DEFPUSHBUTTON, 310, 30, 80, 30,

hWnd, (HMENU)LINIE, hInstance, NULL);

bRechteck = CreateWindow("button", "Rechtecke", WS_CHILD |

WS_VISIBLE | BS_DEFPUSHBUTTON,

310, 60, 80, 30, hWnd,

(HMENU)RECHTECK, hInstance, NULL);

bVieleck = CreateWindow("button", "Vielecke", WS_CHILD |

WS_VISIBLE | BS_DEFPUSHBUTTON,

310, 90, 80, 30, hWnd,

(HMENU)VIELECK, hInstance, NULL);

bEllipse = CreateWindow("button", "Ellipse", WS_CHILD |

WS_VISIBLE | BS_DEFPUSHBUTTON,

310, 120, 80, 30, hWnd,

(HMENU)ELLIPSE, hInstance, NULL);

bEllipse = CreateWindow("button", "Säubern", WS_CHILD |

WS_VISIBLE | BS_DEFPUSHBUTTON,

310, 150, 80, 30, hWnd,

(HMENU)INVALIDATE, hInstance, NULL);

bInvalidate = CreateWindow("button", "Säubern", WS_CHILD |

WS_VISIBLE | BS_DEFPUSHBUTTON,

310, 150, 80, 30, hWnd,

(HMENU)INVALIDATE, hInstance, NULL);

bBeenden = CreateWindow("button", "Beenden", WS_CHILD |

WS_VISIBLE | BS_DEFPUSHBUTTON,

310, 180, 80, 30, hWnd,

(HMENU)BEENDEN, hInstance, NULL);

if(hWnd == NULL)

{

if(MessageBox(NULL, "Fehler beim Erstellen des Fensters!",

"Error!", MB_ICONEXCLAMATION | MB_OK) == IDOK);

return 0;

}

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

{

TranslateMessage(&wmsg);

DispatchMessage(&wmsg);

}

return wmsg.wParam;

}

Du hast die Funktion WndProc deklariert, aber du hast sie nicht definiert. Sie fehlt schlicht und einfach.

Also wie meinst du definiert kannst du mier aufschreiben

wo ich das definieren muss

?

pls.

Also wie meinst du definiert

Das hier ist eine Deklaration, in C sagt man auch Prototyp:

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
Damit sagst du nur, dass es die Funktion gibt. Du musst in deinem Code auch noch festlegen, was die Funktion tut. Das ist die Definition:
LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
// Hier kommt der Code der Funktion hin
}[/code]

kannst du mier aufschreiben

wo ich das definieren muss

Irgendwo in deinem Programm, außerhalb der anderen Funktion(en).

Das hier ist eine Deklaration, in C sagt man auch Prototyp:

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

Damit sagst du nur, dass es die Funktion gibt.

Du musst in deinem Code auch noch festlegen, was die Funktion tut. Das ist die Definition:

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )

{

// Hier kommt der Code der Funktion hin

}

Irgendwo in deinem Programm, außerhalb der anderen Funktion(en).

Danke viel mal für deine Hilfe;-)

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.