|
O.K well since I seem to be in the right forums I'm gonna have alot of questions scince I've never really used C++ or any other scripting language before. I hope I'm not a bother. Anywho I was wondering how functions can be applied, like can they have random things in them or do they follow a specific set? Generally I'd like to know a tad more on functions.
I'm a true failure.
|
|
|
|
|
Can you explain what do you need?
|
|
|
|
|
Learn2LikeIt wrote: I've never really used C++ or any other scripting language before.
First, C++ isn't a scripting language. Second, what books on C++ have you read?
The evolution of the human genome is too important to be left to chance.
|
|
|
|
|
How do i setup timers in a console application? Is it possible? does anyone know any tutorial on this matter?
Thanks
|
|
|
|
|
It is fairly simple. Take a look at the MSDN documentation for CreateTimerQueueTimer()
led mike
|
|
|
|
|
Thanks! Didn't know about this one
|
|
|
|
|
See here.
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
|
|
|
|
|
Second time this has happened eh? I say TimerQueueTimer and you say WaitableTimer. 6 to one tomatoes to another.
led mike
|
|
|
|
|
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)
|
|
|
|