|
Thank you once more for helping me out, the answer was exactly what I`m looking for, another "this helped" for you Steen.
Cheers,
Alan.
AEGC
|
|
|
|
|
I found a couple more windows messages that might come in handy:
WM_ENTERSIZEMOVE
WM_EXITSIZEMOVE
WM_SIZING
WM_MOVING
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Hi
I'm already getting mad, I hope someone can help me
I want to send a sting beween two applications.
What I have so far is:
const UINT WM_MYAPP = RegisterWindowMessage("unique id");
.
.
.
char server[] = "something";
char ip[] = "111.222.333.444";
PostMessage(HWND_BROADCAST, WM_MYAPP, (WPARAM)server, (LPARAM)ip);
But in newsgroups I read that I is not possible to exchange strings using this method.
Here http://www.codeproject.com/threads/ipc_tute.asp is a good example that works but it uses memory mapped files and is a bit too complex for my purpose.
Is there no easier way to exchange strings between two applications?
regards
|
|
|
|
|
Use the WM_COPYDATA message. I believe there are a few articles here on CodeProject about doing just such a thing.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I will try it, thanks
|
|
|
|
|
Thanks a lot, it works fine
However, I have one more question:
I use HWND_BRODCAST to send the message system-wide.
But since PostMessage cannot be used with WM_COPYDATA
I need to use SendMessage.
But MSDN says: "...function calls the window procedure for the specified window and does not return until the window procedure has processed the message"
so how will be program be slowed down? how long does it take until the program can process with the following code?
regards
|
|
|
|
|
1) If you have the source code to both apps, you don't need to use HWND_BROADCAST. You can use the HWND of the target application. I assume you have the source to both programs, otherwise trading WM_COPYDATA messages back and forth would not be doable.
2) The Windows API does not restrict you from using PostMessage to send the WM_COPYDATA message.
3) There are two versions of SendMessage.
a) SendMessage - Uses the default timeout of five secons before timing out.
b) SendMessageEx - allows you to specify the timeout duration (in milliseconds).
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
point 1) I only have the sourcecode from the app which needs to get the string. A friend of mine wrote a program in delphi but I don't have access to the source. So I told him just to input the WM_COPYDATA function into his app in order to send me necessary data from his app into my app
point 2) MSDN says: An application must use theSendMessage function to send this message, not thePostMessage function.
I tried with PostMessage and it did not work
point 3b) what happens, if the function times out? Will no application get the WM_COPYDATA message?
|
|
|
|
|
1) He should be able to get your apps hwnd if he knows the window title (or scans the task list for the module name.
2) I guess I can understand that. Postmessage returns immediately, so there's a real good chance that the receiving app won't have time to process the string.
3b) In the event of a timeout, Sendmessage (and SendMessageEx) both return FALSE.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
1) use the clipboard
2) create a temp file
3) use the registry [dont forget to delete the temp keys you make]
|
|
|
|
|
You forgot:
4) Use WM_COPYDATA.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
6) Named pipes
7) Memory-mapped files
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
8) RPC
Carlos Antollini.
|
|
|
|
|
9) UPS
10) Federal Express
11) US Postal Service
|
|
|
|
|
Its true!!!
The use will be in this mode...
::SendMessage(yourAddress, theBox, company, type);
Carlos Antollini.
|
|
|
|
|
You guys are crazy
Thanks to everybody for his help
|
|
|
|
|
Yeah...
Nish
|
|
|
|
|
how i have to detect dialog control i want to disable is not focused one?
(i have to move to nextdlgctrl than)
i see no getactdlgctrl or similar
resp. main problem is
GetDlgItem(ID_MYCONTROL)->Enablewindow(FALSE);
not moves to next control automaticaly (has to?)
i have no special nextctrl handler
thanks for reply
t!
|
|
|
|
|
and it seems disabling actual button it brings problems with dialog hotkeys
disabling - during already opened dialog
t!
|
|
|
|
|
Have the following code as part of my DLL running on NT Workstation. For some reason it opens the registry key OK but can't Query the value. The value is definately in the registry. Interestingly, when I cut and paste the code into a standalone .exe it works fine. Anyone any ideas...is it a problem with UNICODE or similar?
//GET REGISTRY INFORMATION FOR DATABASE NAME
//
HKEY hKey;
if (ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\COMPANY\\PRODUCT", 0, KEY_QUERY_VALUE, &hKey ) )
{
DWORD dwBufLen;
char szDBName[256];
if (ERROR_SUCCESS == RegQueryValueEx( hKey, "DatabaseName", NULL, NULL, (LPBYTE) szDBName, &dwBufLen) )
{
OtherFunction(szDBName);
}
else
{
OtherFunction("\\default\\Data\\MyDatabase");
}
RegCloseKey( hKey );
}
else
{
OtherFunction("\\default\\Data\\MyDatabase");
}
Cheers
Steevie
|
|
|
|
|
DWORD dwBufLen;
char szDBName[256];
You need to init dwBufLen to the size of your data buffer so the API knows how large your buffer is.
char szDBName[256];
DWORD dwBufLen = sizeof(szDBName);
--Mike--
http://home.inreach.com/mdunn/
If there's something strange / in your VC code / Who you gonna call? / Ghostbusters!
your with and
|
|
|
|
|
Hi all,
Does anyone know how I can find out what is available from a DLL in code? I can find out what DLL's an app/dll requires (cause I got the code from MSDN ), but I'd like to take this a step further and find out what the DLL offers and what gets used by a calling app/dll. Much like the way Dependency Walker does it...
Cheers,
Dylan
|
|
|
|
|
if you right click on the dll in the explorer there comes this menu up.. if you use the second function ( under "open with" should be sthing like "view item".. i don't know that exactly cause i am using the german version of the os) you should see all the exportet functions of this dll...
hope this works for you...
bernhard
""Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|