|
It's really not that complicated once you have done it a couple of times. The do while loop that you are using is extremely wasteful in terms of CPU utilization. The proper way to block a thread is with WaitForMultipleObjects. Also, you should never block the main thread of your application. The best solution would really be to use a background thread to draw on a BITMAP and use use BitBlt to transfer the image to the screen every 333 ms.
As a side note the values returned by GetTickCount are really only accurate to 15.2 ms so using it to time 33 ms isn't going to work well on a loaded machine. The advantage of the multimedia timer is that you can truely have 1 ms accuracy. And by using a background thread and proper thread synchronization your code will scale properly on faster and multi core machines and still work correcly on a slower or heavly loaded machine.
|
|
|
|
|
In this case I need to wait not 333ms absolutely, but (333ms minus (the time taken to read that frame from a file)).
|
|
|
|
|
Hello VC++ gurus,
I have to add a dual interface to a non-MFC, non-ATL application.
I have a non-ATL, non-MFC enabled project and a plain Win32 application. Now, this Win32 exe must expose some services through an IDispatch interface.
My question: Can I somehow use ATL to help me with that IDispatch implementation? Event if the project is a non-ATL project?
Note: My Win32 exe must act as Local Server (CLSCTX = CLSCTX_LOCAL_SERVER) here.
I'll appreciate your help a lot.
Regards
P.S.: Thanks to all how replied to this thread.
I'll try to use ATL in my non-ATL project: use CComObjectRootEx, CComCoClass, IDispatchImpl and CAtlModuleT<base> etc. straight away. So far, it looks OK.
Regards,
Joerg
|
|
|
|
|
|
Thanks. Now, let me try to understand the XYZDispatchDriver: does it assume that the IDispatch Interface has been defined (in an IDL) and a coclass has been implemented? Or, is this created dynamically on the fly?
In my situation, I do not yet have IDL defined, class implemented.
Regards,
Joerg
|
|
|
|
|
Sorry, I'm not a COM expert, I just remembered this article from my own studies on the subject. You could try posting your question at the end of the article as it will then go to the author, who probably is an expert.
|
|
|
|
|
Thanks anyway.
|
|
|
|
|
See here [^].
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]
|
|
|
|
|
I've seen that; just trying to be lazy and avoid all that handwriting... Is there a "lazy way"?
|
|
|
|
|
jmen@moc wrote: Is there a "lazy way"?
Quote Selected Text
Yes: ATL (A ctive T emplate L aziness).
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]
|
|
|
|
|
CPallini wrote: Yes: ATL
Using ATL once you know it is "laziness" (in a good way), but learning it?
|
|
|
|
|
I don't need a code obfuscator: I'm writing a template library wrapping COM.
--The ATL's author, former Klingon developer.
I don't need to learn it, I just need to use it.
--The VB6 developer
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]
|
|
|
|
|
You mean, I can add ATL templates, macros and an ATL IDispatch implementation, eveen if my project is not an ATL Project? Would be good enough for me.
Regards, Joerg
|
|
|
|
|
I suppose (note: suppose) it would be simpler transforming you project in a ATL one.
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]
|
|
|
|
|
A message in Italian in the .NET Framework forum; can you help with it?
|
|
|
|
|
There's something wrong in the post: it looks like a direct request to another Italian woman (i.e an e-mail (un)intentionally posted on the forum). The same poster was able to write a request in good English here http://www.codeproject.com/Messages/3272888/Re-Problem.aspx[^].
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]
|
|
|
|
|
Hi every one,
I develpoing a MFC application which uses a Win32 dll. This Win32 dll contains a DIALOG Box resource. I wanted to show this dialog by calling an exported function from this dll. But when calling this dialog through
DialogboxParam API it returns with error 1812( RESOURCE NOT FOUND). I am solved this problem in MFC by calling AFX_MANAGE_STATE(AfxGetStaticModuleState( )). How to do this in Win32 way.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
For pure Win32...
The DialogBox function has a first parameter of
hInstance , which is the HINSTANCE of the DLL where you get the resource from.
If you loaded the DLL using LoadLibrary, then you already have that parameter. If not, then when the DllMain function of the DLL is called at load time, then the HINSTANCE is passed then. Just remember it!
(ie, in a extern variable that all the CPP files in the DLL have access to.
That's how I did it in the old days!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi Iain,
I am loading the dll using LoadLibrary from a MFC application. And i am using a global HINSTANCE value from DllMain.But still this cause problem. Is this cause the resource handle of the dll be changed?
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
Erm, your first email said you were succeeding with MFC.
I told you how to do things in pure Win32.
Now you say you still have problems.
These facts do not fit each other.
Please expand on what you are doing, so I can help better,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi,
Try passing AfxGetResourceHandle[^] as the first parameter to the DialogBoxParam Function[^].
P.S.
Your signature says your name is: Jose Jo Martin and your username says your name is Nitheesh George. Are you suffering from an identity crisis?
Best Wishes,
-Randor (King of Eternia) and (David Delaune)
|
|
|
|
|
Hi:
I have started working with the library VTK and I want to use Windows Forms as GUI. I supposed that I have to create an OpenGL view on a Windows Form, and then connect in some way with VTK classes.
HOW I can do that? I'm trying to represent an VTK object in a Windows Forms. Anyone have any simple example?
I'm new in that and any kind of help would be welcome.
Regards,
María
|
|
|
|
|
Hi
I need to collect information about applications that running on the computer while my application's working. Information like the size of the form, how many buttons are on the application's form etc.
I'm using c++, how can I do that? Whee is this information been saved?
Can I have an access to it?
Thanks a lot
Itay
|
|
|
|
|
You can use the EnumWindows()[^] function and then go through all the children for each top level window you find.
|
|
|
|
|
thanks for the quick answer.
how can I find top level window? what kind of information can I get with this function?
|
|
|
|