News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Windows question

Started by shankle, October 24, 2011, 01:07:23 PM

Previous topic - Next topic

shankle

Looked for examples in Masm32 and Izellion. Couldn't quite find an ex. of what
I need.
Two programs running at the same time with an rsrc file used by both.
Is that an Dynamic Data Exchange or an MDI or something else?
My something else doesn't quite hack it.... :(
The greatest crime in my country is our Congress

ToutEnMasm

At run time,you need to pass the adress of the resource to the prog who haven't a ressource.
This need an exhange of messages between the two prog.
More simple soluce is to write in the same directory ,two progs who share the same resource file .rc.
Each prog have there own resource,but it's the same.
Perfect soluce is to write  a DLL.

dedndave

if you like, you can use the same program to do both   :P

you can use a WM_USER+nnnn message to exchange window handles
or use the command line to pass window handle 1 to window 2, then use WM_COPYDATA to send handle 2 to window 1
after that, use WM_COPYDATA to communicate - at least, i found that to be the simplest way

ToutEnMasm


For the WM_COPYDATA the WM_USER msg is not very secure.The same msg cn exist twice or more.
Msdn prefered to know the class of the receiving window:
Quote
hwDispatch = FindWindow( "Disp32Class", "Hidden Window" );
   if( hwDispatch != NULL )
      SendMessage( hwDispatch,
                   WM_COPYDATA,
                   (WPARAM)(HWND) hWnd,
                   (LPARAM) (LPVOID) &MyCDS );
   else
      MessageBox( hWnd, "Can't send WM_COPYDATA", "MyApp", MB_OK );

http://msdn.microsoft.com/en-us/library/windows/desktop/ms649009(v=vs.85).aspx

jj2007

Quote from: shankle on October 24, 2011, 01:07:23 PM
... or something else?

It is something else. Resources get stored in the executable, so no interprocess communication required.
You might check So how does one share resources among processes? in a well-known MS article, though - interesting reading.

dedndave

#5
nice find, Yves
i am going to play with that method

Jochen - the link you posted brings up "Give Me a Handle, and I'll Show You an Object"
which is nice reading also   :P
i hope ms doesn't get too fancy with the article titles - i want to be able to find stuff
EDIT: ok - about half way down the page, i found what you were talking about   :U

i am also playing with RegisterWindowMessage
the only thing i don't like is that the message stays registered to end of session
i guess it isn't a huge resource hog   :P
it is easy to use - i'll say that much

shankle

Thanks guys,
Working on your suggestions. It will take me awhile.
The greatest crime in my country is our Congress