|
I want to be able to show a small dialog box displaying progress while a pre-existing thread does work. I think the UI-threads are the right solution to my problem. I found this page and it looks like just what I need. I don't see how to show a dialog box in the process, only how to utilize CWinThread as a user-interface thread.
|
|
|
|
|
You can start the UI thread. Then display a modeless dialog box from within the thread, and close the modeless dialog box when you are done and about to exit the thread.
I usually have the primary UI thread create the modelss dialog box, then let a worker thread do a job and post messages to the HWND of the modeless dialog box regarding status, then when the worker thread is done, it signals the main UI thread which can remove the modeless dialog box.
You can use RegisterWindowMessage to set up custom messages to communicate from the worker thread to the mdoelss dialog and the main UI thread.
|
|
|
|
|
Thank you for the reply, it's very informative. I looked into a modeless dialog because I doubted I could interface with a modal dialog box. I found the function CreateIndirect(...) but I couldn't close the deal on the arguments so I abandoned it in favor of trying another route which I am not optimistic. I already have a series of handles setup to provide synchronization and I can wait for each event and adjust the dialog appropriately.
Can you give me a more detailed sequence of events, possibly with function names and such. I'm having a hard time filling out my CWinThread-derived class, I can't quite define in my mind what should be in my main controlling function and what should be in the UI thread.
|
|
|
|
|
I have tried Platform SDk, I download the SDK from MS-Website, and installed it. But i found the Platform SDK seem not well! My question are:
1) Some Windows DataType are not declared! for examples:
DWORD_PTR, PDWORD_PTR, ULONGLONG...
I check the SDK Document, Say these data type declared in BaseTsd.h! But
I opened headfile, I did not found these data type declare. Whats wrong?
2) After install Platform SDK, int the c:\C:\Program Files\Microsoft
Platform SDK\ folder, there are many head file'name and system files'name
are same as in the folder : C:\Program Files\Microsoft Visual Studio\VC98
So which file I will be useing in my projects? And how do I use the
different fiels?
|
|
|
|
|
You can configure the Visual Studio default directories to search the newer platform SDK header files and libraries. The ones shippd with Visual Studio are just 'older' versions of many of these same files.
See Tools|Options|Directories... menu item in Visual Studio 6.0 IDE to make changes. Make it search the Platform SDK folders ahead of the older ones that came with VS 6.0.
|
|
|
|
|
(1) Some Windows DataType are not declared! for examples:
DWORD_PTR, PDWORD_PTR, ULONGLONG...
I check the SDK Document, Say these data type declared in BaseTsd.h! But
I opened headfile, I did not found these data type declare. Whats wrong?
Thanks!
|
|
|
|
|
Rule #1 - Don't beleive everything you read in MSDN.
Rule #2 - See Rule #1
I found them defined in a myriad of files.
DWORD_PTR and PDWORD_PTR were defined in GCHOST.H and BaseTsd.h
ULONGLONG was defined in
PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET 2003\SDK\v1.1\Tool Developers Guide\Samples\smc\Win32.h(38):typedef unsigned __int64 ULONGLONG;
and
PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET 2003\Vc7\PlatformSDK\Include\WTypes.h(398):typedef unsigned __int64 ULONGLONG;
and
PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(446):typedef unsigned __int64 ULONGLONG;
|
|
|
|
|
Hi,
I'm trying to write a c++ program that automatically logs me in at an online game. It worked for a few days but then, i think they made a change to their servers and now my code won't work.
It seems that i need to connect to the servers IP address directly instead of using the URL. So my question is: How can i get an URLs (web servers) IP address by its host name?
|
|
|
|
|
|
It does help, thank you very much!
|
|
|
|
|
MiltonFrog wrote:
It seems that i need to connect to the servers IP address directly instead of using the URL.
The URL can contain an IP address. Consider:
http://www.codeproject.com[^] is the same as http://209.171.52.99[^]
MiltonFrog wrote:
So my question is: How can i get an URLs (web servers) IP address by its host name?
Use gethostbyname() .
|
|
|
|
|
Hi, I'm interested in pursuing a career in the IT field as a programmer. My question is, What language should I start out with? I already know BASIC, and was thinking about self-learning C++, but I didnt know if I should just go into .net instead. So, what do you guys think? Is learning c++ important/necessary? Also, is it a good language to kick start my programming knowledge? If not, what is a good language to start learning with?
|
|
|
|
|
|
Hello,
C++ is one of the most difficult languages to learn. Learning C++ requires to learn a lot of stuff that will help you understand things much better for the rest of your career! Some of these things are memory management and pointers.
I started to learn C++ as my first language and by myself. I must say, that in the beginning it was a hard concept to grasp, but with the help of this community, trial and error practice made me understand the language very well.
If you want to learn both the languages, my advice to you is to start with C++. If you start with C#, you'll accommodate certain habits which will make it harder for you to be a good C++ programmer.
If you want to find a job very fast and you don't care much about other things, you should learn C#. Thats the language of the new windows platform and a lot of companies are migrating to .NET.
Good luck with the choice you make!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thank you very much, I think I'll continue with c++ so that It makes learning everything else much easier. Im not yet in college, so if I get the hang of C++ it will probably be invaluble in my education to come.
|
|
|
|
|
The other thing is, be careful of how you learn. There's plenty of info out there that teaches C++ in the hardest possible way, or teaches it using stuff that is pre-standard. For example, any book that tells you to include iostream.h, throw away. If you can get The C++ Programming Language by Bjarne Stroustroup, that's definately a good place to start, if a little wordy for a beginner.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
C++ is the best place to start, but you should also get a good book on C (to help improve your understanding of C++).
Stick to learning the basics (console level) as much as possible, because you want to learn the language before learning OS specific stuff.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
John R. Shaw wrote:
but you should also get a good book on C (to help improve your understanding of C++).
It's advised that you don't learn C when you learn C++. This is because C has habits that are plain wrong in C++. Typecasting is one thing, enum magic is another thing. Heap allocations are an important thing that you should not mix if you program C++. Some C++ programmers that were traditional C programmers have bad habits: not initializing variables at the beginning of a function, mixing malloc with new and many more.
You don't need knowledge of C to undestand C++. IMHO it's even better that you don't learn C for the sake of "understanding" C++. The concept is to different.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
You're correct of course. Bruce Eckel ("Thinking in C++") wrote that he did not know he was a bad C programmer until he started learning C++.
I just suggested it, because in C you don't expect things to magicaly take care of them selfs. A lot of begging C++ programers seem to think magic happens and don't seem to understand that it is not magic, the action is just hidden from view.
Many C++ programmers have very bad habits too. Even worse, some of these habbits are taught to begginers, the code looks correct, but the problem is hidden. That's why I would recommend, after learning the basics and reading Bajarne Stroustrups Book, reading the puzzle books by Herb Sutter.
INTP
for(/*...*/;/*...*/;i++) <- bad habit, generates temporary.
|
|
|
|
|
Thats true, in C things will not happen by itself.
It's also very true that a lot of C++ programmers have bad habits, but the language doesn't change it. For every language are programmers that have bad habits. I C# for example, some people think that they can allocate and copy objects all they want and let the garbage collector take care of of it. They don't know that this "style" has a huge affect on performance.
John R. Shaw wrote:
That's why I would recommend, after learning the basics and reading Bajarne Stroustrups Book, reading the puzzle books by Herb Sutter.
Those books are also great. I have a few of them myself on the bookshelf.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hello,
Since you are not in college yet, you mind find the C++ book by bjarne stroustrup a little bit hard to understand. IMO, it's not the best place to start if you are not familliar with the technical level in the book. Things are explained that are hard to grasp, especially for people who don't know C++ yet.
I think that you should start out simple. Rent a book for "dummies" somewhere in a library and get familiar with the syntax, memory management, OO and containers. After that you should be ready for the more advanced books. The book suggested by Cristian is a really good book about C++. Some other authors names: meyers, ellis. I didn't read books written by them, but they are fererenced in many other books.
Good luck with your studies!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
If you become good in C++, you will become a good programmer. A programmer which understands the underlying mechanisms.
I'm not saying you won't become a good programmer if you choose, let's say C# for instance. But if you learn a complex and complete language such as C++, it's quite easy to learn other languages. That's my experience.
Good music: In my rosary[^]
|
|
|
|
|
Hi everyone,
I'm trying to check if a page was loaded correctly into my class extending CHtmlView. I mean I want to check if the page was found. And only a way I can think of is to check status codes of a server response.
I have found OnNavigationError function in CHtmlView whuch check the codes. But it looks like it's defeined in MFC 7. I use 6th one.
Are there any ways to get status codes for any MFC classes like CHtmlView? I do not want to work with sockets directly. But if there is no way to avoid it how can i get a pointer to a socket used in my instance of CHtmlView?
Thanks in advance.
Rotciv
|
|
|
|
|
vicel wrote:
I'm trying to check if a page was loaded correctly into my class extending CHtmlView.
What about the GetReadyState() or GetBusy() methods?
vicel wrote:
I have found OnNavigationError function in CHtmlView whuch check the codes. But it looks like it's defeined in MFC 7. I use 6th one.
What about the OnDownloadComplete() method?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
These functions are different from what I need. They show up page loading process.
If a page was not found a server can return just a header with status code = 404 (page not found) and then OnDownloadComplete should say that download failed. Or it can return (!) an error page. So a page will be downloaded anyways.
That's why I want to see status codes.
|
|
|
|