int init_crypto_module_ns (char *ns_name){ SLang_NameSpace_Type *ns = SLns_create_namespace(ns_name); if (ns == NULL) return -1; if (-1 == register_classes ()) return -1; if ( (-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL)) || (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL)) ) return -1; SSL_library_init(); OpenSSL_add_all_algorithms(); return 0; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); qApp->setApplicationName( QObject::tr("X Toolbox")); QTranslator * translator = new QTranslator(); translator->load(":chs.qm"); if(QLocale::system().language() == QLocale::Chinese) QApplication::instance()->installTranslator(translator); int ret = 0; lua_State* L = lua_open(); luaL_openlibs(L); luaopen_luagl(L); luaopen_luaglu(L); register_classes(L); MainWindow w; w.show(); //run_script_init(0); ret = a.exec(); //lua_close(L); return ret; }
//----------------------------------------------------------------------- // FUNCTION WinMain // PURPOSE: application entry point, register MainWindow class //----------------------------------------------------------------------- int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; hInst=hInstance; // conv_file(); init_path(); register_classes(hInstance); if(!(ghWndMain=CreateWindow("brainBay_Class", "BrainBay", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 10, 20, 900, 520, NULL, NULL, hInstance, NULL))) critical_error("can't create main Window"); else {GLOBAL.left=20;GLOBAL.top=20;GLOBAL.right=900;GLOBAL.bottom=520; } ShowWindow( ghWndMain, SW_SHOWNORMAL ); UpdateWindow( ghWndMain ); create_logfile(); write_logfile("BrainBay start."); GlobalInitialize(); ghWndStatusbox=CreateDialog(hInst, (LPCTSTR)IDD_STATUSBOX, ghWndMain, (DLGPROC)StatusDlgHandler); if(!(ghWndDesign=CreateWindow("Design_Class", "Design", WS_CLIPSIBLINGS | WS_CAPTION | WS_THICKFRAME | WS_CHILD | WS_HSCROLL | WS_VSCROLL ,GLOBAL.design_left, GLOBAL.design_top, GLOBAL.design_right-GLOBAL.design_left, GLOBAL.design_bottom-GLOBAL.design_top, ghWndMain, NULL, hInst, NULL))) report_error("can't create Design Window"); else { SCROLLINFO si; ZeroMemory(&si, sizeof(si)); si.cbSize = sizeof(si); si.fMask = SIF_TRACKPOS|SIF_RANGE|SIF_TRACKPOS; GetScrollInfo(ghWndDesign, SB_HORZ, &si); si.nMax=5000; si.nMin=0; si.nPos=0; si.nTrackPos=0; SetScrollInfo(ghWndDesign, SB_HORZ, &si,TRUE); GetScrollInfo(ghWndDesign, SB_VERT, &si); si.nMax=5000; si.nMin=0; si.nPos=0; si.nTrackPos=0; SetScrollInfo(ghWndDesign, SB_VERT, &si,TRUE); ShowWindow( ghWndDesign, TRUE ); UpdateWindow( ghWndDesign ); } if (GLOBAL.startup) { if (!load_configfile(GLOBAL.configfile)) report_error("Could not load Config File"); //else sort_objects(); } update_status_window(); UINT timerid= timeSetEvent(30,5,AnimProc,1,TIME_PERIODIC | TIME_CALLBACK_FUNCTION); // main message loop while (TRUE) { check_keys(); if(!GetMessage(&msg, NULL, 0, 0)) break; TranslateMessage(&msg); DispatchMessage(&msg); } timeKillEvent(timerid); return msg.wParam; }
// main function. int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinst, LPSTR cmdline, int show) { instance = hinstance; InitCommonControls(); register_classes(); h_font = CreateFont(-11, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS Sans Serif"); GetModuleFileName(NULL, MyPath, sizeof(MyPath)); //fprintf (stderr, "MyPath = %s\n", MyPath); if (!SHGetSpecialFolderPath(NULL, ConfigPath, CSIDL_LOCAL_APPDATA, 0)) { //fprintf (stderr, "Cannot determine LocalAppData folder\n"); } else { } strcat (ConfigPath, "\\.sif2\\"); _mkdir (ConfigPath); //fprintf (stderr, "ConfigPath = %s\n", ConfigPath); config_init (); hMainWindow = create_wnd0(); memset (&clfnt, 0, sizeof(clfnt)); clfnt.lfHeight = -MulDiv(OptFontHeight, GetDeviceCaps(GetDC(hMainWindow), LOGPIXELSY), 72); clfnt.lfWidth = 0; clfnt.lfEscapement = 0; clfnt.lfOrientation = 0; clfnt.lfWeight = FW_NORMAL; clfnt.lfItalic = 0; clfnt.lfUnderline = 0; clfnt.lfStrikeOut = 0; clfnt.lfCharSet = RUSSIAN_CHARSET; clfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; clfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; clfnt.lfQuality = DEFAULT_QUALITY; clfnt.lfPitchAndFamily = DEFAULT_PITCH | FF_MODERN; strcpy (clfnt.lfFaceName, OptFontFace); h_font_code = CreateFontIndirect(&clfnt); create_wnd_content0(hMainWindow); _fullpath (CurrentPath, ".", sizeof(CurrentPath)); strcat (CurrentPath, "\\"); current_path_to_edit (); SetFocus(GetDlgItem(hMainWindow, IDC_TXT)); resize_controls (); recent_load (); recent_fill_combo (IDC_RECENT); set_options (); populate_dir (); search_init (); hDlgCurrent = hMainWindow; if (!SHGetSpecialFolderPath(NULL, SendtoPath, CSIDL_SENDTO, 0)) { //fprintf (stderr, "Cannot determine SendTo folder\n"); } else { //fprintf (stderr, "SendtoPath = %s\n", SendtoPath); } strcat (SendtoPath, "\\Search in files.lnk"); if (CreateShortCut(MyPath, "", SendtoPath, "Search in files", SW_SHOWNORMAL, "", "", 0) < 0) { //fprintf (stderr, "Error create shortcut %ld\n", GetLastError()); } do_gui_main_action (cmdline); return message_loop(); }