TThread inside component's Code -Delphi 7 - delphi

I have created a new component to play the wave & MP3 files the component contains Tprogressbar and Play Button for tracking the playing position , and I have acheived this by using TIdThreadComponent inside loop , The components works perfect , But I want to use the TThread instead of TIdThreadComponent , Thank you in advance ..

As Mr.Fpiette I have Used TTimer instead of the Tthread ... & It works perfect..
the result :

Related

Many panels with buttons Play vidéos in c# with vlcPlugin

I want to Play an URL like this "http//:........" in my application with vlcPlugin (axVlc..21) , i use 3 or 4 user controls 'panels) with buttons to Play everyone a live channel, but when i use a panel and if i clik the buuton i have not the axVlc..21 , and i don't know how i déclare différent panels to Control vlcplayer!!
please help me ..
Greetings !

Refresh Bitmap Firemonkey

I use Delphi 10.2 Tokyo, and I have a TForm with a TImage.
I load a PNG file to MultiResBitmap property and set WrapMode to Fit.
When I run my application and click on a button, I need to change this picture and load a JPG file.
I use Image.Bitmap.LoadFromFile if the file is on the harddrive or Image.Bitmap.LoadFromStream if the JPG file is from a WebService (Get from IdHTTP). Both are on a Try...Finally with Image.BeginUpdate and Image.EndUpdate;
That's ok I see my new picture but the bottom isn't really good, I see a part of the previous picture. I need to move the TForm outside of my screen to see it full.
I try Image.Repaint at the end or to Clear the Bitmap before load the new file with Image.Bitmap.Clear(TAlphaColors.White) but that's change nothing.
Somebody know why ?
Edit: I forgot to say that TransparentColor is set on White.
First:
Second:
After moving out of screen :
Just do it as:
Image1.MultiResBitmap[0].Bitmap.LoadFromFile('Location\Image.jpg');
Try without BeginUpdate and EndUpdate.

DX10 setfullscreenstate not working on second monitor

I have two display monitors connected to my pc.
I am using DirectX 10. I have a basic app, when I press space button I call;
swapChain->SetFullscreenState(true, 0);
to make it fullscreen.
It works well on my main monitor, but when I move the app to other monitor and press space button it does not work. Also throws first-chance exception.
Is it enough to just call SetFullscreenState function ? Or do I have to make sth else ?
Thanks for help.
Edit : I solved this problem.
You must assign your monitor to an IDXGIOutput type variable and pass it to SetFullscreenState function as second parameter.
swapChain->SetFullscreenState(true, &curr_monitor);

Is there a way to keep a button from drawing an outline when selected?

I built a custom control, and with theme support on it looks very strange. Is there any way to make it so that it will always draw with themes off, even if the application is built with theme support on?
EDIT: I found a way to turn theming off and it didn't help much. The problem is that it's a special button descended from TBitBtn, and whenever the button is selected, it tries to draw a border around it with a dotted line and that gets in the way. How can I turn that off?
You can try to copy the implementation of TBitBtn.DrawItem and tweak it to your needs. A search for IsFocused inside the code should give you a guide.
To call your patched code you also have to link in the CNDrawItem method by implementing a similar message handler.
u can disable the theme for a component using the SetWindowTheme function found in UxTheme.pas
this will disable the theme for a button and a progressbar
...
SetWindowTheme(Button.Handle, ' ', ' ');
SetWindowTheme(ProgressBar.Handle, ' ', ' ');
...

How do I make TProgressBar stop lagging?

I've got an app that runs a long set of operations, and I'm trying to use a TProgressBar to keep track of what's going on. I set a number of steps, and call .StepIt to increment the progress bar.
Problem is, it doesn't keep up very well. Instead of jumping directly to the correct position, it seems to like to slide gradually up to it. That's all well and good if it's eye candy you're after, but when I'm trying to get an accurate representation of my routine's progress, this makes it appear to be constantly lagging behind the true status. How can I turn that "feature" off?
I only notice this happening under Windows Vista. Not sure if it's also going on on XP or not, because when I test it on XP, the process goes a lot faster and it's over too quickly. :P But this may or may not be Vista-specific. Either way, it's driving me nuts. Does anyone know how to fix it?
I have a quick but partial and inelegant solution, if you don't mind having the progressbar yellow instead of green:
ProgressBar1.SmoothReverse := True;
ProgressBar1.State := pbsPaused; // for yellow or pbsError for red
Or if you don't mind loosing the vista/theme look and go back to a flat blue one:
UxTheme.SetWindowTheme(ProgressBar1.Handle, ' ', ' ');
The real "problem" according to Microsoft is that you try to "pervert" a ProgressBar into a Meter which they claim it is not.
You could also try to draw it yourself ;-)
Same problem on Windows7 !!
But the answer was already in one of the older posts:
If tou make the progressbar step backwards there will NO delay !!!
So I implemented this..... (and get instant updates)
if(progress < ProgressBar.Max)
then
begin
ProgressBar.Position := progress+1;
ProgressBar.Position := progress; //This will set Progress backwards and give an instant update....
end
else
begin //cannot set position beyond max...
ProgressBar.Max := progress + 1;
ProgressBar.Position := progress + 1;
ProgressBar.Max := progress; //This will also set Progress backwards also so instant update........
end;
I ran into exactly the same problem a while ago. After searching Google for a long time, I found that it is a Vista-specific problem. It seems to boil down to this: Microsoft added fancy animations to the progress bar control in Vista (i.e., the moving 'highlight'). To make updates more smooth, they implemented some sort of 'lagging' in the repaint of the control --- and this basically screws the whole progress bar control. Rather annoying, I'd say, especially since there doesn't seem to be a decent solution.
See for more details the replies by Arvid Winkelsdorf to this Embarcadero Discussion Forum post:
It's the same for VB, C++ and C#
somehow as the problem lies in the
Vista drawing of the new animated
ProgressBars. To provide a smoother
visual feedback drawing is delayed
when moving forward. Your application
cannot be sure that 100% will be
reached at any given time.
By setting the position back to a
smaller value, the ProgressBar drawing
is forced to jump back. No delay in
getting to a position smaller than the
current. So you'll have nearly 100%
immediately. Afterwards set to the
maximum and you'll have exactly 100%.
[...]
There is a similar glitch when using
the new Vista ProgressBar Styles like
PB Paused or PB Error. If the bar is
still moving (MS part) and your app
sets the color to paused by
SendMessage (like in D2009) the
message will be ignored by the
ProgressBar.
Maybe you can try to set the position of the ProgressBar directly instead of using the StepIt procedure. I'm on XP with Delphi 7 here, so I can't test it, but looking at the code of TProgressBar it uses a different message (PBM_SETPOS instead of PBM_STEPIT). So maybe it sets the position of the progressbar without an animation.
Additionally there are several 3rd party components which provide better Progress bar implementations that still render nice on Vista. Personally, I prefer the one from Raize components which works quite well. It doesn't "lag" like the windows control does and works independent of any theming.
If you don't really want anything fancy, then you can always build one yourself using a panel and a tshape aligned left inside the panel. Resize the tshape to be a % of the panel it sets on.
I had the same problem, my solution was to switch to another control available in the VCL :
I choose to use the Range of TTrackBar to display the progression.
(with slider off and control resized to hide the range marks).
Not the same visual (particulary if themed), but it fit well my need (no lag).
Here is a simple solution:
ProgressBar.max := ProgressBar.max +1;
ProgressBar.StepBy(2);
ProgressBar.StepBy(-1);
ProgressBar.max := ProgressBar.max -1;

Resources