|
Either one would work ... I've just used WaitableTimers more than TimerQueues so I knew that one off-hand.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
You can also use SetTimer using a callback function. The only tricky bit is that you need to run a message pump as this is where timer callbacks are performed; most people don't know this and since must apps are GUI the lack causes no problems.
Steve
|
|
|
|
|
Hi,
I'm using OpenCV library to access a webcam and display images from it in my dialog based application. I use 'cvNamedWindow' to create a window and 'cvShowImage' to display it. I dont know how to change any properties of the window except its position. So how do i make the window be always on top?
If possible pls let me know how to display using cvShowImage in one of my dialogs or windows
Thnx in advance
nalintharanga
|
|
|
|
|
SetWindowPos(SWPTOPMOST, 0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
That's some pretty rusty memory I'm relying on. I'm already thinking it may be swpTopMost. Anyhow, google for SetWindowPos to find out what that first parameter is, I'm not confident of the others.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Scenario:
I have an application that loads a bunch of DLL's. The DLL's share the same header file which describes their exportable functions and therefore behave like plug-ins. I use GetProcAddress to get each DLL/plugin function pointer. My application and the DLL's are written in C++ as I want the DLL's to throw exceptions on error and the main application to catch.
Problem:
My problem is when using extern "C" __declspec(dllexport) in the DLL header as this doesn't allow exceptions being a "C"-style function. If I remove the extern "C" from the DLL function prototypes, the exceptions compile but GetProcAddress fails on every single call at runtime.
How can I get to use GetProcAddress in a non extern "C" function so I can use exception handling across DLLs?
|
|
|
|
|
If you don't use extern "C" you will have to use the C++ decorated name in the GetProcAddress call. This introduces a small potential problem because MS seem to change the decoration with every new release of the compiler but you will just have to live with that.
To find out what the decorate name is you may want to generate a map files when building the DLLs
Regards,
Phil
|
|
|
|
|
Functions exported as C++ functions will have their names decorated according to a compiler-specific naming scheme. You can use Depends[^] or dumpbin to view a DLL's exports and find the decorated names. Those are what you'll use in GetProcAddress() calls.
|
|
|
|
|
Do the functions have to be extern "C" ? Usually this is done to affect the name mangling done to the function name, but you can also do that via the .DEF file (rename function names in the .DEF file), or use GetProcAddress(...) with ordinal values. You can also adjust the calling convention to be more "C-like" in code without the extern "C" .
To export undecorated names, you must first get the decorated name of the function in the DLL (use dumpbin or get a MAP file from the linker), and then in the .DEF file under the EXPORTS section, you do something like:
EXPORTS
TheFunc=_MyFunc@4 Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Cool! I did not know you could do that
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
Thanks for all the responses. They were very helpful!
:->
|
|
|
|
|
I use Visual 2005 Studio. I want to find a (very basic) simple Server/Client program that transfer my data (UDP). Please show me some code in Windows C++ SDK...THANKS.
|
|
|
|
|
Have you checked out any of these[^].
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
When creating a CBrush object, there are limited colors that can be chosen. I need Red and Red is not one of those available.
i have tried this
CBrush Brushred(RGB(255,0,0));
Then i do a SelectObject on Brushred through the dc.
This gives me white no matter what RGB values i enter.
How can i get a red Brush?
|
|
|
|
|
Can you show snippet code
|
|
|
|
|
This is what i use...
//Set pRect Values here
RECT* pRect = new RECT;
this->GetClientRect (pRect);
//Create and select a red brush
CBrush BrushRed(RGB(255,0,0));
CBrush *pOldBrush = dc.SelectObject(&BrushRed);
//Draw Rectangle Frame
dc.FrameRect(pRect, pOldBrush);
|
|
|
|
|
You can use dc.FrameRect(pRect,&BrushRed)
|
|
|
|
|
That did it.
Thanks much.
Do you happen to know much about DrawDragRect function? I posted this question as well a few threads down
|
|
|
|
|
Did you see link in my reply?
|
|
|
|
|
LCI wrote: dc.FrameRect(pRect, pOldBrush);
You're passing the wrong brush to FrameRect()
|
|
|
|
|
Hello gurus,
Using the SetThreadAfinity and SetThreadIdealProcessor APIs allow you to tell on wich CPU the thread will run.
Is there is a way to exploit all available CPU time from other CPUs?
I mean by that when I have a big thread is running and the CPU is full (100%), this same thread consume the other free CPU time in order to accelerate the proccessing.
I know that a thread initially runs on 1 CPU. But maybe it is possible to a thread to use other CPU time.
Thanks for the help.
There is no spoon.
|
|
|
|
|
bouli wrote: I know that a thread initially runs on 1 CPU. But maybe it is possible to a thread to use other CPU time.
A thread can be scheduled to run on different CPUs, but since we are talking about a single thread here, it can only be running on one CPU at a time. If you want to use two (or more) CPUs at once, you will need a thread on each one.
Adjusting the thread priority can get you scheduled more often, but this can adversely affect other processes, and is generally not a great idea for long running threads.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi Friends,
I am facing couple of problems while compiling the code, and this is the first time I am facing this kind of problem so I don't understand how to resolve this, Please help me out.
The problems are as follows:
1. When I am compiling a code I am getting message saying " The source file XXX and YYY are both configured to produce the output file XXX.obj This project cannot be build.
2. After every modification I am getting mesage saying " XXX.clw, This file has been modified outside of the source editor. Do you want to relode it?" I am getting this message so much time that I am unable to work.
3. Some times my code is getting compiled and some time it is giving error saying undeclaired member variable even though the variable is declaired. some times same code is getting compiled withot any error.
Thanks & Regards,
-Dinesh.
|
|
|
|
|
do you have two files with the same name at two different locations with the same name ?
|
|
|
|
|
You are right.....
Project names are different but both the projects are having one "xxx.cpp" file comman and both the projects are stored at different location
|
|
|
|