Parallel and Distributed Programming Using C++, Cameron Hughes, Tracey Hughes[^] The title fits the description of what you're looking for ;), I didn't read it yet, but I intent to :) There are more book on the subject, just look through online book stores
Rage_bla
Posts
-
how to design muti thread program in VC++ -
AddressSpace of Hooked functionAbhinav agrawal India wrote:
while anyprocess sends any message, This function will be called from within the address space of that process itself or outside that proecess. Which process address space this function will map to?
WH_GETMESSAGE can be created as a global or a thread specific hook. If you created it as a global hook it is mapped (AFAIK) to all of the processes in the system (well, the current desktop). Specific calls to your hook come from the address space of the process that called GetMessage or PeekMessage. RemoteLib uses global hook to inject any dll to the target process: -it installs a global hook -it then forces the hook to be balled by sending a message to the target window -when the hook is called, the hook procedure calls LoadLibrary from the target process space and thus loads the dll too the target process space. Also see http://codeproject.com/dll/#Hooks H.
-
Templates & error C2440BadKarma wrote:
I have used MSVS 2005 (MS VC8) so this is certainly a bug in the VC7 compiler.
VC8 is probaby the only compiler I haven't tried :) VC7.1 - same error VC6 - more errors, oh well GCC3.2 - same error Thanks for your help
-
Templates & error C2440| Quote: >When you first write funtion(666); the compiler creates such function. Later you can get a function pointer from it. But that isn't what is happening (atleast I don't see it) - I first take the pointer and then call the function. And it works if I take the pointer to a function that has the exact signature, that is the int* parameter. The problems are created when I try to get a pointer to function and cast it to a function that takes a void* in the same command/line. template int IndirectFunction(int * pData) { return 0; } typedef int (*ONEPARAMFUNCTION_PVOID)(void* param); typedef int (*ONEPARAMFUNCTION_PINT)(int* param); int main() { ONEPARAMFUNCTION_PINT pF0 = &IndirectFunction; // ok!! ONEPARAMFUNCTION_PINT pF = IndirectFunction; // ok!! ONEPARAMFUNCTION_PVOID pF2 = (ONEPARAMFUNCTION_PVOID)IndirectFunction; // error!! ONEPARAMFUNCTION_PVOID pF3 = (ONEPARAMFUNCTION_PVOID)pF; // ok!! ONEPARAMFUNCTION_PVOID pF4 = (ONEPARAMFUNCTION_PVOID)(ONEPARAMFUNCTION_PINT)IndirectFunction; // ok!! int a =5; pF(&a); pF2(&a); pF3(&a); pF(&a); return 0; } The wierd part is that this works: ONEPARAMFUNCTION_PVOID pF4 = (ONEPARAMFUNCTION_PVOID)(ONEPARAMFUNCTION_PINT)IndirectFunction; // ok!! But this won't work: ONEPARAMFUNCTION_PVOID pF2 = (ONEPARAMFUNCTION_PVOID)IndirectFunction; // error!! But isn't this practicaly the same? IndirectFunction should have the same signature as the ONEPARAMFUNCTION_PINT so the cast shouldn't be needed and the second example should be the same as the first one (I even tried forcing the same calling convention, but MSVC7 still thinks that ONEPARAMFUNCTION_PINT and IndirectFunction have different signatures and requires the cast to ONEPARAMFUNCTION_PINT first) ???
-
embedded propertysheet in a dialogbar: how to make ON_UPDATE_COMMAND_UI work>The problem seems to be that the idle message does not cascade on from CMyDialogbar into the CMyPropertySheet. Any ideas? Try handling it yourself. afx_msg LRESULT OnKickIdle(WPARAM,LPARAM); ... ON_MESSAGE(WM_KICKIDLE,OnKickIdle) ... LRESULT CMyDialog::OnKickIdle(WPARAM wp, LPARAM lCount) { UpdateDialogControls(this, TRUE); // the dialog // try pMyPropertySheet->UpdateDialogControls(this, TRUE); // or UpdateDialogControls(pMyPropertySheet, TRUE); // or pMyPropertySheet->UpdateDialogControls(pMyPropertySheet, TRUE); // or ::SendMessage(pMyPropertySheet->GetSafeHandle(), WM_KICKIDLE, wp, lp); return 0; } One might work (I am not sure if this is the right way to do this or if it still works - WM_KICKIDLE is/was internal MFC message). Try it... There might be an extra include for the WM_KICKIDLE that is needed... Good luck! H.
-
Templates & error C2440And it works perfectly! I would never think of this on my own - it looks wierd, but it works!! Thank you so much! H.
-
Templates & error C2440I need some help. Here it the whole code snippet: #include "stdafx.h" template int IndirectFunction(int * pData) { return 0; } //also tried //int __cdecl IndirectFunction(int * pData) //{...} typedef int (*ONEPARAMFUNCTION)(void* param); //also tried //typedef int (__cdecl *ONEPARAMFUNCTION)(void* param); int main() { // <<<<<<<<< //error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'ONEPARAMFUNCTION' ONEPARAMFUNCTION t = (ONEPARAMFUNCTION) &IndirectFunction; // >>>>>>>>> return 0; } How can I make it work ?? I tried googling a little - C2440 seems to be pretty "popular" but I didn't find anything that could help me. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/C2440.asp also didn't help :( Seems it happens becouse of the template, if I remove it compiles ok (using only - int IndirectFunction(int * pData) without the template<>). If I replace: int IndirectFunction(int * pData) with int IndirectFunction(void * pData) it compiles ok. If I use templates and int* as parameter I get the error. Help! -- modified at 14:22 Friday 21st October, 2005
-
Safe LanguageTry googling unsafe for C# and you'll se what is considered to be unsafe. Some of the "unsafe" things are: -variables don't have to be initialised before use -you can cast pretty much anything to anything else -pointers are generaly unsafe -normal arrays are not bounds checked and can owerflow -a milion more things...
-
Please help me... (screen shot)Try using RegisterHotKey for receiving Win+D or a global hook. I don't know how you could respond to that specific button, but quick launch bar is fully customisable and you could add a shorcut to an application that would show your application (or even a shorcut to the application itself). -- modified at 13:49 Friday 21st October, 2005
-
Slow access to arrayUse "Ignore HTML tags in this message" when posting becouse half of your code is missing ;)
-
Slow access to arrayint main(int argc, char* argv[]) { DWORD beg = GetTickCount(); int i,j,k; for (j=0;j
-
Slow access to arrayAre you sure you mean: M3[1]=M1[1]*M2[1]; and not something like: M3[k]=M1[i]*M2[j]; If you were really talking about the first I can't see how it would be possible to be any slower/different than the second example you posted. If you really ment M3[k]=M1[i]*M2[j] read on: First, compile with optimizations turned on. It that doesn't work try using pointers: for (pj = &j[0]; pj < &j[1000] ; pj++) for (pi = &i[0]; pi < &i[1000] ; pi++) for (pk = &k[0]; pk < &k[1000] ; pk++) *pk=(*pi)*(pj); Smart compilers might do this for you automaticaly. H. -- modified at 20:31 Saturday 8th October, 2005
-
How to create a HUGE 2d array?Look into CreateFileMapping/MapViewOfFile - it might allow you create big "arrays".
-
declaring const stringsThe first one is an array of three characters and it is not 0 terminated. The second one won't even compile. The static const char str[4] = "abc" will compile - "abc" is 0 terminated thus the array has 4 members.
-
XP visual styleThank you. It is working now. And it looks much nicer now :)
-
XP visual styleWhen I create the MFC dialog application (with the manifest generation enabled) my dialog should use the XP visual style common controls, right? Well, it doesn't! Is there anything else I have to do? -- modified at 19:18 Saturday 1st October, 2005
-
Redraw the full screen?Thank you. I think one of your methods will be perfect...
-
Redraw the full screen?InvalidateRect(NULL, NULL, TRUE) will invalidate all windows. Now I need something like UpdateWindow or RedrawWindow, but for all windows. -- modified at 13:22 Saturday 1st October, 2005
-
Redraw the full screen?Thanks for the response. Unfortunately it didn't work :(( The reason I need to erase/redraw/invalidate everything is becouse I am drawing on the screen DC (GetDC(NULL)) but at the some point I want to revert changes. I guess enumerating all windows and invalidating the visible ones could work but I tought the might be a better way...
-
Redraw the full screen?How can I redraw the full screen (all the windows)?