|
Hi,
Sounds like an excellent project. When will you have it completed?
Best Wishes,
-David Delaune
|
|
|
|
|
*click*
Message marked as answered.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
somebody who know the Principle may will help me to solve the problem
thank you
|
|
|
|
|
Hi jeansea,
Your question is very difficult for us to understand. Please improve the question and we can help you. You need to be very specific about the problem you are trying to solve.
Best Wishes,
-David Delaune
|
|
|
|
|
|
I have created a Windows service in VC6 and wanted to know how can I implement a WndProc to handle Windows Messages inside the same.
Regards,
Kushagra
I hate coding but I luv to develop
|
|
|
|
|
You want to get the message of which window(s)?
i cannot understand.
Величие не Бога может быть недооценена.
|
|
|
|
|
Standard Windows Messages like WM_COMMAND,WM_TIMER and so on
|
|
|
|
|
From your words, i felt that you need to get some specific messages generated by any window globally.
if so then, it sound a different intention with it
well you have to hook WINDOWS messages globally using SetWindowHookEx with WH_CALLWNDPROC as hook id [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
A service runs in the background, so where are these WM_COMMAND's coming from? You won;t have a menu, or a dialog box...
I think you need to go back to your basics - a service communicates with other programs using various interprocess communcations.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
I know that but ... The purpose I wanted to know that is I wanted to either abort shutdown or delay the time so that I can run some cleanup scripts just before the system gets shutdown.
Regrads,
Kushagra
|
|
|
|
|
Hi,
I want to know that can i store output from readdir() function in an array. I have a c program
#include <dirent.h>
#include <stdio.h>
int main(void)
{
DIR *d;
struct dirent *dir;
d=opendir("C:\\");
printf("Directories in C:\\ \n");
while((dir=readdir(d))!=NULL)
{
printf("%s\n",dir->d_name);
}
closedir(d);
return(0);
}
Instead of printing directories in output i want to store that result in an array.can it is possible?
|
|
|
|
|
Sure. Just you strcpy_s instead of printf to store it in an array.
|
|
|
|
|
Hey Superman_,
thanks for this.Now if i write
#include <dirent.h>
#include <stdio.h>
int main(void)
{
char array[1024];
DIR *d;
struct dirent *dir;
d=opendir("C:\\");
printf("Directories in C:\\ \n");
while((dir=readdir(d))!=NULL)
{
strcpy_s(array,dir->d_name);
}
closedir(d);
return(0);
}
will it works?actually at this time i can n't check the code.can you please help me?
|
|
|
|
|
ravi 12 wrote: will it works?
No, you are writing all your strings into one string, so you will keep only the last one. The problem you have is that you don't know upfront how many directories you will get, so you don't know how large you have to make your array. You could choose the brute force and use an array which is large enough (e.g. char array[1024][1024]: max 1024 directories of max 1024 characters). And then in your while loop you keep an index of where to store the current directory name (simply increment it each time).
Is it a C or C++ project ? Because if it is C++, I strongly suggest you to use stl containers (std::list for instance) and std::string, this will avoid to create an array with a fixed size upfront.
|
|
|
|
|
hey Cédric Moonen,
yes.it is C++ project.can you please give me the whole correct code ?
|
|
|
|
|
ravi 12 wrote: can you please give me the whole correct code ?
No because that wouldn't serve any purpose. Instead, I'll point you to some good articles about STL, you can check this section[^] on codeproject.
Of course, that will require some time to learn but it is definitively something that you will use a lot in the future, so the time investement will pay back later.
I suggest you document yourself about std::string and std::list, that's what you will need for this project. Don't forget that google is your friend and you can search for tutorials on the net.
|
|
|
|
|
thanks Cedric Moonen.....for your suggestion
|
|
|
|
|
Cedric Moonen wrote: Of course, that will require some time to learn
He seems to have lots of time considering he spent 11 days figuring out that he's unable to use FindFirstFile()/FindNextFile(). See his previous posts.
|
|
|
|
|
This has been painful to watch. On the flip side, it has given me an idea for an article.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
unsigned long i;
short s;
signed char c;
i = (s<<15) + (c <<9);
How will type conversion take place in this case?
Is it that:
1. s will remain short(2 bytes) thus shifting the LSB into the MSB and remaining bits turn 0; c is promoted to short then left-shift 9 performed. The final R-value is promoted to unsigned long and saved into i.
or
2. s and c both get converted to unsigned long before performing the shift operation (thus we do not lose any of the left-shifted bits)
or something else happens.
I tried it in VS6.0 and the result seem to indicate that in both s and c I did not lose any bit upon left-shifting as if s and c acted as if they were a 4-byte data type (long or int)
|
|
|
|
|
All shifts take place in a register.
The registers are 32-bit in a 32-bit OS.
So even though the shift overflows the variable, it will still remain in the register.
That's the reason you don't loose any bits.
|
|
|
|
|
I understand that the shifts take place in registers but then the evaluated values have to be stored back into their respective variables, which are of type short and char, which cannot hold 4-byte values.
|
|
|
|
|
Ralph_2 wrote: but then the evaluated values have to be stored back into their respective variables
Nope. Why do you think that?
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]
|
|
|
|
|
If I have a char variable and I perform left-shift 4 times I lose the 4 MSB bits
For instance,
unsigned char c = 4;
c= c<<2;
c= c<<4;
So here 1 gets shifted outof the MSB
|
|
|
|