|
If you're enumerating open windows and getting the HWND from the Window title, then you should have no trouble sending data to whichever window you want. The problem you have is that you specify a HWND in WM_COPYDATA, therefore you send the message to one Window only. You can do one of two things:
1/ Enumerate Windows and send the message to all the Windows that may want it, or
2/ If you always have the same number of windows up you can set up a chain where the message gets passed on if it's not needed.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thanks for the reply.. I think I may have it figured out.. Once you use WM_COPYDATA do you have to wait a certian amount of time before you can use it again? It seems to work fine if I wait for a minute or so between copying the data.. For example I have a console app with a list control and as I open dialog boxes I set a different name for each dialog and then I have the dailog box send its name to the console app then I can pick the name of the dialog from the list control and push a kill button and it sends a msg to the dialog with the name I picked and it closes the dialog box.. If i move right away to the next dialog box in the list and click close it comes back and says cant find dialog XXXXX.. if I wait for a minute or so and try again it works.. weird huh? If you want I can post some code of my WM_COPYDATA.
Thanks,
Mike
|
|
|
|
|
Maybe if you post some code - I've only used copydata to send info between two programs, so I've never had that problem.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I have been doing some troubleshooting and found that when it sends the kill CString to the receiving app the string contains garbage along with the string.. Here is the code I use to send the string to the other app. Any ideas on how to remove the garbage?
Btw, the m_strKill is the name of the other window and the string being sent for the kill command..
UpdateData(TRUE);
LRESULT copyDataResult;
CWnd *pOtherWnd = CWnd::FindWindow(NULL, m_strKill);
if (pOtherWnd)
{
COPYDATASTRUCT cpy;
cpy.dwData = 0;
cpy.cbData = m_strKill.GetLength();
cpy.lpData = (void*)m_strKill.GetBuffer(cpy.cbData);
copyDataResult = pOtherWnd->SendMessage(WM_COPYDATA,
(WPARAM)AfxGetApp()->m_pMainWnd->GetSafeHwnd(),
(LPARAM)&cpy);
m_strKill.ReleaseBuffer();
}
else
{
MessageBox("Can't find "+m_strKill);
}
UpdateData(FALSE);
Thanks,
Mike
|
|
|
|
|
I always go GetLength + 1 in order to allow for a NULL terminator. Sounds like that is what you need - your string keeps going until a NULL occurs in memory after your string's data.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
That was the ticket! Thanks alot Christian!
Mike
|
|
|
|
|
Hi
Does anyone know how can I acces the printer port from win2000?
Thanks;
xxx
|
|
|
|
|
I try to send information of a primary snapIn (Per example, number of nodes or name of each node of primary snapIn ) towards a extension SnapIn but I don't understand really how it works.
I believed to understand that it was necessary to use the interface IDataObject to communicate between Primary and Extension SnapIn but documentation on this matter are vagueness or non-existent
Thanks for you help
|
|
|
|
|
Hi everyone!
Does anyone know how to write a CTransInPlaceFilter derived filter which
works better then the NullNull filter sample in DirectX8 SDK .
My main problem is that when I resize the frame window the video window is not
allways resized . This fenomena occurs when I'm trying to increase the size
of the original frame . The frame is resized but the the video size is
constant.
Thanks
xxx
|
|
|
|
|
Is there a way to disable the 'click' sound the browser object makes when it begins loading a page?
CD
|
|
|
|
|
Hi all,
Bit of a newbie question I think, I've got an MDI app. and I've created several different views using CSplitterWnd (to make an Explorer style interface), when an item is double clicked in the CListView I want to Expand the TreeView item that is highlighted. But I can't seem to get a pointer to the TreeView object. How do I do this?
My best "work-around" so far is to save the TreeView CWnd as a variable in my document class and access it from there. Does that sound naff?
TIA
Jon.
|
|
|
|
|
Hi everybody,
how can i close an application through my application.
I launch outlook -with shellexecute- somewhere within my code and want to close it after finishing with it...Is it possible? if(possible) How?
thanks in advance
with greetings from germany
Özgür
|
|
|
|
|
You need to execute the application with CreatProcess() Function, then close the application with TerminateProcess() function.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Hi,
I'm currently working on a thumbnail viewer, which displays a large
number of thumbnails.
How do i implement smooth scrolling of all the thumbnails???
Any Ideas, tips or answers would be great.
Cheers
Will
|
|
|
|
|
1. create a DC (CreateCompatibleDC)
2. create a bitmap (CreateCompatibleBitmap)
3. select that bitmap to the DC (SelectObject)
4. copy the screen to the bitmap (BitBlt)
5. copy the bitmap to the screen, offset by the scroll amount (BitBlt)
6. clean up
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I Already use a memory device conntext the size of the screen and offset it for the scrolling.
The problem comes when the ammount of thumbs are to large for the Memory Device context.
To actually display all the thumbs, when the scrolling reaches the end of the Memory DC, I offset the DC again and draw the next set of thumbs.
This works and I can see all the Thumbnails but is rather messing when scrolled fast.
(i.e. NOT SEAMLESS)
What I am looking for it a way to enable smooth scrolling for an unlimited amount or Thumbnails.
Any Ideas? ANYONE
|
|
|
|
|
Don't know if it will work for you but have you looked at IPicture or IViewObject. You can set the aspect as DVASPECT_THUMBNAIL.
|
|
|
|
|
I am using an activeX control of a third party. The control name is "True Db Grid Pro 7.0".To populate this activeX i need another activeX named "ComponentOne XArrayDB Object (XADB7.OCX)". In VB this control is added through "REFRENCES" . How i add this refrences in VC++.
Addition in VB
--------------
"Select References… from the Project menu to display a list of available type library references. Select the check box labeled ComponentOne XArrayDB Object (XADB7.OCX), then press the OK button."
i tried to insert this activeX in VC++ but an error is prompted.
what i want to know
....................
what is equivalent of Vb REFRENCES in VC++
Have a nice wishes for helper.
|
|
|
|
|
hello everybody,
I have a c++ program in which i generate data that i
have to put in a excel file. But i don't know how
to write data in a excel cell.
Can you help me?
S.
|
|
|
|
|
Hi,
Have a look at http://www.codeguru.com/mfc_database/excel_sheets_using_odbc.shtml
it is a good starting point...
with greetings
Özgür
|
|
|
|
|
just write 0x00 to the file as you normally write a char to the file.
/Fredrik Sigbjörn
|
|
|
|
|
I use a CSocket derived class with a derived CWinThread class and use CArchive with it. For some yet unknown reason Send() locks after a while of running (hours). The opened socket has communication initiated from both client and server at times, if that helps. (Server sends tiny data once per second, client sends kB data occasionally, like every 10 seconds or so, plus both sides sends an ACK byte for every command)
Anyway, since I cannot find the reason of the locking, I want to get around the locked state. I want to make something from the outside and would like to have an OnIdle timer reset at intervals in the CWinThread. A parent thread will check this timer and if it isn't reset in reasonable time (seconds) the parent thread will call CancelBlockingCall() on the locked socket.
Now, will this work? Isn't it illegal to call the CSocket object function from another thread?
|
|
|
|
|
Hi,
I have a CFrameWnd dervied class ans i would like to remove the Min and Max buttons in the top right of the window. How would I acomplish this?
Cheers
Will
|
|
|
|
|
This code snip from MSDN about CWnd::PreCreateWindow explains this quite well.
// alter the styles of the main frame window
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// Create a window without min/max buttons or sizable border
cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER;
// Size the window to 1/3 screen size and center it
cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 3;
cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 3;
cs.y = ((cs.cy * 3) - cs.cy) / 2;
cs.x = ((cs.cx * 3) - cs.cx) / 2;
return CFrameWnd::PreCreateWindow(cs);
}
If you want to keep the old styles try this
cs.style &= ~WS_MAXIMIZEBOX;
cs.style &= ~WS_MINIMIZEBOX;
greets,
Fredrik Sigbjörn
|
|
|
|
|
Hello,
I want to write / find a program which dials to a given number wait till the anwering machine to answer, wait to the "beep" (online voice recognition) and play a recorded msg.
I'm searching for a week now for an already existing prog but all my searchings failed.
pls help me soon.
10x, tal.
|
|
|
|