|
I'm Grateful for your concern.How to invoke interfaces externally using Perl?
|
|
|
|
|
I'm not an expert but this page [^] looks promising.
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]
|
|
|
|
|
I am working on Vista with VS 2005.
In my application, I am handling the WM_POWERBROADCAST message and in the message handlig function, execution some code which i must execute when the system goes to hibernate or standby(sleep) mode.
I find that on Vista, windows doesnot wait for the WM_POWERBROADCAST message handling function to return a value(true or false) before proceeding to entering into sleep mode.
On Vista, the system goes to sleep mode even before the WM_POWERBROADCAST message handling function returns a value. And because of this, my application does not have enough time to execute code in the handler function and results in a crash.
Should Windows go/not go to hibernate/sleep mode depending on the return value of the WM_POWERBROADCAST handling function?[MSDN Link]
|
|
|
|
|
The following is from the documentation -
To prevent the system from transitioning to a low-power state in Windows Vista, an application must call SetThreadExecutionState to inform the system that it is in use.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I tried calling the SetThreadExecutionState() function in the OnInitDialog() of an sample dialog based applicaiton with various combinations of flags ES_CONTINUOUS ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED, but to no avail.
Could you please tell me as to which flag is to be used with SetThreadExecutionState()?
|
|
|
|
|
I guess you have to call SetThreadExecutionState inside the WM_POWERBROADCAST handler.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Tried adding the SetThreadExecutionState() funciton in the WM_POWERBROADCAST handling funciton but to no avail.
|
|
|
|
|
sometimes I can get a handle of a windows easily,but I need a pointer of the window object,how can i do this?
thanks in advance!
|
|
|
|
|
You can attach the handle to a newly created object.
CWnd* pNewWnd = CWnd::FromHandle(hWnd);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
first i created a window object,then i get the handle of the object, after that i send the handle to another function,if i attach the handle to a new object,does it mean i have two identical object ?
|
|
|
|
|
You will then have 2 objects that work on the same window handle.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
is there any way to retrive the original object?
|
|
|
|
|
Both objects are independent.
They only works on the same window handle.
So you will have to keep the reference yourself.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
Hi ,
Dialogue box having two buttons at bottom. On is more button and other one is ok button.When user clicks on more dialogue box size need to change to show more options .and button caption will renamed to less.This requirement is exactly same as find and replace dialogue in MS-Word.Please help me how to do this.
dialogue box size need to change according option selected.
Thank you in advance.
|
|
|
|
|
|
My requirement is exactly like same as find and replace option(i.e CTRL + F ) in MS – Word. Like more button functionality.
|
|
|
|
|
coding_ram wrote: My requirement is exactly like same as find and replace option(i.e CTRL + F ) in MS – Word. Like more button functionality.
For that i gave you one function SetWindowPos. Did you try calling SetWindowPos and change the size of the dialog? Or you are looking for ready code ?
Regards,
Sandip.
|
|
|
|
|
Hi Sandip,
its working fine for me..thanks a lot.
|
|
|
|
|
You are welcome
Regards,
Sandip.
|
|
|
|
|
coding_ram wrote: When user clicks on more dialogue box size need to change to show more options .and button caption will renamed to less.
See here.
"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
|
|
|
|
|
DavidCrow
this is very excellent........thank you very much........so gr8
|
|
|
|
|
Hello,
I've a code snippet. Please follow the comments.
if ( !PathFileExists("C:\\TestDir") )
{
CreateDirectory("C:\\TestDir", NULL);
}
CFile cfBatchFile( "C:\\TestDir\\TestBatch.bat", CFile::modeCreate| CFile::modeRead | CFile::modeWrite );
cfBatchFile.Write( "\"C:\\windows\\system32\cmd.exe\" ipconfig>C:\\TestDir\\Test.txt", MAX_PATH );
cfBatchFile.Close();
if ( ShellExecute(NULL, "open", "C:\\TestDir\\TestBatch.bat", NULL, NULL, SW_HIDE) > (HINSTANCE)32)
{
CFile* pcfTxt = NULL;
pcfTxt = new CFile(_T("C:\\TestDir\\Test.txt"), CFile::modeRead | CFile::shareDenyNone);
INT nLogTxtLen = pcfTxt->GetLength();
}
In Debug mode (without a Debug point), the crash is shown at
pcfTxt = new CFile(_T("C:\\TestDir\\Test.txt"), CFile::modeRead | CFile::shareDenyNone);
But if I place a debug point at :
pcfTxt = new CFile(_T("C:\\TestDir\\Test.txt"), CFile::modeRead | CFile::shareDenyNone);
and then continue, no crash arises.
I guess the issue is something to do with the handle of 'C:\\TestDir\\Test.txt' file.
How could I rectify this.
Is some Sleep() required to wait for the handle to be available.
Replies would be appreciated.
Thanks
Edit/Delete Message
|
|
|
|
|
You can try using CreateProcess[^]instead of ShellExecute and then Call WaitForSingleObject[^]on the handle for process obtained from CreateProcess. Introducing Sleep might work but it will not be a good solution.
Regards,
Sandip.
|
|
|
|
|
looks like this is related to delayed write. Just because you close a file does not mean the OS will write it
the folowing is from the FlushFileBuffers documentation
Due to disk caching interactions within the system, the FlushFileBuffers function can be inefficient when used after every write to a disk drive device when many writes are being performed separately. If an application is performing multiple writes to disk and also needs to ensure critical data is written to persistent media, the application should use unbuffered I/O instead of frequently calling FlushFileBuffers. To open a file for unbuffered I/O, call the CreateFile function with the FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH flags. This prevents the file contents from being cached and flushes the metadata to disk with each write. For more information, see CreateFile.
to me it looks like you need to open it in non buffering mode.
a programmer traped in a thugs body
|
|
|
|