|
Thanks.
But I hav already used IShellLink Interface. My problem is I am clicking an icon on the desktop and I want to know the name of icon using which I can check its existence and if found then change its 'Working Directory'.
1. Also if you can let me know how to get the path of the icon??
2. How to initialize IShellLink object with an existing desktop icon??
Regards
|
|
|
|
|
Hi,
Can anybody help me to get Icon details like its name, target path, working directory whenever it is double-clicked to run the application. This is be using Windows API or in C#.
I have already used IShellLink Interface but its been hard-coded for icon name. Suppose the user changes desktop icon name then also coding should be able to change its working directory. This can be done if I can check the existence of the icon.
|
|
|
|
|
Hi,
I would like to develop an ownerdrawn control, and it should take care of the current Windows theme chosen by the user. How do I get acces to the colors and so ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
|
That is indeed a good starting point, thanks Hans.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
I use kbhit for suspending program execution but it consumes processor cycles
while(!kbhit()){;}
how to do it without consuming cycles
9ine
|
|
|
|
|
#include <conio.h>
getch();
|
|
|
|
|
One way:
while(!kbhit()){Sleep(100);}
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
bad idea... it will only delay the consume time each 100 milliseconds.
in a general mean, one should avoid the use of sleep-like methods...
|
|
|
|
|
And what does getch() do, while it's waiting for a keystroke?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I think both use the interrupts.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
keyboard interrupt...
it hibernated the process, until a key is pressed. it doesn't loop (with a sleep call to reduce to proc consume) watching if a key is pressed.
moreover, your method will fail if the key is pressed and released while being in the sleep call.
|
|
|
|
|
int __cdecl _getch (
void
)
{
INPUT_RECORD ConInpRec;
DWORD NumRead;
CharPair *pCP;
int ch = 0;
DWORD oldstate;
if ( chbuf != EOF ) {
ch = (unsigned char)(chbuf & 0xFF);
chbuf = EOF;
return ch;
}
if (_coninpfh == -1)
return EOF;
if ( _coninpfh == -2 )
__initconin();
GetConsoleMode( (HANDLE)_coninpfh, &oldstate );
SetConsoleMode( (HANDLE)_coninpfh, 0L );
for ( ; ; ) {
if ( !ReadConsoleInput( (HANDLE)_coninpfh,
&ConInpRec,
1L,
&NumRead )
|| (NumRead == 0L) )
{
ch = EOF;
break;
}
if ( (ConInpRec.EventType == KEY_EVENT) &&
ConInpRec.Event.KeyEvent.bKeyDown ) {
if ( ch = (unsigned char)ConInpRec.Event.KeyEvent.uChar.AsciiChar )
break;
if ( pCP = _getextendedkeycode( &(ConInpRec.Event.KeyEvent) ) ) {
ch = pCP->LeadChar;
chbuf = pCP->SecondChar;
break;
}
}
}
SetConsoleMode( (HANDLE)_coninpfh, oldstate );
return ch;
}
;)
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
of course
|
|
|
|
|
Sorry for bringing this up again, but...
If my eyes serves me right (still), the question was this (I quote)
"I use kbhit for suspending program execution but it consumes processor cycles
while(!kbhit()){;}
how to do it without consuming cycles"
Of course, a Sleep (generally speaking) isn't the best of ways to lessen CPU utilization, but the question was how to lessen CPU utilization when using the kbhit() function, especially (as in this case) when kbhit() returns 0.
So, can you come up with a better solution to the question asked?
Yeah, I know about getc, getch, getch e.t.c. but that wasn't the question!
How would you minimize the CPU utilization when you use kbhit() to wait for a key press?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
kakan wrote: the question was
yes, but mine is this one :
why still wanting to use a function that doesn't fit the best to your needs ?
|
|
|
|
|
toxcct wrote: why still wanting to use a function that doesn't fit the best to your needs ?
I agree. Why try to solve a problem that does not need to exist? Nothing like trying to pound a square peg into a round hole!
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You are right. He wanted a solution to the problem, which you gave him.
I gave an answer to his question.
But still, it's an interesting question: How to use kbhit in an efficient manner?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
|
It's better than writing code with 100% CPU utilisation...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I think no one understood your joke.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
It's not your kbhit to consume your processor cycles, but your "while" loop.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
so no useful ones for program suspension
what about gets() but how to not to print the key you pressed?
9ine
|
|
|
|
|
hey, did you read my answer ?
getch() works perfectly.
|
|
|
|
|
hi all,
CMAPIAdviseSink::OnNotify(...) will give the notification of email, Please let me know the steps to be followed to get the Notification of Messages when a Mail is Send to your computer.
Uday kiran
|
|
|
|