From: DJ Delorie Subject: Re: DLL fun 12 Jan 1999 10:18:48 -0500 Message-ID: <369B67D8.B38172DF@delorie.com> References: <833e5hboiq DOT fsf DOT cygnus DOT gnu-win32 AT apollo DOT int DOT newport DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.1.126 i586) X-Accept-Language: en Rui-Tao Dong wrote: > However, I have one minor problem. Everytime the framegrabber pops up > an error message, it goes to the machine with the framegrabber not to > my local PC. I tried to do something like > > int __attribute__((stdcall)) MessageBoxA(int handle, char* msg, char* title, int type) Nice try, but I don't think this will do what you expect. The problem is that when DLLs are build against the import libraries of other DLLs, the final link is done. By the time you link your application against that DLL, it's too late to override functions like that. Each DLL has an "import list" that defines not only the functions it needs, but which other DLLs they come from. The only way to override the function call (like you're trying to do above) is to create a new DLL with the same name as the one that function is in (like gdi32.dll), but then you'd have to replicate *all* the functions. Overriding the function like you're trying to do would only work for the application in which your override exists. It won't override other DLLs your application links against. DJ