|
Yeah, That sounds about right. It's one of those classic mistakes that even "professional" programmers make over and over again.
Steve
|
|
|
|
|
I personality like to read your replys because they arecomplete and helpful.
|
|
|
|
|
|
Use some kind of signalling mechanism between the thing that detects the termination condition and the thread. That infinite loop should have a check at the top for the condition. Easiest choice in windows is to use an event. Only use TerminateThread as an absolute last resort, only if you can't do it some other way. I've been multithreading for over 20 years and I have never had to use TerminateThread. It leaves your system in a mess, with all sorts of resources still allocated.
Judy
|
|
|
|
|
JudyL_FL wrote: I've been multithreading for over 20 years
Come on, Judy...since you were a toddler? I'm not buying it
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
My very first job out of college had multithreading in it. Granted it was 8085 assembler inside a cash register instead of C on a windows PC but still ....
|
|
|
|
|
|
Hello everyone,
I am quite new in programming.
Through windows, a data file can be related to a default program to be open with.
I would like to know how to get the path and name of this "double-clicked" data file in my c++ console aplication (a quick example would be to write a code which returns the complete path of a file when this is double-clicked if we set our program to be the default "opens with" for the file).
Thank you in advance and kind Regards,
Marcos
|
|
|
|
|
FindExecutable
Retrieves the name of and handle to the executable (.exe) file associated with the specified file name.
Syntax
HINSTANCE FindExecutable(
LPCTSTR lpFile,
LPCTSTR lpDirectory,
LPTSTR lpResult
);
|
|
|
|
|
I am not sure but I think this is not exactly what I want.
What I need is the name and the path of the data file (not the executable one) to work with it in my program
|
|
|
|
|
Is your program the one that is associated with the data file?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes.
The issue is getting in some way the path of the "double-clicked" data file in my program
|
|
|
|
|
The Windows shell will send that to your program as a command-line argument (e.g., argc and argv ). Check your program's registry setting(s).
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am working on an MFC SDI applicaiton similar to ToDO list where user can enter various tasks for the day and retrieve them. I want to synchronize it with google calendar so that user can retrieve any tasks from google calendar into my application.
Can anyone tell me how can I do it in C++? Google provides calendar APIs but I have not found anything on how to use them or even interacting with them using C++ code. I know xml and my application can parse and write into xml but no experience in interacting with websites or internet programming.
Any input will be highly appreciated. Thanks.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
theCPkid wrote: Can anyone tell me how can I do it in C++?
AFAIK, the closest thing for you would be CLI/C++ (or may be Objective-C, if you are into that?). Here[^] is the API, just in case it could be of help.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I am new to .Net as well. So, just wondering whether I can add .net support to my mfc application. I downloaded the calendar sdk and in the sources folder, all files are in C# but there are some dlls also. I hope I should be able to use those dlls in my application directly provided these are COM dlls.
Thanks for the reply.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
theCPkid wrote: So, just wondering whether I can add .net support to my mfc application.
.NET support for your MFC app? There is no such thing.
Your app is either native or managed. To deal with the discussed Google APIs, your app must be managed. Hope that helps.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks for the info. But still scratching my head about how can I interact with GData in my MFC application as it is not possible for me to do it in .Net
It seems like it will be possible for me to do simple query and get response as described in this link. Since all this is totally new to me, so I am still trying to understand it.
Thanks for the help.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
Why are you repeating the word "MFC"? I simply don't get it. The core of the application that you are looking to develop is already written in managed code. So, there is no point in just writing the UI in MFC (I'm presuming you're doing this), for at least the reason that you can build feature rich UI with much lesser efforts with the help of .NET.
I believe there must be samples too at code.google.com; just do a search.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
No, whole of my application is using COM & MFC. My todo list is just a small part of it and my whole project does not use .Net in any way. So, i do not think using .Net will be possible. I hope I have understood you properly.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
OK, I get you now. I thought todo list was your entire application. And that's why I asked you to write your app in managed code. Besides that, I don't see a way you could use the google calendar APIs in your application, because that is entirely managed code.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I use bitmaps for some toolbar buttons.
Ex.
In my .rc file I have:
<br />
FLDWZOOM BITMAP MOVEABLE PURE "fldwzoom.bmp"<br />
I my .cpp file I load the bitmaps for the buttons
<br />
case IDM_ZOOM:hBitmap=LoadBitmap((HINSTANCEhResource, "FLDWZOOM"); <br />
break;<br />
Can I load gif images instead of bitmaps?
If I can, what function must I use?
danginkgo
|
|
|
|
|
It's going to take some work. You can use OldLoadPicture to load a gif, which will give you an IPicture object. But you'll still need to show it on a button.
The windows BUTTON class only takes HBITMAPs, so you'd need to do some owner draw.
Luckily there's a whole bunch of owner-draw-buttons of all sorts here on codeproject. Look under desktop development / button controls. Even if you don't use one exactly (which would be a shock), you can still get good ideas on how to do your button.
Good luck,
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Thank you, but I still have a problem.
I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons.
I can't obtain transparent background BMPs from those GIFs.
I was hopping that I can use the GIFs.
So, I can use only BMP and ICO for windows BUTTON class?
danginkgo
|
|
|
|
|
danginkgo wrote: Thank you, but I still have a problem.
Luckily, I gave you a good answer - go have a proper read of the button section on codeproject. There you will find all sorts of owner-draw buttons.
Using the normal button class without doing extra work? Tough.
danginkgo wrote: So, I can use only BMP and ICO for windows BUTTON class?
Exactly.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|