?
Erstmal danke redw0lf für den Artikel.
Kannte ihn schon und fand ihn nicht so gut und möchte auch keine dll benutzen, sondern es so regeln.
Das mit dem Anmelden der Toolbar geht jetzt ohne Fehler. Rufe die Registrierung in OnCreate auf. Doch verhält sich mein Fenster gar nicht wie eine Toolbar z.b. wird es immer noch von anderen Fenster verdeckt.
Ich denke es liegt daran, dass ich bis jetzt erst die Toolbar registriert habe aber noch nicht die Position usw. festgelegt habe.(Wenn ich da falsch liege, sagt mir bitte bescheid).
Habe mich also an den nächsten Code Abschnitt aus der Msdn gesetzt, der wie folgt lautet:
// AppBarQuerySetPos - sets the size and position of an appbar.
// uEdge - screen edge to which the appbar is to be anchored
// lprc - current bounding rectangle of the appbar
// pabd - address of the APPBARDATA structure with the hWnd and
// cbSize members filled
void PASCAL AppBarQuerySetPos(UINT uEdge, LPRECT lprc, PAPPBARDATA pabd)
{
int iHeight = 0;
int iWidth = 0;
pabd->rc = *lprc;
pabd->uEdge = uEdge;
// Copy the screen coordinates of the appbar's bounding
// rectangle into the APPBARDATA structure.
if ((uEdge == ABE_LEFT) ||
(uEdge == ABE_RIGHT)) {
iWidth = pabd->rc.right - pabd->rc.left;
pabd->rc.top = 0;
pabd->rc.bottom = GetSystemMetrics(SM_CYSCREEN);
} else {
iHeight = pabd->rc.bottom - pabd->rc.top;
pabd->rc.left = 0;
pabd->rc.right = GetSystemMetrics(SM_CXSCREEN);
}
// Query the system for an approved size and position.
SHAppBarMessage(ABM_QUERYPOS, pabd);
// Adjust the rectangle, depending on the edge to which the
// appbar is anchored.
switch (uEdge) {
case ABE_LEFT:
pabd->rc.right = pabd->rc.left + iWidth;
break;
case ABE_RIGHT:
pabd->rc.left = pabd->rc.right - iWidth;
break;
case ABE_TOP:
pabd->rc.bottom = pabd->rc.top + iHeight;
break;
case ABE_BOTTOM:
pabd->rc.top = pabd->rc.bottom - iHeight;
break;
}
// Pass the final bounding rectangle to the system.
SHAppBarMessage(ABM_SETPOS, pabd);
// Move and size the appbar so that it conforms to the
// bounding rectangle passed to the system.
MoveWindow(pabd->hWnd, pabd->rc.left, pabd->rc.top,
pabd->rc.right - pabd->rc.left,
pabd->rc.bottom - pabd->rc.top, TRUE);
}
Als ich versucht habe diesen Code anzuwenden, bekam ich ein paar Probleme.
Mein erstes Problem tauchte schon beim hinzufügen der Funktion auf. Wie soll man das PASCAL in den Namen bekommen(was bedeutet es überhaupt). Wenn man die Funktion mit dem Assistent hinzufügt, lässt er es nur zu, dass man void und AppBarQuerySetPos schreibt, aber nicht void PASCAL AppBarQuerySetPos.
2.Problem:
MoveWindow übernimmt nur 5 Argumente und nicht 6. Ich habe dann einfach das erste weggelassen, da ich es nicht für nötig halte(geht das oder muss ich es anderes erledigen?).
3.Problem bezieht sich auf die Argumente der Funktion:
Was ich für UINT uEdge einsetze ist klar z.B. ABE_TOP.
Doch was ist mit den anderen beiden lprc und pabd. Verstehe nicht ganz was ich da übergeben soll.
Ich weiss, dass es eine Menge Fragen sind. Ich hoffe, dass ihr mir weiter helfen könnt und ich euch nicht zu sehr auf die Nerven gehe.
Schon mal Danke