Search found 634 matches

by grindstone
Sep 20, 2019 9:38
Forum: Beginners
Topic: File created by an external program
Replies: 2
Views: 56

Re: File created by an external program

In Windows, you could try to open the file in exclusive mode. This will fail as long as the file is accessed by an other program: #Include "windows.bi" Dim As HANDLE fh Dim As String filename = "c:\testfile.txt" Do fh = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0...
by grindstone
Aug 31, 2019 15:04
Forum: Windows
Topic: open output file with no name
Replies: 2
Views: 543

Re: open output file with no name

If you slightly change this snippet to

Code: Select all

Dim as string filename1
Print Open (filename1 for output as #1)
Sleep
you'll see that it retrurns error code 2, meaning "File not found". So no file will be created.
by grindstone
Aug 24, 2019 13:49
Forum: General
Topic: Does FreeBASIC Have a Published Project Roadmap?
Replies: 3
Views: 1224

Re: Does FreeBASIC Have a Published Project Roadmap?

Does FreeBASIC have a published project roadmap? Alas, here in this forum those treasures are spread all over the place. But if you don't mind the german language, you will find a well-organized collection of code examples and projects on the german FB-site (partly with descripions in english). May...
by grindstone
Aug 24, 2019 12:27
Forum: Projects
Topic: Porting BASIC Code from Classic 8-Bitters to FreeBASIC?
Replies: 4
Views: 1402

Re: Porting BASIC Code from Classic 8-Bitters to FreeBASIC?

What's the best way to handle 8×8 bitmap tiles? Obviously, it's not going to be "overwrite the system font." With IMAGECREATE you can create tiles of any desired size. Is there anything like sprite functionality in FreeBASIC? No. You have to deal with this stuff yourself. But there are so...
by grindstone
Apr 17, 2019 12:39
Forum: General
Topic: Check if active
Replies: 4
Views: 391

Re: Check if active

Something like this? #Include "windows.bi" #Include "win\psapi.bi" Dim As HANDLE processhandle, hwnd Dim As ULong PID Dim As ZString*MAX_PATH filename hwnd = GetActiveWindow() If hwnd Then GetWindowThreadProcessId(hwnd, @PID) processHandle = OpenProcess(PROCESS_QUERY_INFORMATION ...
by grindstone
Mar 07, 2019 20:24
Forum: General
Topic: Loading Files
Replies: 6
Views: 557

Re: Loading Files

I would prefer the upper one, because FB does the memory management for me, and I can (mis-)use FB's string functions on the content.
by grindstone
Mar 07, 2019 9:41
Forum: General
Topic: Loading Files
Replies: 6
Views: 557

Re: Loading Files

Why that complicated?

Code: Select all

Open "MySoundFile.mp3" For Binary Access Read As #1
Dim As String g = Input(Lof(1), #1)
Close 1
by grindstone
Feb 08, 2019 10:56
Forum: Beginners
Topic: Matrix to string
Replies: 15
Views: 851

Re: Matrix to string

The sub is that awfully slow, because with every extension the whole existing string is copied to an other memory location. Better once create an empty string of spaces of the necessary length an then replace the spaces with the converted doubles (maybe even faster with indexed strings instead of MI...
by grindstone
Feb 08, 2019 9:13
Forum: Tips and Tricks
Topic: Image Painting Demos [Windows only]
Replies: 22
Views: 1580

Re: Image Painting Demos [Windows only]

@MrSwiss: You can't help doing it...

@UEZ: Just consider it as a nonbinding expression of opinion and follow your way.
by grindstone
Jan 29, 2019 18:44
Forum: Beginners
Topic: Ownership?
Replies: 18
Views: 1148

Re: Ownership?

Working without any problems here (WinXP 32bit / FB 1.05 / FBEdit / -s console). Running from the FB folder of my data partition (D:\freeBasic\...)
by grindstone
Jan 27, 2019 18:53
Forum: Game Dev
Topic: Having trouble with tilesheets
Replies: 4
Views: 1368

Re: Having trouble with tilesheets

If your problem is how to get an image section from an existing image, this can be done quite easy: ScreenRes 640,480,32 Dim As Any Ptr sourcepic = ImageCreate(200, 200) 'buffer for source picture Dim As Any Ptr grabpic = ImageCreate(100, 100) 'buffer for image section 'replace "marmot.bmp"...
by grindstone
Jan 26, 2019 14:18
Forum: Beginners
Topic: ShellExecuteW() (does a folder exist?)
Replies: 4
Views: 464

Re: ShellExecuteW() (does a folder exist?)

Sometimes I wonder why a BASIC dialect doesn't have BASIC functions like FileRead$() or IsFolder () ;-) Something like this? #Include "dir.bi" If Len(Dir("временная папка", fbDirectory)) Then Print "temp folder exists" Else Print "no temp folder" EndIf
by grindstone
Jan 21, 2019 10:04
Forum: Libraries
Topic: No german umlauts with libcurl
Replies: 25
Views: 2108

Re: No german umlauts with libcurl

If I submit "ä" instead of "%C3%A4" I get a response saying "Spezialseite nicht vorhanden" (special site not present).
by grindstone
Jan 20, 2019 16:26
Forum: Beginners
Topic: DIR does list (some) files as directories
Replies: 14
Views: 870

Re: DIR does list (some) files as directories

I would recommend to call DIR with all attributes set and check the desired attributes afterwards: #Include "dir.bi" ChDir "C:\Users\padawan\FreeBASIC-1.05.0-win64" Declare Sub listFiles (filespec As String, attrib As Integer) Sub listFiles (filespec As String, attrib As Integer)...

Go to advanced search