Search found 3131 matches

by BarryG
Mon Apr 22, 2024 8:53 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

@Berry - your solution doesn't work, just press the button multiple time and you'll see it Seems to work fine here? Here's a sample debug output when I rapidly click the button. It shows each new thread alternating (the "T1" line followed by a "T2" line) with no misses. The idea...
by BarryG
Mon Apr 22, 2024 8:44 am
Forum: Announcement
Topic: PureBasic 6.10 LTS is out !
Replies: 334
Views: 41882

Re: PureBasic 6.10 LTS is out !

Is it because of the 3 "UPX" texts replacement in the header, that it's tagged as "corrupt" (malformed and will not execute in a real system)! Removing the 3 x "UPX" texts definitely seems to confuse the anti-virus apps, and it stops lay users from decompressing the ex...
by BarryG
Sun Apr 21, 2024 11:12 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

The sleep is just for this example. In my real app, the threads do some processing that takes a while, so the sleep was used here to stop the thread exiting too early and to simulate the further processing.
by BarryG
Sun Apr 21, 2024 4:10 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

Okay, this seems to be working for me in the way I need it. I can't see anything wrong with this approach? The goal is to show the time and date, from different threads, each time the button is clicked. Having one single global semaphore doesn't seem to be a problem? I'm not overlooking anything? Se...
by BarryG
Sun Apr 21, 2024 3:04 am
Forum: Coding Questions
Topic: Speed up loop
Replies: 13
Views: 576

Re: Speed up loop

This part is always recalculating "height-1" and "width-1" with each loop iteration, which is not optimal: For y=0 To Height -1 ;Loop image height For x = 0 To width - 1 ;Loop image width So do the calculation for them just once, like this: h1 = Height - 1 w1 = width - 1 For y=0 ...
by BarryG
Sat Apr 20, 2024 11:00 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

The Semaphore approach isn't going to work for me, because "Global Semaphore.i = CreateSemaphore()" is global and my threads are going to be called more than once, so a global semaphore for a thread is going to send the signal to the wrong thread callers, right?
by BarryG
Fri Apr 19, 2024 11:37 am
Forum: Announcement
Topic: PureBasic 6.10 LTS is out !
Replies: 334
Views: 41882

Re: PureBasic 6.10 LTS is out !

EXE compressors also sometimes have the opposite effect on anti-virus software: they become suspect. Hmm, not in my experience. Like I said, my apps get several false positives without UPX, and none with UPX. But I also manually replace the 3 x "UPX" text bytes from the file header of the...
by BarryG
Fri Apr 19, 2024 11:18 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

@STARGÅTE: Thanks for showing that. I should switch my Delays() to Semaphores() then for my threads? But, can I just use the one semaphore for all my different threads, or does each thread need its own dedicated semaphore? What I mean is, is doing it like this safe? It appears to be. ; Enable thread...
by BarryG
Thu Apr 18, 2024 10:14 pm
Forum: Feature Requests and Wishlists
Topic: PureBasic Librarian
Replies: 27
Views: 2711

Re: PureBasic Librarian

Axolotl wrote: Thu Apr 18, 2024 2:59 pmthe IDE does not support read only files
Say what? Yes, it does. I have dozens of read-only files included in my source. Have used them for years.
by BarryG
Thu Apr 18, 2024 10:09 pm
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

In both cases the information is passed just as a reference to the thread, and not as a variable or copy. That's why my example has "text$=PeekS(params)" as the first line of the thread: to create a local copy of the params so they're not lost. Sometimes you'll need a small delay after cr...
by BarryG
Thu Apr 18, 2024 12:38 am
Forum: Coding Questions
Topic: EditorGadget() placeholder text
Replies: 8
Views: 600

Re: EditorGadget() placeholder text

; Created by ChatGPT4 ; Konstanten für die Gadget-IDs Enumeration #Editor EndEnumeration ; Initialer Platzhaltertext Global Placeholder$ = "Bitte Text eingeben..." ; Fenster und EditorGadget erstellen If OpenWindow(0, 100, 100, 300, 100, "Editor mit Platzhalter", #PB_Window_Syst...
by BarryG
Thu Apr 18, 2024 12:33 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 25
Views: 1344

Re: Thread Parameters?

A simpler alternative if speed isn't an issue: ; Enable thread safety in Compiler Options! Procedure MyThread(params) text$=PeekS(params) n=CountString(text$,",")+1 For i=1 To n p$=StringField(text$,i,",") If p$ Debug p$ EndIf Next EndProcedure text$="1,2,3,4,5" ; Five ...
by BarryG
Mon Apr 15, 2024 10:00 pm
Forum: Coding Questions
Topic: Detect TaskBar events [Resolved]
Replies: 8
Views: 708

Re: Detect TaskBar events

What type of events? But yes, you can detect mouse clicks, and if it's visible, etc. Not as "events" but you can manually poll for them.
by BarryG
Mon Apr 15, 2024 8:43 am
Forum: Windows
Topic: Cancel shutdown/reboot?
Replies: 4
Views: 246

Re: Cancel shutdown/reboot?

Maybe this helps -> https://stackoverflow.com/questions/7538006/prevent-windows-shutdown-with-custom-message It says: "If you need to block shutdown you call ShutdownBlockReasonCreate passing the handle to your main window and the reason as a string. This string is what is displayed in the shut...
by BarryG
Mon Apr 15, 2024 8:24 am
Forum: Announcement
Topic: PureBasic 6.10 LTS is out !
Replies: 334
Views: 41882

Re: PureBasic 6.10 LTS is out !

Marc56us wrote: Mon Apr 15, 2024 7:43 amEXE compressors also sometimes have the opposite effect on anti-virus software: they become suspect.
With UPX it's no problem because it's so well-known that every AV just decompresses the exe before scanning.