Shortcut Dll Problem

  • GM 7

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Shortcut Dll Problem

    Hi, ich hab ein Problem mit der Shortcut Dll, folgendes habe ich vor:

    Also ich wollte mit dem GM ein Installationsprogramm programmieren, welches mit der Shortcut Dll und einer Exe (z.b. ein Spiel) in einem Ordner ist.
    Das Programm soll dann dieses Spiel finden mit file_find_first, in einen Ordner kopieren und die Datei löschen und dann noch eine Verknüpfung auf dem Desktop erstellen.
    Alles klappt soweit, bis auf den Error: unexpected error occured when running the game
    Und es erstellt die Verknüpfung nicht auf dem Desktop sondern im Ordner, das hier ist der Code:

    GML-Quellcode

    1. //scr_shortcut
    2. //Arguments - [3]
    3. //0 - .lnk path - path to the shortcut to be created including the filename
    4. //1 - .exe path - path to the executable to create a shortcut to
    5. //2- description - optional shortcut description, if not needed use ""
    6. //3- working directory - directory to run the exe in (you might need to include the final backslash )
    7. ///////////////////
    8. global.defTestDLL_CreateShortcut=external_define("Shortcut.dll","makeShortCut",dll_stdcall,ty_real,4,ty_string,ty_string,ty_string,ty_string);
    9. arg0=string_replace_all(argument0,"\","\\")
    10. arg1=string_replace_all(argument1,"\","\\")
    11. external_call(global.defTestDLL_CreateShortcut,arg0,arg1,argument2,argument3);
    12. external_free("Shortcut.dll")
    Alles anzeigen

    GML-Quellcode

    1. //Create
    2. linkfile = file_find_first(working_directory + "\*.exe",0);
    3. speicherort = get_string("Where do you want to save your game?","C:\Programme\");
    4. if !directory_exists(speicherort)
    5. {directory_create(speicherort);}
    6. file_copy(linkfile,speicherort + linkfile);
    7. file_delete(linkfile);
    8. shortcut = string_copy(linkfile,1,string_pos(".",linkfile)-1);
    9. dll_shortcut(shortcut + ".lnk",speicherort + linkfile,"","Desktop\");


    Weiß jemand, warum dieser Error kommt, hat vllt schonmal jemand die Shortcut Dll verwendet?


    Danke,
    Gruß Gamer.
    Gruß Gamer
  • Check mal, ob die ganzen pfade im rihctigen Moment stimmen.
    zb is linkfile nicht der komplette Pfad? So gibt doch speicherort + linkfile sowas wie: "C:\Blabla\C:\Linkfile"
    "das war meine letzte flamewar PM an dich ."
  • achso, stimmt, aber daran liegt es nicht, da ich davor das mit dem speicherort weggelassen habe und es auch nicht funktioniert hat.

    Dann müsste es speicherort + shortcut + ".exe" heißen, stimmts?
    Gruß Gamer

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von The Gamer ()

  • Nein ich mein, du hast möglicherweise zweimal C:\ drinne weil beide Pfade die kompletten Pfade sind, von Linkfile brauchste ja nur den Filenamen und nich den ganzen Pfad..
    "das war meine letzte flamewar PM an dich ."