Search found 1064 matches

by Randy Walker
Tue Sep 09, 2025 12:08 am
Forum: Coding Questions
Topic: PlaySound Plays Short of Full Wav file
Replies: 3
Views: 353

Re: PlaySound Plays Short of Full Wav file


Played here always immediately and complete: Win10 x64 PB 6.21 x86 asm backend.

InitSound()

If LoadSound(0,"Copied.wav")
PlaySound(0,0,100)
Delay(1000)
FreeSound(0) ; The sound is freed
EndIf



I was testing in PBv6.21 also but Windows 11 so maybe a difference there. After applying a ...
by Randy Walker
Mon Sep 08, 2025 8:20 pm
Forum: Coding Questions
Topic: PlaySound Plays Short of Full Wav file
Replies: 3
Views: 353

PlaySound Plays Short of Full Wav file

When I run this code I get a short grunt instead of full enunciation of the word "Copied". If I try it again immediately it will play the full wav file. If I wait 10 seconds and try again, it just gives me another grunt. What am I missing?
InitSound() ; Initialize Sound system
;UseOGGSoundDecoder ...
by Randy Walker
Mon Sep 08, 2025 7:17 am
Forum: Coding Questions
Topic: ListIcongadget column order after D&D
Replies: 1
Views: 229

Re: ListIcongadget column order after D&D

OK, I found this thread almost identical question, Seems RASHAD has a handle on it and tried to clarify but I'm still stumbling through to try to make sense of it:
viewtopic.php?p=432351&hilit=ListIconga ... er#p432351
by Randy Walker
Mon Sep 08, 2025 6:12 am
Forum: Coding Questions
Topic: ListIcongadget column order after D&D
Replies: 1
Views: 229

ListIcongadget column order after D&D

I just learned about the #PB_ListIcon_HeaderDragDrop flag but if the user swaps column positions around, how can I know what they are and how to restore them to the user preference after program restart? Is it even possible?
by Randy Walker
Wed Sep 03, 2025 6:19 pm
Forum: Coding Questions
Topic: [SOLVED] Trick to catching errror that causes crash?
Replies: 2
Views: 301

Re: [SOLVED] Trick to catching errror that causes crash?


...I eventually find out it's due to my own coding mistakes, so it's made me a better coder by having to discover the crash on my own when OnError doesn't help.

Yeah, I can only hope that one day I will be able to spot the errors in my code. I've been fortunate for the most part up until now ...
by Randy Walker
Wed Sep 03, 2025 3:16 am
Forum: Coding Questions
Topic: [SOLVED] Trick to catching errror that causes crash?
Replies: 2
Views: 301

[SOLVED] Trick to catching errror that causes crash?

My main project will occasionally crash for no apparent reason, even when running in the debugger. All the debugger tells me is the program terminated unexpectedly. Maybe OnError could catch it, but don't understand how to use that. The OnError.pb sample code is very informative but I need to know ...
by Randy Walker
Mon Sep 01, 2025 6:28 pm
Forum: Tricks 'n' Tips
Topic: Self-Deleting EXE File
Replies: 9
Views: 732

Re: Self-Deleting EXE File


@Randy:

Here are a few suggestions for improvement from me (not exhaustive):

EnableExplicit; Always use!

Procedure DeleteThisEXE()

Protected TrashDir$, CleanupBat$, CleanupBatString$
Protected MessageRequesterResult, FileHandle

MessageRequesterResult = MessageRequester("Proceed?", "We ...
by Randy Walker
Mon Sep 01, 2025 6:16 pm
Forum: Tricks 'n' Tips
Topic: Self-Deleting EXE File
Replies: 9
Views: 732

Re: Self-Deleting EXE File


As far as I remember, a label must begin with a colon.

That is also how I recall it but grey matter is not what it used to be.
I've tested it several times and the executable worked flawlessly.
Create the executable and try it yourself.
Possible in my case it was fully successful on first pass ...
by Randy Walker
Sat Aug 30, 2025 5:56 pm
Forum: Coding Questions
Topic: How do I get #WM_QUIT on reboot?
Replies: 21
Views: 3643

Re: How do I get #WM_QUIT on reboot?


@Randy Waler:
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory.

BTW: The batch solution is a quite good one.

I figured it was a permissions issue preventing your solution from working for me and decided best not ...
by Randy Walker
Sat Aug 30, 2025 5:39 pm
Forum: Tricks 'n' Tips
Topic: Self-Deleting EXE File
Replies: 9
Views: 732

Re: Self-Deleting EXE File

Hi Kiffi... Thanks for reviewing my code. I like the way you cleaned up the bat file creation.
I thought variables inside a procedure were automatically protected so I never bother with it.
The MessageRequester was only there for demonstration purposes and should probably be removed in real practice ...
by Randy Walker
Sat Aug 30, 2025 6:25 am
Forum: Tricks 'n' Tips
Topic: Win32 - Delete running application (uninstall)
Replies: 10
Views: 11367

Re: Win32 - Delete running application (uninstall)

This is another attempt to do the same thing:
viewtopic.php?p=644643#p644643
by Randy Walker
Sat Aug 30, 2025 3:50 am
Forum: Coding Questions
Topic: Self file after exit or working dir. delete + refresh
Replies: 7
Views: 1179

Re:


It doesn't delete the working directory of the exe while it is running, what i am trying to do is delete the file and folder it is in after exit, any help?

I figure by now you have found your solution but just in case OR if anyone else is searching for a solution to delete your own EXE and the ...
by Randy Walker
Sat Aug 30, 2025 3:25 am
Forum: Tricks 'n' Tips
Topic: Self-Deleting EXE File
Replies: 9
Views: 732

Re: Self-Deleting EXE File

BarryG wrote: Sat Aug 30, 2025 3:19 am There's lots of posts on how to do this. Just search. ;)
I searched and searched, but nothing found.
by Randy Walker
Sat Aug 30, 2025 3:19 am
Forum: Coding Questions
Topic: How do I get #WM_QUIT on reboot?
Replies: 21
Views: 3643

Re: How do I get #WM_QUIT on reboot?


Example : delete file at next Windows startup
MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)

I had no luck getting this trick to work but I did a lot of research and hacking to find a way for an EXE to delete itself. The answer is here:
https://www.purebasic.fr ...
by Randy Walker
Sat Aug 30, 2025 3:14 am
Forum: Tricks 'n' Tips
Topic: Self-Deleting EXE File
Replies: 9
Views: 732

Self-Deleting EXE File

I struggled and hacked at this for most the day trying to get it to work. Maybe someone with better knowledge could purify it a bit. You'll need to create this as an executble and put in an empty folder named C:\Test and when you run it it will vanish all traces of the EXE and the BAT that it ...