|
Hello Friends
When a window is minimised, it goes to taskbar at the location where the tray icon is there.
So if icon is towards right, the window is minimised to the right.
I remember there was a function with some name like setwindowanimation, but seems i am missing something.
anybody has got an idea of how to do that?
Regards
|
|
|
|
|
SoftwareDeveloperGoa wrote: When a window is minimised, it goes to taskbar at the location where the tray icon is there.
Not the "tray icon": the corresponding taskbar button.
Tray icons are other things.
SoftwareDeveloperGoa wrote: So if icon is towards right, the window is minimised to the right.
Yes, but ... what are you trying to achieve? Are you trying to change the task button relative positions?
The question is not clear.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
yes you are correct, it is taskbar
yeah i want a window to minimize to a specific location, irrespective of where it's taskbar icon is present.
it is all about that animation thing that windows displays for every window relative to taskbar icon's position
|
|
|
|
|
AnimateWindow is documented here[^].
But the animation the system uses to manage the top windows depends on the system settings and theme, not on the code of your app.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
|
Hi all,
i have an list ctrl with some items,i want to perform an action with each item of list ctrl than after performing action delete this item.
i m using this.
int count =m_List.GetItemCount();
for (int i=0;i<count;i++)
{
m_List.DeleteItem(i);
}
here items are not fetched according to its serial like if firstly i m use item 1,than next item here is item 3 than 5 and so on..
here all items are not processes by this loop
please tell me what can i do for this.
thanks in advance.
|
|
|
|
|
When you delete item 0, every other item moves up 1, so what was item 1 is now item 0.
Instead of using m_List.DeleteItem(i); , use m_List.DeleteItem(0);
The same goes for getting the data or string from each of the items, you are always using the first item in the list
|
|
|
|
|
int count =m_List.GetItemCount();
for (int i=0;i<count;i++)
{
//do msometing with item i
m_List.DeleteItem(0);
}
just like this。。
|
|
|
|
|
jixuduxing wrote: //do msometing with item i
Probably just a copy/paste mistake, but
int count =m_List.GetItemCount();
for (int i=0;i<count;i++) {
m_List.DeleteItem(0);
}
|
|
|
|
|
Or even easier to understand:
int count =m_List.GetItemCount();
for (int i=0;i<count;i++)
{
}
m_List.DeleteAllItems();
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
You should start using the MSDN documentation to learn about the classes you are implementing. Had you done so you would surely have found this[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Note that reversing the loop
for (int i = count-1; i >= 0; i--)
{
m_List.DeleteItem(i);
}
would solve you problem.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
int count = m_List.GetItemCount();
for (int i = count - 1;i >= 0; i--)
{
m_List.DeleteItem(i);
}
if you delete item from a list, you should delete it from the last to the first.
|
|
|
|
|
Facing an uphill batte against OpenGL vs. Vista/Win7 ...
Seems we cannot use GDI to BitBlt to do a screenshot when Aero is turned on.
Reading a lot on the web (opengl.org,gamedev.net, ...) about this, it looks like I need to use glReadPixels to get the RGB(A) values from the OpenGL buffer.
The issue is that I'm not certain how to transfer the resulting pixel array ( RGB(A) ) to something that Windows can use.
glPushAttrib(GL_PIXEL_MODE_BIT);
glReadBuffer(GL_FRONT);
glFlush();
glFinish();
unsigned char *glBuffer = new unsigned char [width*height*4];
ASSERT( glBuffer) ;
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, glBuffer);
unsigned char* Buffer = new unsigned char [width*height*3];
unsigned char* ptmp = Buffer;
unsigned char* pbuffer = glBuffer;
for (int j=0; j<height; j++)
{
for (int i=0;i<width; i++)
{
*ptmp++ = *pbuffer++;
*ptmp++ = *pbuffer++;
*ptmp++ = *pbuffer++;
pbuffer++;
}
}
delete [] glBuffer;
HBITMAP hBitmap= ::CreateBitmap(width, height, 3, 24, Buffer);
ASSERT( hBitmap);
The array returns by glReadPixels looks ok, but creating the bitmap returns a NULL handle; at first, even if it did not work, I half expected to have a corrupted bitmap, but not just a NULL.
I'm certainly missing a lot of things, but I'm not certain what; probably mixing up context and some things ... all that I can find is that people say use glReadPixels and it works!
Any idea ?
Thanks.
Max.
Watched code never compiles.
|
|
|
|
|
I think the number of planes is supposed to be 1.
HBITMAP hBitmap= ::CreateBitmap(width, height, 1, 24, Buffer);
ASSERT( hBitmap);
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hi,
I am taking string ("Tom & Harry") from resource. In some system it is displaying like "Tom _ Harry" and some system it is fine "Tim & Harry"?
What is the problem? Please guide....
|
|
|
|
|
It sounds like the problem is where you're displaying it. If you using it in menus the & character is used the include an accelerator key. If this is the case use two &s.
Steve
|
|
|
|
|
If I remember correcly, the "&" will mark the following letter as the mnemonic (the underlined letter in the menu).
Resources strings for UI need to have "&&" : "Tom && Jerry'
(look at the documentation).
Watched code never compiles.
|
|
|
|
|
I’m trying to use ImageMagick for what I believed would be a simple task.
I want to generate a dimmed version of an image/icon at runtime in the application.
I use the magick++ c plus api.
I have found some commands that give me an ok result when run from the command line.
Converting the commands to the c++ api was a bit challenging, and the result is then not as hoped.
// Command example
convert -size 32x32 xc:"#999999" gray32.png
composite -dissolve 50% logo32.png gray32.png dim_logo32.png
How would this look in c++?
I came up with this.
Magick::Image gray;
gray.size( Magick::Geometry(image.columns(), image.rows()));
gray.read( "xc:#999999");
gray.label( "gray" );
if(gray.isValid()) {
gray.opacity(QuantumRange/2);
image.composite(gray, Magick::Geometry(image.columns(),image.rows()), Magick::DissolveCompositeOp );
But the transparency in the picture is lost.
A other suggestion as to make a dimmed image, is to make the full image semi transparent.
convert input.png -channel Alpha -evaluate Set 50% output.png
This could work. The transparency is kept when I tried this from command line.
Changing this to c++ api confused me a lot.
I ended up with this single line.
image.opacity(QuantumRange/ 2);
Now the result from this confuses me. The image is semi transparent, but the background that was originally transparent is now magenta.
orginal icon
dimmed icon
|
|
|
|
|
Thue Andersen wrote: Now the result from this confuses me. The image is semi transparent, but the background that was originally transparent is now magenta.
i suspect you've set the entire alpha channel to 128, not just reduced the exiting alpha by 1/2.
|
|
|
|
|
Aside from the transperency in the alpha channel, one pixel value can be chosen as fully transparent. This is often chosen to be magenta (R=255, G=0, B=255, A=255).
Now that you have modified the alpha component of every pixel, what was previously (R=255, G=0, B=255, A=255), is now (R=255, G=0, B=255, A=128). It's no longer recognised as fully transparent and instead treated as magenta at half transperency.
So to solve your problem, you'd have to either exclude the magenta (R=255, G=0, B=255, A=255) pixels from having their transperency halved or change the transparent pixel value to be (R=255, G=0, B=255, A=128).
modified on Friday, January 14, 2011 6:04 PM
modified 13-Sep-18 21:01pm.
|
|
|
|
|
So imagemagick internally uses magenta as transparent colour?
And when I changed the opacity of the whole image it also applied this for the transparent colour.
The two suggested solutions sound interesting,
I have tried to implement solution two.
image.opacity(MaxRGB / 2);
Magick::Color color(MaxRGB, 0, MaxRGB, MaxRGB / 2);
image.transparent(color);
But why is this exstra step necessary? In the command line we just set 50% alpha and done.
Would there be a better solution to create a dimmed icon?
|
|
|
|
|
Not an answer to your question, but what i don't understand is:
Why not render the dimmed icon offline (with the commandline) and read this icon in, during runtime? I guess you don't create icons in runtime on the fly, so what is the use to create a dimmed version in runtime?
|
|
|
|
|
Because the icons are defined by the end-user.
The system allows end-user to save his own icons into the database. To simplify this task he only has to provide one version of the icon, and we will generate the dimmed version automatically.
|
|
|
|
|
In the below code, I am attempting to count the number of letters and number of words in a phrase. In researching the return values of isalpha(), I noted that when a letter is present the first character isalpha() output is 1. But the second character isalpha() output is 2? The phrase that was input into this example was the following: How do you organize? Can someone help me with why I am not getting uniform output for the "H" character and the "o" character?
#include <stdio.h>
#include <ctype.h>
int main(void)
{
int ch;
float avg = 0;
int spaces = 0;
int letters = 0;
int test = 0;
int ltrcnt = 0;
int spccnt = 0;
while((ch = getchar()) != '\n')
{
test = isalpha(ch);
if(isalpha(ch) == 2)
{
ltrcnt++;
}
if(isspace(ch) == 8)
{
spccnt++;
}
}
printf("The Number Of Words Are %d , The Number Of Letters Are %d ",(spccnt+1),ltrcnt);
}
|
|
|
|