zeroxmxi
13th October 2007, 03:00
Hi there, I know this has been asked many times in the forums and it's one of those things I still don't get it.
Some time ago, shaneh replied to one of my post regarding how I can get the filename. He offered two ways, one of which is to read from the process memory which he thinks it's not really cool and Microsoft might prevent that in the future.
The other way is to use a message-only window and sends a WM_COPYDATA message to the pewnd. This is cool, I managed to write a win32 C++ application, create a message-only window and when a WM_CREATE message is received in the event queue, it will send a WM_COPYDATA message to the pewnd and Winamp will trigger the WM_COPYDATA message in my application's event queue that's where I obtain the filename from the COPYDATASTRUCT. In summary the flow looks like this..
[main function]
create window class
create message only window
set up a message loop
[window procedure]
on WM_CREATE, send WM_COPYDATA message to pewnd
on WM_COPYDATA, get the filename
on WM_DESTORY, post quit message
That's about the simplest way I want to describe the application I created. It's a win32 unicode executable.
I have a few questions regarding this though.
That... all these set up just to get the filename is it really efficient, as compared to the not so recommended read process memory way?
And I have been wanting to create a DLL to be able to read the filename from winamp. Do I go through all that the same as I did for the win32 executable and apply it on win32 DLL?
I understand I have the HINSTANCE right from the DllMain entry point and I can write codes to create the message-only window. That's cool but what about the message loop in a DLL? Where do I put the message loop in a DLL code?
DllMain (entry point)
you've got HMODULE which is the HINSTANCE that can be used to create windows, how can I expose or make visible to exported function.
other exported functions outside DllMain (how can they access HINSTANCE?)
Please give me some valuable advice, thanks :D.
Some time ago, shaneh replied to one of my post regarding how I can get the filename. He offered two ways, one of which is to read from the process memory which he thinks it's not really cool and Microsoft might prevent that in the future.
The other way is to use a message-only window and sends a WM_COPYDATA message to the pewnd. This is cool, I managed to write a win32 C++ application, create a message-only window and when a WM_CREATE message is received in the event queue, it will send a WM_COPYDATA message to the pewnd and Winamp will trigger the WM_COPYDATA message in my application's event queue that's where I obtain the filename from the COPYDATASTRUCT. In summary the flow looks like this..
[main function]
create window class
create message only window
set up a message loop
[window procedure]
on WM_CREATE, send WM_COPYDATA message to pewnd
on WM_COPYDATA, get the filename
on WM_DESTORY, post quit message
That's about the simplest way I want to describe the application I created. It's a win32 unicode executable.
I have a few questions regarding this though.
That... all these set up just to get the filename is it really efficient, as compared to the not so recommended read process memory way?
And I have been wanting to create a DLL to be able to read the filename from winamp. Do I go through all that the same as I did for the win32 executable and apply it on win32 DLL?
I understand I have the HINSTANCE right from the DllMain entry point and I can write codes to create the message-only window. That's cool but what about the message loop in a DLL? Where do I put the message loop in a DLL code?
DllMain (entry point)
you've got HMODULE which is the HINSTANCE that can be used to create windows, how can I expose or make visible to exported function.
other exported functions outside DllMain (how can they access HINSTANCE?)
Please give me some valuable advice, thanks :D.