I have this code for finding the windows system directory
dir : string;
WinDirLen := GetSystemDirectory(WinDir,255);
dir := Windir;
and use the 'dir' like this
Image1.Picture.Bitmap.LoadFromfile(dir + \1.bmp);
But I need this code for finding the windows system dir many times. writing to every event that needs it makes my code large so I need to put it in a function or procedure so I only need to call it once.
I tried a few times, but I don't seem to get it to work. Can someone please fill it in for me. I give the maximum of points, I only ask that the function or procedure is complete so that I don't have to add anything. and then show me how to call it using the Image1.Picture.Bitmap.Loadfromfile example