[BCB] GetCurrentDirectory();

0

Hej!

Chciałem zrobić sobie programik który odpalał by iexplorer.exe z parametrami "-k GetCurrentDirectory();/index.html" żeby dało się odpalić stronkę z płytki... zrobiłem coś takiego:

#include <windows.h>
#include <winbase.h>
#include <shellapi.h>
#include <string.h>
#include <dir.h>
#include <stdio.h>


char *current_directory(char *path)
{
  strcpy(path, "X:\\\\");      /* fill string with form of response: X:\\ */
  path[0] = 'A' + getdisk();    /* replace X with current drive letter */
  getcurdir(0, path+3);  /* fill rest of string with current directory */
  return(path);
}

int PASCAL WinMain(HANDLE,HANDLE,LPSTR,int)
{
  char* b;
  char curdir[MAXPATH];
  current_directory(curdir);

  b="-k ";
  b=strcat(b, curdir);
  b=strcat(b, "/index.html");

  ShellExecute(NULL,"open","iexplore", b, NULL,SW_SHOWNORMAL);
  return 0;
}

Ale nie chce działać :-/

Żeby było śmieszniej jak usunę linijki:

 b="-k ";
 b=strcat(b, curdir);
 b=strcat(b, "/index.html");

i dam zamiast b curdir (w ShellExecute) to mi otwiera dany folder...

0

pytanko: jakiego kompilatora uzywasz??

1 użytkowników online, w tym zalogowanych: 0, gości: 1