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.

CToolBarCtrl AddButtons & Windows Vista

Empfohlene Antworten

Veröffentlicht

Hallo Zusammen,

Ich verwende aktuell noch Visual Studio 6.0 (Ich weiß ich hink noch hinterher :floet: ).

Ich hab das ganze auch unter Windows Vista zum laufen gebraucht u. hat noch nie probleme gemacht!

Jetzt bin ich jedoch auf Code gestoßen der unter Windows XP nie probleme gemacht hat. Unter Vista läuft das ganze leider nicht mehr (Laufzeitfehler). Egal ob ich das ganze unter XP oder Vista comiliere. Der Laufzeitfehler tritt immer auf.

Folgender Code macht probleme:

Eine Membervariable:

CWnd* m_control;

Und den Code in OnInitDialog


  m_control = new CToolBar();

  ((CToolBar*)m_control)->Create(this);

  int anz = 3;


  for (int i=0;i < anz ; i++)

  {

    TBBUTTON button[1];

    TBBUTTON foreignbutton;


    button[0].fsState = TBSTATE_ENABLED;

    button[0].fsStyle = TBSTYLE_BUTTON ;

    button[0].idCommand = 10000 + i;


   ((CToolBar*)m_control)->GetToolBarCtrl().AddButtons(1,button);


  }

  RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);


Bei "AddButtons" hängt sich das Programm auf. Vista sagt dann das das Progamm nicht mehr reagiert u. ob es geschlossen werden soll.

Wenn ich im Debugger bin sagt Visual Studio:

Unbehandelte Ausnahme in Toolbar.exe (Kernel32.dll)

0xC0000005: Access Violation.

Hat jemand nach ne idee? Oder liegt es tatsächlich am alten Visual Studio?

Hat jemand das neue Visual Studio u. Windows Vista? Könnte da jemand den code mal ausprobieren?

Bin für jeden kleinen Tipp dankbar!

Viele Grüße

Stefan

Kann ja nicht gehen.



button[0].fsState = TBSTATE_ENABLED;

button[0].fsStyle = TBSTYLE_BUTTON ;

button[0].idCommand = 10000 + i;


[...] AddButtons(1,button);

Parameters:

nNumButtons

Number of buttons to add.

Ergo: Du verweißt auf 1 und dabei ist das letzte Element 0;

Tausch mal die 1 gegen 0 aus.

PS:

Ich kann's mir einfach nicht verkneifen:

I beat the SwordMaster. :bimei

Edit: Och menno, ich sollte richtig lesen.

Number of buttons nicht of Button, mist dann geht das ja auch ne...

Hast du mal durchdebuggt?

Bearbeitet von TDM

  • Autor

Edit: Och menno, ich sollte richtig lesen.

Number of buttons nicht of Button, mist dann geht das ja auch ne...

Hast du mal durchdebuggt?

:P ich bin halt auch nicht von vorgestern.. :D

Ja ich hab schon mal in die AddButtons methode reindebuckt, leider hat die nur einen Aufruf "::SendMessage(m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons);"

und in die SendMessage Methode kann ich schon nicht mehr reindebuggen, weil die "Unbehandelte Ausnahme" dann kommt. :-(

Viele Grüße

Stefan

Zu Testzwecken würd ich einfach mal die Zeile in einen try-Block schreiben und die Exception anschauen, vielleicht steht da ja was drin.

Außerdem würd ich die Variablen noch in der SendMessage-Methode prüfen, ob die Werte alle passen.

(Ich weiß, eigentlich müssten sie's aber man kann ja nie wissen...)

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.