GLBasic forum

Other languages => GLBasic - de => Topic started by: D2O on 2010-Mar-26

Title: Mal wieder GetCommandline$() und Drag and Drop
Post by: D2O on 2010-Mar-26
Ich weis jetzt nicht ob das so sein muss, aber.
Wenn ich z.b. mit Drag and Drop eine Datei auf eine *.exe gezogen habe, ging das nicht,

und zwar weil GETCOMMANDLINE$() hier als Rückgabewert den Pfad der *.exe + den Pfad der Datei ausgibt.
Nicht nur das, auch unterschiedlich ob die *.exe eine "normale" *.exe oder einen Consolenanwendung ist.

Bei der Normalen *.exe sind bei der Pfadangabe auch noch die  " " mit dabei.

Das ist Doch nicht richtig, oder?

Beispiel ausgabe:

Normal:   
Quote"E:\Basic\Projekte\GLBasic_Projekte\GLBasic\MyCLS\MyCLS.app\MyCLS.exe" E:\Basic\Projekte\GLBasic_Projekte\GLBasic\MyCLS\MyCLS.app\icon.png
Console: 
QuoteE:\Basic\Projekte\GLBasic_Projekte\GLBasic\MyCLS\MyCLS.app\MyCLS.exe E:\Basic\Projekte\GLBasic_Projekte\GLBasic\MyCLS\MyCLS.app\icon.png

Gebraucht wird hier aber nur:
QuoteE:\Basic\Projekte\GLBasic_Projekte\GLBasic\MyCLS\MyCLS.app\icon.png

Umgehen tue ich das ganze im moment so:


Code (glbasic) Select

cls$  = GETCOMMANDLINE$()

cls$ = My_CLS_CONSOLE$(cls$)


FUNCTION My_CLS_CONSOLE$ : l_in$

LOCAL l_out$
LOCAL l_count%
l_out$ = MID$(l_in$,0,3)  // 0 für console, 1 für Graphicmodus
l_count% = INSTR(l_in$," "+l_out$,0)

l_out$ = MID$(l_in$,l_count%+1)

RETURN l_out$
ENDFUNCTION


FUNCTION My_CLS_GLB$ : l_in$

LOCAL l_out$
LOCAL l_count%
l_out$ = MID$(l_in$,1,3)  // 0 für console, 1 für Graphicmodus

l_count% = INSTR(l_in$," "+l_out$,0)

l_out$ = MID$(l_in$,l_count%+1)

RETURN l_out$
ENDFUNCTION



Bug oder Feature?
Title: Re: Mal wieder GetCommandline$() und Drag and Drop
Post by: Kitty Hello on 2010-Mar-26
Wann wird der Programmname nicht mit angegeben? Das wäre dann ein Bug.
Title: Re: Mal wieder GetCommandline$() und Drag and Drop
Post by: D2O on 2010-Mar-27
Hmmm, OK.
Dann muss ich mal davon ausgehen dass das Normal ist, damit kann ich leben und man kann es ja einfach anpassen.
Aber warum sind einmal die " " mit dabei und bei consolenanwendungen nicht?
Title: Re: Mal wieder GetCommandline$() und Drag and Drop
Post by: Kitty Hello on 2010-Apr-06
Bug.
Title: Re: Mal wieder GetCommandline$() und Drag and Drop
Post by: Kitty Hello on 2010-Apr-08
Feature!
Bei Windows Programmen wird der Programmname _immer_ mit "" angegeben. Bei Konsolenprg hab ich das nur gemacht, wenn ein Leerzeichen drin ist. Ich hab's geändert, dass _immer_ mit "" angegeben wird.

Ich habe mal eine Funktion gemacht die das splitten kann:
http://www.glbasic.com/forum/index.php?topic=2066.msg15078#msg15078 (http://www.glbasic.com/forum/index.php?topic=2066.msg15078#msg15078)
Title: Re: Mal wieder GetCommandline$() und Drag and Drop
Post by: D2O on 2010-Apr-08
Ah, alles klar.

Danke.