|
It's something like this..
for(;thisWindowRect.top > SlideDialog.top- 164; thisWindowRect.top--)
{
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
Sleep(20);
}
Sorry but do we have "SWP_NORESIZE" Flag in SetWindowPos???
And no i'm not handling any messages..Just need to pop up my dialog from task bar along with all the controls
|
|
|
|
|
I did tell you it was from memory. You've proven my point - you have a loop, a setwindowpos, and a sleep.
Nowhere do you handle messages in the message queue.
SetWindowPos will generate WM_SIZE, WM_MOVE, etc, which in turn invalidate your window, which ends up doing WM_PAINT. So, no painting of contents.
I AM PSYCHIC!
Try the following:
for(;thisWindowRect.top > SlideDialog.top- 164; thisWindowRect.top--)
{
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
Sleep(20);
UpdateWindow (hWnd);
}
This should redraw the dialog window. It might not redraw any child controls, in which case you are going to have to rethink your design.
If AnimateWindow does not work under windows NT, then don't use it. Try using LoadLibrary to attempt the function. If it fails, then take that as a hint to skip the whole animation process entirely. You users of old OS's will thank you for it.
Iain.
|
|
|
|
|
Wow Iain you must have a full charged CPMRU 's battery pack!
My 5 .
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]
|
|
|
|
|
Hello everybody,
I am trying to change working directory in c++, For example: My programs is in c://work, I run the program from there, but during running this program, I have to change working directory, do something there.I tried to do it like this:
system("cd c:/work/test"); but it does not change working directory
Is there a way to change current working directory in c/c++?
Thanks in advance
It is never late to learn
|
|
|
|
|
chdir is the function you should use. as for what you tried it works in the sense that cmd.exe which is started as a child process whenever you call system() changes its working directory.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
chdir is c/c++ function? or shell function?
can i use it like
system("chdir c:/work/test");
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: can i use it like
system("chdir c:/work/test");
Yes, with the same result you got before.
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]
|
|
|
|
|
_chdir [^].
SetCurrentDirectory [^].
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]
|
|
|
|
|
Actually, I am using GNU c compiler for UNIX, it seems chdir and SetCurrentDirectory for windows only, is there any other way for UNIX?
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: I am using GNU c compiler for UNIX
GNU isn't for Linux (after all "G nu is N ot U nix" )?
Gofur Halmurat wrote: it seems chdir and SetCurrentDirectory for windows only, is there any other way for UNIX?
chdir should be available on any POSIX compliant system, like GNU/Linux .
Are you aware that CodeProject has a Linux 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
[My articles]
|
|
|
|
|
Did you use if these functions and what was result?
|
|
|
|
|
Hi,
I want to create an application that will work as a skill test for users that just started to learn the applications of the ms office like word, excel, access etc.
I saw some apps that starts automatically the application like MS Word and ask the user to do something like formatting the selected text.
Then, they capture the user response and reply if the answer was wrong or correct.
How they do that ? Is there any recommendations to start with ? I think that the examination app, for the Microsoft Office User Specialist (MOUS) works in that way.
Regards,
sdancer75
|
|
|
|
|
Hi Everyone!
I work with multithreaded server applications in C++. In our environment we use the Visual C++ and gcc compilers. I often have to write and maintain multithreaded code. I have a basic idea of how things work, from our internal documentation and looking at our code. But I find my knowledge is still not very deep. I'm looking for references on how to write multithreaded code.
The only useful and relevant links I've found online so far are these articles:
http://www.ddj.com/cpp/184403766
http://www.cs.wustl.edu/~schmidt/PDF/locking-patterns.pdf
I've found that online information on this topic is rare and hard to find. Does anyone know of any other online articles I can have a look at?
Further, a search on scholar.google.com lists the following books:
[BOOK] Win32 Multithreaded Programming
A Cohen, M Woodring - 1998 - O'Reilly
[BOOK] Multi-threaded programming in C++
M Walmsley - 2000 - Springer
[BOOK] Object-oriented multithreading using C++
C Hughes, T Hughes - Wiley
[CITATION] Object Oriented Multithreading using C++: architectures and components, volume 1
C Hughs, T Hughes - 1997 - John Wiley Sons
[BOOK] Modern Multithreading: Implementing, Testing, and Debugging Multithreaded Java and C++/Pthreads/ …
RH Carver, KC Tai - 2005 - Wiley-Interscience
Can anyone recommend any of these books? I can only afford one or two at the moment.
Any help greatly appreciated!
Thanks,
Steven
modified on Thursday, October 2, 2008 4:41 AM
|
|
|
|
|
The best resource for learning multithreading in my opinion can be found here[^].
You should also read some other essays that Newcomer wrote about how to use semaphores[^] and how to avoid pitfalls[^].
There are more essays on his site that are absolutely worth reading and re-reading until understood.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks!
These articles seem to be a bit biased to Win32 - we actually write cross-platform code, and the Win32 specifics tend to be embedded deep within our libraries. However, I'm planning to do a personal project on Windows sometime soon, so these should help.
While I'm on, perhaps I should post a few more of the links I've found, although these are more introductory tutorials:
CodeProject[^]
Paul Bridger[^]
www.intelligentedu.com[^]
FlipCode[^]
HotScripts[^]
Advanced topics:
Hyper Threading[^]
Thread Pools[^]
- Steven
|
|
|
|
|
Steven Swart wrote: These articles seem to be a bit biased to Win32
Well, no surprise there.
You're posting on a forum dedicated to windows programming with C++ and the MFC framework in particular.
However, the concurrency problems addressed in the essay applies to all platforms, not only Win32.
Perhaps you should take a look at the POSIX thread library for Win32.
Writing code for multithreading with POSIX thread API makes the code more portable.
Have a look here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Heh. I do realise this forum is biased to Win32, but I've yet to find a better one for my purposes...
A bit of background on our architecture, our apps are all server applications (services or daemons). GUI access is via a web-interface, so I don't need to know any GUI/OS specific stuff to do my job. Our codebase compiles on Windows, Solaris, Linux and FreeBSD. We do use pthreads for our unices, but our Windows build uses the native Win32 API. All of this is however nicely abstracted in our threading classes.
At some stage I would like to start developing my own applications though, and to do that I will need to know the nitty-gritty. So I'm starting to do the research now.
Thanks for all your help!
S.
|
|
|
|
|
> Heh. I do realise this forum is biased to Win32, but I've yet to find a better one for my purposes...
OK, found a discussion on Slashdot which some of you may find interesting:
Good Books On Programming With Threads? [^]
|
|
|
|
|
|
Thanks, will have a look.
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hi All,
I have couple of questions regarding threads.
In My VC application,Can I have two worker threads with the
priority set to THREAD_PRIORITY_HIGHEST.?
and Is there any problem , if one thread created with "CreateThread" and
one with "AfxBeginThread"?.
Thanks in advance.
Regards,
Sunil Kumar
|
|
|
|
|
sunilkumar.d wrote: Can I have two worker threads with the
priority set to THREAD_PRIORITY_HIGHEST
Technically, Yes. In the real world if you do this your customers will not like you. You will hog the entire system, probably even on dual core systems. Don't do this, there is really no need unless you're writing some kind of real time control system and Windows is the wrong place to be doing that or unless you're intending to replace a core windows driver.
sunilkumar.d wrote: Is there any problem , if one thread created with "CreateThread" and
one with "AfxBeginThread"?.
I can't remember off the top of my head which API call AfxBeginThread ends up using but I'm guessing it's _begin_thread from the CRT. If you mix these threads with threads started with CreateThread then don't use Thread specific Locales or TLS in your CreateThread Thread and avoid passing objects beetween them unless you're in full control of those object, i.e. they're entirely your code and your data, no Window handles, streams or objects with base classes buried in the Windows headers. If you do that you should be fine but I've no idea why you would want to.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
sunilkumar.d wrote: In My VC application,Can I have two worker threads with the
priority set to THREAD_PRIORITY_HIGHEST.?
Why don't you try? Be aware about this info [^].
sunilkumar.d wrote: and Is there any problem , if one thread created with "CreateThread" and
one with "AfxBeginThread"?
Why do you need the above?
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]
|
|
|
|
|
sunilkumar.d wrote: Can I have two worker threads with the
priority set to THREAD_PRIORITY_HIGHEST.?
Yes, you can.
But chances that you are trying to solve a problem the wrong way is very close to 100%. Manipulating thread priorities is almost always wrong and is often used to disguise performance bottleneck that should be solved on the design level.
Explain what you're trying to do and why you think you need to increase the priority level of the threads. Most likely there is a better solution.
sunilkumar.d wrote: Is there any problem , if one thread created with "CreateThread" and
one with "AfxBeginThread"?.
If you're using MFC, and you are because otherwise AfxBeginThread() wouldn't be declared, you have to use AfxBeginThread() due to inner workings of the framework.
Read more about threads here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|