|
Hi! I realise that this is an old topic. Sorry, I don't quite understand this. In my screensaver I never use ChangeWindowMessageFilter... but I still get the error. Can someone explain why this happens?
Also, can someone confirm that the previous suggestion works? How exactly do I do the casting and where should this call be made?
Thanks in advance.
|
|
|
|
|
Hi,
The scenario :
A process that generate threads (each thread calls a set of functions that uses a exception throwing as an return value ).
The Dilemma:
a disuse of critical section on those function (that uses a exception throwing as an return value) will cause
unstable windows behavior (win Xp) ?
|
|
|
|
|
ta_isr wrote: will cause
unstable windows behavior (win Xp) ?
Why?
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
|
|
|
|
|
It's a bit difficult to understand your problem
Is the problem related to the fact that the critical section won't be release because you throw an exception ? If that's the problem, there's a little trick you can implement: wrap the critical section into a class, enter the critical section in your class ctor and leave the critical section in your class destructor.
Now, when you want to use this, just declare an instance of the class (it will call the constructor and enter the CS). When the function is exited, the class goes out of scope and the destructor is called (leaving the CS). Thus, if your function throw an exception, you are sure that the CS is left.
|
|
|
|
|
To clarify the problem:
number of threads that uses the same function (that uses a exception throwing as an return value - can't be changed)
can cause a problem ?
can a thrown exception in thread 1 can be catch in thread 2 ?
|
|
|
|
|
No. Exceptions do not cross threads. But what does it have to do with critical sections ?
|
|
|
|
|
"Exceptions do not cross threads" Thats the answer i want to hear.
Thanks.
|
|
|
|
|
Hi All,
I am using RegFlushKey() API in my application. We have to pass a registry key to the API. The API flushes the entire hive to which the key belongs. Is there any way I can flush only the contents of the key I pass and not the entire hive?
Thank you,
AJ
|
|
|
|
|
May Be this article will help you and sort out your problem.
Click Here ->[^]
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I had seen this link....but of no help...
|
|
|
|
|
I have already developed a application which is doing the following:
1. This a MFC dialog based application
2. It has three button "Capture","List Windows","Exit"
3. It is listing all the windows and then
4. After selecting a window and if you press capture it will capture selected window data.
5. Now i have the captured image into a buffer.
Question/Probelm:
1. How can i display this buffer only in the secondary monitor?
2. Is it possible to show the output in fullscreen mode on secondary monitor.
3.How can i maintain the aspect ration of the buffer on secondary monitor
if the captured data dimension is smaller than the secondary monitor resolution?
Please help.
|
|
|
|
|
Hi all,
I have this downloader code what I do is there is this temp file that where the downloaded file is being stored until completed when completed I want it to be transfered to a new file, I am trying to do this by movefile() however it returns false.
Here is my code maybe anyone of you can see why:
HINTERNET hConnect = NULL;<br />
HINTERNET hOpen = NULL;<br />
HINTERNET hOpenFile = NULL;<br />
<br />
HINTERNET hHttpRequest = NULL;<br />
bool sendReq = FALSE;<br />
LPTSTR AcceptTypes[2] = {TEXT("application/x-zip-compressed"), NULL}; <br />
<br />
BOOL bRet = FALSE;<br />
BOOL bInComplete = FALSE;<br />
BOOL Exist = FALSE;<br />
INTERNET_PORT nServerPort =21;<br />
FILE * pFile = NULL;<br />
<br />
DWORD dwPacketSize =5;<br />
<br />
DWORD dwSize, dwToRead = dwPacketSize * 1024;<br />
PBYTE pBuffer = new BYTE[dwPacketSize * 1024];<br />
<br />
double dOffsetToSeek =0;<br />
<br />
std::string strTmpFileName = "Temp_CaptureFile4210InstallerBuild_4.zip";<br />
std::string strFileNameAtLocalMachine= "CaptureFile4210InstallerBuild_4.zip\\";<br />
DeleteFile(strFileNameAtLocalMachine.c_str());<br />
CString strStaus;<br />
double dCurrentFileSize;<br />
<br />
DWORD dwBytesWrrittenToFile =0;<br />
<br />
if(IfLocalFileExist(strTmpFileName.c_str(), &dCurrentFileSize)) <br />
{<br />
dOffsetToSeek = dCurrentFileSize;<br />
}<br />
<br />
CString strRangeQuest;<br />
<br />
if(dCurrentFileSize>0){ <br />
strRangeQuest.Format( _T("%sRange: bytes=%d-\r\n"), szHeaders,static_cast<ULONGLONG>(dCurrentFileSize));<br />
}<br />
else <br />
strRangeQuest = szHeaders;<br />
<br />
dwBytesWrrittenToFile = dOffsetToSeek;<br />
<br />
if ( !(pFile = fopen (strTmpFileName.c_str(), "ab" ) ) )<br />
{<br />
CString strMsg;<br />
strMsg.Format("Error:%d", GetLastError());<br />
return false;<br />
}<br />
if(dOffsetToSeek >=0)<br />
{<br />
strStaus.Format("Seeking to local file...");<br />
int n = fseek(pFile, dOffsetToSeek, SEEK_SET);<br />
}<br />
<br />
CInternetSession Session(_T("Test Application"));<br />
CHttpConnection Connection1(Session,_T("http://10.5.1.4/downloads/CaptureFile/CaptureFile4210InstallerBuild_4.zip"));<br />
BYTE Buffer[4096];<br />
<br />
CHttpFile File2(Session,_T("http://10.5.1.4/downloads/CaptureFile/CaptureFile4210InstallerBuild_4.zip"));<br />
CInternetFile::CInfo Info(File2);<br />
File2.SendRequest(strRangeQuest);<br />
<br />
for (DWORD dwRead2;dwRead2=File2.Read(Buffer,sizeof(Buffer)); )<br />
{<br />
fwrite(Buffer, sizeof (char), dwRead2 , pFile); <br />
}<br />
<br />
bool moved = MoveFile(strTmpFileName.c_str(), strFileNameAtLocalMachine.c_str());<br />
DeleteFile(strTmpFileName.c_str());<br />
<br />
return 0
Thanks,
Jayjay
|
|
|
|
|
Um, don't you have to close a file before you can move it?
for (DWORD dwRead2; dwRead2=File2.Read(Buffer,sizeof(Buffer)); )
{
fwrite(Buffer, sizeof (char), dwRead2 , pFile);
}
fclose(pFile);
bool moved = MoveFile(strTmpFileName.c_str(), strFileNameAtLocalMachine.c_str());
|
|
|
|
|
is any way to tell a dialog is modal or modeless from its HWND.
Thanks & Regards
|
|
|
|
|
|
i want to close dialog from app other than the caller, by processing a WM_CLOSE.
i need to determine from EndDialog and DestroyWindow, which one to use for a purticular dialog.
//my idea is to call EndDialog() and followed by DestroyWindow() for every HWND, but im not sure this will work as expected.
Thanks & Regards
|
|
|
|
|
Are you aware this (from MSDN [^]):
An application calls EndDialog from within the dialog box procedure; the function must not be used for any other purpose.
?
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
|
|
|
|
|
Can We limit the Number of characters entered in to a text field in MFC?
i.e. I've displayed the characters entered into a textfield to the status bar bane. But if I enter more than 80 characters, an exception is thrown.
How do I limit the characters to 80?
|
|
|
|
|
you can set the limit of text field using
CEdit::SetLimitText(UINT nMax)
Mukesh Kumar
Software Engineer
|
|
|
|
|
Hi friends,
Can anybody help me out in getting good documents on blueTooth and EEPROM API list?
I have to do coding for these devices. Kindly Help me out with good documents which helps me in getting the API list and Code samples for the above said other than MSDN.
Thanks in advance..
poojaaa
|
|
|
|
|
Better help on the Hardware / Device Drivers forum[^].
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
|
|
|
|
|
|
I need the code in VC++ that give the information about hard drives connected to my computer whether it is S-ATA or IDE/ATA.
Is there any WMI class or any win32 API by using which I can get these details.
waiting for your suggestions.
Thanks.
|
|
|
|
|
I have to retrieve the SMTP address, IP Address, username and password from the outlook. I found the entries for SMTP server, username and password under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\9375CFF0413111d3B88A00104B2A6676\.
My queries are
1) Is there any other way of retrieving the SMTP server name, username and password other than from the registry entry.
2) Also, the password details are encoded in some format under the registry key. how to decode it?
3) How to retrieve the IP Address for the SMTP server setup like gmail, yahoo etc.
|
|
|
|
|
Hi,
I am wanted to learn how to create the COM object using Visual C++ (without .NET). I found the good tutorial site http://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c5567/ which give the basic understanding on the COM object.
However, now I wanted to know how to create coclass object, etc. Is there any other good COM tutorial website available? Most of the tutorial site that I googled is either too advance or not what I am looking.
Thanks
|
|
|
|