|
Hi.
Is it possible to pass a pointer to a class member function to a worker thread?
Otherwise, is it possible to pass in a global function? If yes, do you have to use typedef (*func)(parameters)?
Thanks,
Kuphryn
|
|
|
|
|
1. no. well, not directly, in most cases. you could, for example pass the object itself and then use the function from there. or if the function is a static member function, you can pass it as a normal function pointer. but, passing a non-static member function isn't possible because there's no "this" pointer to establish a context for the function.
2. yes, if you're passing the function pointer. no, if you're passing a class.
-c
Greenspun's Tenth Rule of Programming:
"Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
|
|
|
|
|
|
|
DrPizza of GameDev brought up a solution I missed yesterday. The solution is to encapsulate a function in a struct that is a class member. That will allow you go not have to declare a global function.
The only thing I am uncertain of is if you have a private member struct, will the global worker thread function i.e. the function you pass to __BeginThread() recognize the abstract private member.
Kuphryn
|
|
|
|
|
Hi.
How do you pass data and/or pointer to data in a parent process, both primary and/or child threads, to the primary thread (default) of a child process?
Jeffrey Richter demonstrates the use of CreateProcess(), but he does not discuss a way to pass in data.
Thanks,
Kuphryn
|
|
|
|
|
You need to use an IPC mechanism like NamedPipes, sockets or - the most easy one, shared memory.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
|
Okay. Thanks.
Which method of passing data across processes performs best?
Kuphryn
|
|
|
|
|
Don't pass pointers across process boundaries.
Each process has its own addresses for stuff.
Create a shared memory space and use offsets
into that as your sharable "pointers."
(You can try to map the memory to the same address
in each process, but that isn't guaranteed to
be successful.)
|
|
|
|
|
Okay. Thanks.
I re-read Jeffrey Ritchter's section on file-mapping. I believe using a file-mapping virtual memory is an effective, if not, the best way to share data across processes.
Kuphryn
|
|
|
|
|
Hello again
How can i bold the text of static box ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hold an appropriate CFont object somewhere (for instance, as a member variable of the parent dialog) and set it as the one used for your static with CWnd::SetFont . As you only need to "boldize" the current font and leave all other aspects unchanged, you can construct it from what your static already has (see CFont::CreateFontIndirect , CWnd::GetFont and CFont::GetLogFont ), changing only LOGFONT::lfWeight .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
That is a *great* title. 'Bold, the text of static box'. It's almost poetic.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Christian Graus wrote:
It's almost poetic
ROTFLMAO
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Hello !
I want to display a report(*.rpt) by Crystal Report library !
I don't want to use Crystal Report ActiveX ...
Can you write example ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You could use the Crystal Report API engine, however it's just about reached the end of it's lifetime and I can tell you with a great degree of experience with all things Crystal and C++ that you really, really, really *do* want to use the ActiveX RDC (Report Design Component)
The crystal reports developers help file CrystalDevHelp.chm that is installed with Crystal Reports contains the full reference for using the API in the section titled "The Crystal Report Engine Class Library Reference".
We've used the API for many years but we're switching all our development to the ActiveX for many reasons: It's the only method they fully support, it's the only method they want people to use because their dropping the API by the looks of it quite soon, the ActiveX RDC has increasingly (after each release) more functionality than any other method.
Whenever they add a new function they only seem to be adding it to the ActiveX from now on.
But most importantly, it's far, far easier to use the ActiveX and there is no more overhead than any other method.
Ground Zero Tech-Works
http://www.ayanova.com
|
|
|
|
|
Hello Mr. Cardinal,
Thanks for reply !
But i have to use CR API engine ...
Because my BOSS told me that i don't register any ActiveX in the user computers
So, i have to use API engine ... right ?
If i use CR API engine then i don't need to register any ActiveX or DLL ??
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hadi_Rezaie wrote:
If i use CR API engine then i don't need to register any ActiveX or DLL ??
even if you use the API, you still have to deploy a whole lot of DLLs into the user's "Program Files\Shared Files\..." directory and "%windir%\system32" directory...
|
|
|
|
|
Hello Hadi, even if you use the api you *still* need to install many .dll files as well as register some of them on the end users computer. There is no avoiding that. The API method just allows you to easily call functions in Crystal Report's .dll files, it doesn't wrap that functionality inside your program so that you don't need to include anything else. There is no way to do that.
Either way you have to register *something* on the end user's computer and both the API method and the RDC (activex) method are royalty free so you're in the same situation whichever way you go except for the very important facts that the ActiveX has more functionality, is easier to use for the programmer and will continue to be supported in future by Crystal Decisions.
I'm my own boss so I do what's best always! <grin>
However,it sounds like your going to have to explain the situation to your boss.
Specifically the information you should look at before you speak with the boss is look at the Crystal Reports developer's help file that I mentioned previously under the sections regarding deployment which will list for you each file that you have to include with your application for both the API method and the ActiveX method.
Good luck
Ground Zero Tech-Works
http://www.ayanova.com
|
|
|
|
|
Hello Mr. Cardinal !
Thanks alooot for your useful help
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello there,
How can i change the editbox to make a Flat editbox ?
I don't want to remove the border !
I just want to make flat editbox !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You can turn off border and set "Static edge" extended style to achieve a semiflat look, or you need to use owner draw control.
Pavel
Sonork 100.15206
|
|
|
|
|
Does Visual C++ support the statvfs object? If not, is there an object that is used to retrieve information about a partition (total size, size used, ect)?
|
|
|
|