Posted By: croman
Open/browse dialog - 06/08/09 12:53
How can i make an open/browse dialog in lite-c? Dialog like: File->Open dialog in sed, wed, med...
STRING* filename = "#25"; [...] OPENFILENAME ofd; char buf[256]; FillMemory(&ofd,sizeof(ofd),0); FillMemory(buf,256,0); ofd.Flags=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_NOCHANGEDIR; ofd.lStructSize=sizeof(ofd); ofd.hwndOwner=hWnd; ofd.lpstrFilter ="Portable Network Graphic\0*.png\0\0"; ofd.lpstrInitialDir = _chr(""); //work_dir ofd.lpstrFile=buf; ofd.nMaxFile=255; ofd.lpstrTitle="Lade eine Levelbitmap"; if (GetOpenFileName(&ofd)) { str_cpy(filename, ofd.lpstrFile); }
//LITE-C var fhandle = file_open_read("test"); if(fhandle) { file_close(fhandle); printf("file exists"); } else { printf("file DOESNT exist"); } //when you have included "windows.h" if(GetFileAttributes("test.txt")+1) { printf("file exists"); } else { printf("file DOESNT exist"); } //also used like this when filename is in a 3DGS string if(GetFileAttributes(filename_string.chars)+1) { printf("file exists"); } else { printf("file DOESNT exist"); }
if(menutyp == 0) { menupart_x = (screensize.x*0); menupart_y = (screensize.y*0); var filecounter = 1; while(filecounter != 5) { if(filecounter == 1) { if(GetFileAttributes("chronicle_1.sav")+1) {PANEL* button_1 = pan_create("pos_x=71;pos_y=131;flags=SHOW; button(0, 0, icon_save13, icon_save11, icon_save12, call_file_1, NULL, NULL);",2);printf("1 existiert");} else {PANEL* button_1 = pan_create("pos_x=71;pos_y=131;flags=SHOW; button(0, 0, button_leer, button_leer, button_leer, new_file_1, NULL, NULL);",2);} } if(filecounter == 2) { if(GetFileAttributes("\\Saves\chronicle_2.sav")+1) {PANEL* button_2 = pan_create("pos_x=71;pos_y=131;flags=SHOW; button(0, 0, icon_save23, icon_save21, icon_save22, call_file_2, NULL, NULL);",2);} else {PANEL* button_2 = pan_create("pos_x=71;pos_y=241;flags=SHOW; button(0, 0, button_leer, button_leer, button_leer, new_file_2, NULL, NULL);",2);} } if(filecounter == 3) { if(GetFileAttributes("\\Saves\chronicle_3.sav")+1) {PANEL* button_3 = pan_create("pos_x=71;pos_y=351;flags=SHOW; button(0, 0, icon_save33, icon_save31, icon_save32, call_file_3, NULL, NULL);",2);} else {PANEL* button_3 = pan_create("pos_x=71;pos_y=351;flags=SHOW; button(0, 0, button_leer, button_leer, button_leer, new_file_3, NULL, NULL);",2);} } if(filecounter == 4) { if(GetFileAttributes("\\Saves\chronicle_4.sav")+1) {PANEL* button_4 = pan_create("pos_x=71;pos_y=461;flags=SHOW; button(0, 0, icon_save43, icon_save41, icon_save42, call_file_4, NULL, NULL);",2);} else {PANEL* button_4 = pan_create("pos_x=71;pos_y=461;flags=SHOW; button(0, 0, button_leer, button_leer, button_leer, new_file_4, NULL, NULL);",2);} } filecounter += 1; } }