warum die .exe datai läuft langsamer als früher?
-
Hallo,
ich hab ein neues win-console Project in meiner elemaligen Solution eingefügt, um die Algorithmen zu testen und "cout" zu benutzen. aber warum die .exe datai läuft deutlich langsamer als früher?
-
ich hab 81 edit-controls in einem Dialog-control.
Wenn ich "default :" nehme, wird dann mein Programm langsamer!!! aber warum?LRESULT CALLBACK EditDLGProc(HWND hwnd, UINT message,WPARAM wParam, LPARAM lParam) { int id = GetWindowLong(hwnd, GWL_ID); HWND parent = GetParent(hwnd); switch (message) { case WM_KEYDOWN : if (wParam == VK_LEFT) { SetFocus(GetDlgItem(parent, (id+80)%81)); SendMessage(GetDlgItem(parent, (id+80)%81), EM_SETSEL, 0, -1); } if (wParam == VK_RIGHT) SetFocus(GetDlgItem(parent, (id+1)%81)); if (wParam == VK_UP) { SetFocus(GetDlgItem(parent, (id+72)%81)); SendMessage(GetDlgItem(parent, (id+72)%81), EM_SETSEL, 0, -1); } if (wParam == VK_DOWN) { SetFocus(GetDlgItem(parent, (id+9)%81)); SendMessage(GetDlgItem(parent, (id+9)%81), EM_SETSEL, 0, -1); } /************************************************************************** // default : --- viel langsamer ***************************************************************************/ SendMessage(GetDlgItem(parent, (id+1)%81), EM_SETSEL, 0, -1); break; } return CallWindowProc(beforeEdit[id], // parent WndProc hwnd, message, wParam, lParam); }
-
Also dein default sitzt schon mal an der falschen Stelle, aber ich würde es ohnehin so machen:
LRESULT CALLBACK EditDLGProc(HWND hwnd, UINT message,WPARAM wParam, LPARAM lParam) { int id = GetWindowLong(hwnd, GWL_ID); HWND parent = GetParent(hwnd); switch (message) { case WM_KEYDOWN : if (wParam == VK_LEFT){ SetFocus(GetDlgItem(parent, (id+80)%81)); SendMessage(GetDlgItem(parent, (id+80)%81), EM_SETSEL, 0, -1); }else if (wParam == VK_RIGHT){ SetFocus(GetDlgItem(parent, (id+1)%81)); }else if wParam == VK_UP){ SetFocus(GetDlgItem(parent, (id+72)%81)); SendMessage(GetDlgItem(parent, (id+72)%81), EM_SETSEL, 0, -1); }else{ // dein default wird jetzt hier verarbeitet } break; // default : //kannste dir sparen } return CallWindowProc(beforeEdit[id],hwnd, message, wParam, lParam); }
-
ja, richtig. danke schön.
ich habe bemerkt, dass du "if...else if..." benutzst, frage:
welche Unterschied gibt es zwischen "if...if..." und "if...else if..." und "switch"?
-
if(a)
....if(b)
....<-> Unterschied
if(a)
....
else if (b)
....entspricht
if(a)
....
if(b && !a)
....Ein switch ist ganz was anderes