|
Hi
I have a VC++6 application in which I continuously update the display for a certain time after the user clicks a button. I accomplished this by creating a separate thread the sends a message to the window via the window's HWND. This way, my app won't 'hang' when the user switches window. However, when this thread is still active, there's a possibility that the user may close the window, invalidating its HWND. Is there a way for the thread to check whether the HWND is still valid?
Thanks!
|
|
|
|
|
First off, don't use SendMessage to send messages from a thread to a window, use PostMessage to post them instead. To check if a window is still valid use IsWindow(HWND) .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi all,
I use VC++ 7.0. I want to call function which is written in VBA. How to do it.
Please help me.
Thanks
Chau Ngoc Vo, Software developer
|
|
|
|
|
Hi all,
I use VC++ 7.0. I want to call function which is written in VBA. How to do it.
Please help me.
Thanks
Chau Ngoc Vo, Software develope
|
|
|
|
|
I'm wondering if it's still important to learn MFC or (if I'm not mistaking) VC++. If Microsoft is going to make Longhorn APIs managed, then where will be the advantage of using C++ and old APIs under Windows in the future?
your advice is very important to me, please tell me what do you think?
|
|
|
|
|
There is a lot of MFC code out there, and it isn't going anyplace. In most cases it is cheaper to have someone learn MFC to do maintance on in, than to port it over to something better. So there will always be jobs out there that require someone who knows MFC.
Nobody in their right mind would start a new project with MFC. There are too many better toolkits out there. (not just .net, but also things like qt) Course a lot of better comes down to personal prefererence, I don't want to get into that argument. Still, if you are doing windows managed code is generally better, while if you want cross platform you need something else anyway.
Learn what is useful to you. C++ is very common in industry, like MFC that won't change overnight. Don't blind yourself to one toolkit, when the job market changes to look for something else you need to change too.
If you just want to learn something, it is sometimes best to learn something that won't be useful to your job. You can then focus on what counts not what is important now!
Personally I wouldn't bother. But I've never used either MFC or visual C++. I'll learn it if I need to, but there are other things that are also worth learning.
|
|
|
|
|
Adding to what the other guy said... it appears that as time progresses, most of the MFC you'll see will be legacy apps. It certainly wouldn't hurt to learn MFC, since there is so much code out there using it.
That being said, there is still a place for C++. If you ever do work on any other platform, or need to do low-level stuff like drivers, or work in embedded systems, C++ will be important. And still, the majority of client-side apps are not written in .NET yet, and it'll probably be a while before it becomes ubiquitous.
So if I were you, I'd keep my options open. Go on and learn MFC, C++, but also learn how .NET works, learn Java, learn about some of the other windowing toolkits (like wxWidgets), etc. It never hurts to learn something.
An expert is somebody who learns more and more about less and less, until he knows absolutely everything about nothing.
|
|
|
|
|
I realy need help,
I Using a MFC app and I need to see if something is downloading from internet. I now you need to use urldownloadtofile but I don't now how! Is there anyone that have some code that I can use or something like it?...
\Please help me....
|
|
|
|
|
Visiting the following sites may give u an idea.
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/reference/functions/urldownloadtofile.asp
http://codeproject.com/internet/urlfile.asp
http://codeproject.com/internet/urldownload.asp
I hope this helps u
Dipeka.A.J
|
|
|
|
|
The following code exists in identical form in two projects. (A dialog box & its logic were created in a test framework, then moved over to the final project.) In one project, this works fine, in the second I get "Unhandled exception at 0x763b1fda in AtasMod.exe: 0xC00000FD: Stack overflow."
void
CSpecialEventDlg::OnBnClickedSpecialEventBrowse()
{
CFileDialog oDlg(true, ".wav", 0,
OFN_HIDEREADONLY,
"Sound Files (*.wav)|*.wav||");
// taking the next line out changes nothing
oDlg.m_pOFN->lpstrTitle = "Find Sound File";
if (oDlg.DoModal() == IDOK)
{
// do stuff
}
}
I've traced the code into MFC, and the crash is occurring in dlgfile.cpp:
OPENFILENAME& CFileDialog::GetOFN()
{
return *m_pOFN; // this line crashes
}
Am I doing something wrong? Is there some way to avoid the problem?
Thanks, all,
--chesky
|
|
|
|
|
Use
oDlg.m_ofn.lpstrTitle = "Find Sound File";
I don't know what the pOFN Pointer you are using does exactly...
|
|
|
|
|
> Use
> oDlg.m_ofn.lpstrTitle = "Find Sound File";
> I don't know what the pOFN Pointer you are using does exactly...
I'll try that, but as I wrote earlier, taking the entire line out had no effect - it worked the same in one project, and crashed the same in the other.
|
|
|
|
|
>> Use
>> oDlg.m_ofn.lpstrTitle = "Find Sound File";
>> I don't know what the pOFN Pointer you are using
>> does exactly...
>>
> I'll try that, but as I wrote earlier, taking the
> entire line out had no effect - it worked the same
> in one project, and crashed the same in the other.
>
Tried it, changed nothing - does anyone have any ideas?
--chesky
|
|
|
|
|
Is there a way to get the AfxMessageBox to display a title other then the title of the exe? The MessageBox can do it of curse but I was wondering about the mfc one.
Thanks,
sb
|
|
|
|
|
Have you stepped into the AfxMessageBox() code to see how the caption text is obtained? That's the key to your question.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks. I havent explored that. I will.
sb
|
|
|
|
|
Add/modify the string resource (id = AFX_IDS_APP_TITLE ) in your string table. AfxMessageBox() will use the value of that string when it displays a message box.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I am trying to create an application which serves as a general form to accept input. The form contains a button, that when pushed, outputs data as well as generates a popup window displaying a graph of the input data. I have created the input form but need help implementing the popup window with the graph.
|
|
|
|
|
look around here at CP, there are a couple of cool graph controls ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Is there a way to delete a file to the recycle bin? DeleteFile simply deletes the file. Do I have to perform a MoveFile?? In that case, what is the macro name for the recycle bin?? For instance, move to system directory I think would be MoveFile("C:\\myfile.txt", //SYSTEM)???
|
|
|
|
|
You'll want to use SHFileOperation() here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Shoot. I had hoped to avoid using that one. Thanks.
|
|
|
|
|
Could someone send me a sample program that loads font from a file (not already installed in Windows) and write text using that font? Also, to dump the displayed text in the loaded font to an image file (gif,jpg, bmp)...
Thanks
jpxavier@yahoo.com
|
|
|
|
|
the core functions you'll need are CreateScalableFontResource and AddFontResource.
Software | Cleek
|
|
|
|
|
I have string "0xFF070FF07" and I need to extract the int64 from it. I did try breaking up the string into high and lo parts and then bitshifting but I dont get the right value.
<pre>
unsigned __int64 alg_mask;
char *pHi,*pLo;
pLo = pHi + strlen(pHi) - 8;
unsigned int lo = strtoul(pLo, 0, 16);
*pLo = 0;
alg_mask = strtoul(pHi, 0 , 16);
alg_mask << 32;
alg_mask += lo;</pre>
How do I get my value out?
Thanks,
sb
|
|
|
|