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.

(WinApi/Treeview) Auf TVN_SELCHANGED reagieren

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe eine Treeview. Die wird so erstellt:


InitCommonControls();


hWndTreeview = CreateWindow(WC_TREEVIEW, TEXT("Treeview"), WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS, rcTreeview.left, rcTreeview.top, rcTreeview.right, rcTreeview.bottom, hWnd, (HMENU)ID_TREEVIEW, GetModuleHandle(0), NULL);

Das klappt soweit. Wenn ich das richtig verstanden habe, sollte das Event TVN_SELCHANGED als WM_NOTIFY Nachricht an das Parentwindow (hier also hWnd) gesendet werden (https://msdn.microsoft.com/en-us/library/windows/desktop/bb773544(v=vs.85).aspx). Im WndProc des hWnd kann ich auch WM_NOTIFY Nachrichten abfangen. Nur scheinen die IDs nicht zu stimmen. Ich habe das so versucht:

LRESULT CALLBACK Controller::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

{

	switch (message)

	{

	// [...]

	case WM_NOTIFY:

	{

		NMTREEVIEW* pnmtv = (NMTREEVIEW*)lParam;


		switch (pnmtv->hdr.idFrom)

		{

		case ID_TREEVIEW:

			char cAction[20];

			sprintf_s(cAction, 20, "%d\n  %d\n\n", pnmtv->action, TVN_SELCHANGED);

			OutputDebugString(cAction);


			break;

		}


		break;

	}

	}


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

}

Die Ausgabe zeigt: Die ID von TVN_SELCHANGED sollte -402 sein. In pnmtv->action steht beim entsprechenden Event aber eine 1.

Was stimmt nicht?

Gruß

PL1994

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.