|
Does anyone know how to find the number of windows open at a given time? I've looked into enumwindows and the find/get window functions, but there must be a way to just ask the window manager for this piece of information without having to iterate through all the windows.
Thanks,
~Himanshu
|
|
|
|
|
What's wrong with:
BOOL CALLBACK EnumProc( HWND hwnd, LPARAM lParam )
{
PUINT puCount = (PUINT) lParam;
(*puCount)++;
return TRUE;
}
UINT uCount = 0;
EnumWindows(EnumProc, (LPARAM) &uCount);
TRACE(_T("The numer of top-level windows is: %u\n"), uCount);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I don't think there is a way to just get the count aside from the enumeration API.
However, you must make one distinction. Do you want:
a) ALL windows on the system?
b) ALL _VISIBLE_ windows on the system (There are a lot of windows on the system that are not visible)?
c) ALL _TOP LEVEL_ windows on the system?
There is also the question of do you want to include each little component such as each button, edit box, system tray, the desktop icons (progman), the task bar, etc. etc. etc. because all those little details get enumerated. All controls, etc.
Depending on what you are looking for would determine how you write the counting code to exclude and include the correct windows when you enumerate.
There is also "EnumChildWindows" which may need to be called on each top level enumerated window if you don't want just top level windows.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Toby Opferman wrote:
c) ALL _TOP LEVEL_ windows on the system?
"Top level windows" were specifically asked for in the subject.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok, He'll need to filter out the invisible windows, task bar, prog man and the system tray.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
That's if he doesn't want those, he needs to figure out if he really does want all the top level windows or only ones seen by the task bar (which then he would need to fitler things like side tool bars), etc.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Does anyone know of a function that returns the total ram size that is available on the hardware that your application is running on. I change the logic of my code based on whether I have 128 MB or 256 MB of ram on a given unit.
Thanks,
Himanshu
|
|
|
|
|
|
Yahoo! Thanks, exactly what I was looking for.
~Himanshu
|
|
|
|
|
For some reason I seem to have a problem with finding the function to retrieve the time. Could someone help out? I'd like to be able to do this without MFC if I could.
Danny
|
|
|
|
|
How about time() or GetSystemTime() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have some trouble using the code and library from the Independent JPEG Group. It only occurs with damaged jpg files. I tried and cximage can load that damaged files better than my functions. Besides, every professional pictureviewer/editor can do so. I posted the whole matter under the cimage article you can find on codeproject: http://www.codeproject.com/bitmap/cximage.asp[^]
Since the project is discontinued I can't rely that I get a answer there. So I hope some people using VC++ too can help me with that matter. I know the chances are very low since there are only few people using jpg decompression directly in theyr apps.
|
|
|
|
|
Jpeg's as most image systems use scan line by scan line decompression, that is, one line at a time. If you can track down the point at which it cycles through the lines you might be able to handle errors more gracefully than the default code does. JPeg uses DCT compression which is a very complicated algorithm as you can probly tell from the size of the code, but you can most likely work backwards from the decompression in the "main" code that uses all the other code, and catch it before it gets into the complicated bits. IIRC it is jpeg.c, but you should check that out.
|
|
|
|
|
I found a solution on my own. I posted it at the comments of the cximage article.
|
|
|
|
|
ofstream out("Matrices");
if(!out){
cout<<"cannot open file.\n";
return 1;
}
for(int i=0;i<row1;i++)
{for(int j=0;j<col1;j++){
out<<mat1[i][j];}}
out<<" *";
for(int w=0;w<row2;w++){for(int e=0;e<col2;e++){
out<<mat2[w][e];}}
out<<"=";
for(int u=0;u<row1;u++){for(int v=0;v<col2;v++){
out<<mat[u][v];}}
out.close();
in the followin part of code it is workin ver well but there is a proplem for me in the output
the output is
2333 *44=2024
how ever i want to make it in the way like that
2 3 * 4 = 20
3 3 4 24
or in any way so that the user can understand the output file & became able to know where is the first matrix is & the second one is and the output as well so
HOW CAN I DO THIS????????
|
|
|
|
|
Could you check the box that says
"Do not treat <'s as HTML tags"
and repost it?
|
|
|
|
|
It looks like you need to include some spaces in the output.
BTW, your post would be much more readable if it looked like:
ofstream out("Matrices");
if (! out)
{
cout << "cannot open file." << endl;
return 1;
}
for (int i = 0; i < row1; i++)
{
for(int j = 0; j < col1; j++)
out << mat1[i][j];
}
out << " *";
for (int w = 0; w < row2; w++)
{
for (int e = 0; e < col2; e++)
out << mat2[w][e];
}
out << "=";
for (int u = 0; u < row1; u++)
{
for (int v = 0; v < col2; v++)
out << mat[u][v];
}
out.close(); I suspect you are getting compiler errors from the bold lines. out should be cout instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
no there isnocompile errors becuse this out is to write inthe file
not cout
& istilldontknow what ihave todoin this proplem
i tried to use spaces inmany diffrent locations
but it is still dont come as i want so can u know wher exactly i have to put these spaces?
|
|
|
|
|
kosamoza wrote:
no there isnocompile errors becuse this out is to write inthe file
not cout
My bad. I did not look close enough to what you had.
kosamoza wrote:
i tried to use spaces inmany diffrent locations
but it is still dont come as i want so can u know wher exactly i have to put these spaces?
See if any of Christian's STL articles help with formatting:
http://www.codeproject.com/script/articles/list_articles.asp?userid=6556
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello there,
I tried to incorporate the following code segments in a VC++ project, and to compile it in Visual Studio. There were compiling errors beyond my comprehension. Any help are appreciated.
typedef void biasFn (void *image, void *bias, uint32 pixels);
#define subtract(bits) \
static void subtract##bits (void *i, void *b, uint32 pixels)\
{\
uint##bits *image = i;\
uint##bits *bias = b;\
while (pixels--) {\
*image = *image > *bias ? *image-*bias : 0;\
image++, bias++; \
} \
}
subtract(8)
subtract(16)
subtract(32)
static biasFn *lineSubtractFn (unsigned bits)
{
switch (bits) {
case 8: return subtract8;
case 16: return subtract16;
case 32: return subtract32;
}
return NULL;
}
|
|
|
|
|
Bugslayer1 wrote:
There were compiling errors...
I give up. What were the errors?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
When the VC++ compiles the following lines. It throws error messages:
subtract(8)
subtract(16)
subtract(32)
error C2440: 'initializing' : cannot convert from 'void *' to 'unsigned char *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
I also had hard to understand these lines of codes.
|
|
|
|
|
Ok, what is subtract() expecting?
You need to change lines in the subtract() macro to:
uint##bits *image = (uint##bits *) i;\
uint##bits *bias = (uint##bits *) b;\
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I do not know until I understand these lines of codes. The codes were compiled under Unix system. Problem is that I had a hard time to read the code. Can you explain to me what these lines of codes do?
|
|
|
|
|
Bugslayer1 wrote:
Can you explain to me what these lines of codes do?
No. You should be able to tell us what they do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|