|
Another option is you could use WM_COPYDATA to pass the data between the applications.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Thanks.
However, the app thats launched is not mine, so how will I know the output is ready and its finished? SOmehow the launching prog has to know that the data generating app is done, and then it passes the o/p to app number 2.........
Is there some MFC function that 1) launches an app and 2) waits until that app is done?
Thanks
ns
|
|
|
|
|
There's no MFC function, but there's the Win32 API CreateProcess :
STARTUPINFO si = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION pi;
if (!::CreateProcess(NULL, "your.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
AfxMessageBox("Error starting the process!");
return;
}
::WaitForSingleObject(pi.hProcess, INFINITE);
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
That was exactly what I needed!! Thanks a zillion!
Now I have to modify the prog to be launched so it can take commandline args, which I see can be put into createprocess arg#2.
Appreciate your helpful and speedy response,
ns
|
|
|
|
|
Hi,
In my MFc app i have created a ListBox dynamically and added items.Problem is when the user selected a Item in listBox ,getCurSel() always returns 0.This is in WinCE.
I am calling getCurSel() in PreTranslateMsg() routine.This works fine on desktop version..Pls help
Thnks
|
|
|
|
|
Just curious why you've created the listbox dynamically rather than at design time.
Don't use PreTranslateMessage() . Use a LBN_SELCHANGE handler instead.
|
|
|
|
|
I have dialog box in my application. I want disable esc key for dialog. I tried to override OnCancel function as follows.
CMyDialog :: OnCancel()
{
// OnCancel();
return;
}
But problem with above code is that cross button in corner
does not work. It does not close dialog box after pressing close button.
Can anyone suggest any other way to override OnCancel?
|
|
|
|
|
Perhaps could you try that (not tested)
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if((pMsg->message == WM_KEYDOWN ) && (pMsg->wParam == VK_ESCAPE)){
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
Try using PreTranslateMessage( ).
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
You can try to override the WM_CLOSE message and you might have something like this:
CMyDialog::OnClose()
{
PostQuitMessage( NULL );
or
DestroyWindow(...)
}
This might bypass OnCancel, but I am not very sure because I don't know if I have ever tried this before or not. Besides that, I am not in front of my workstation to verify function names and parameters etc, so consider this as pseudo-code.
|
|
|
|
|
Override OnCancel and OnClose
void CMyDialog::OnCancel()
{
}
void CMyDialog::OnClose()
{
CDialog::OnCancel()
}
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
In my application , I am taking emailid as user input. How should I validate Emailid for @?
|
|
|
|
|
Use Regular Expressions for validating email IDs.
function isValidEmail(emailAddress)
{
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(emailAddress);
}
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
what language is that?
|
|
|
|
|
That stuff was in javascript. But the regular expression library is available in almost all languages including C++ and java. So you canuse the same regular expression string in other languages as well.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi all,
I'm using CRecordset based classes to get data out of a database (an Excel file) - it works well and has done for a number of years, until now. If the database file name has a space at the end of it, before the '.xls' (eg 'my db file .xls') the columns in the tables can not be accessed (though the tables can!), but if the file doesn't have the space it works fine ('my db file.xls'). The problem only happens on WinXP too, it works fine on Win98 - which is making me wonder if this is a known problem with XP? I've not been able to find any information about it on the web / MSDN, has anybody else seen anything like this, or could any one suggest a way for me to get around this?
Dylan
|
|
|
|
|
I need get the entry Id propierty for an Exchange message. I need read this propierty in c++ (PR_ENTRYID) and in visual basic. The return values are different to the same message. Why?.
Visual basic return de correct value, but C++ return a shorter value. How can I return de same value in both cases?
Thanks in advance
Inma
|
|
|
|
|
Hello all,
I've the situation that I've to observe 60 sockets and process their data (small amounts of data). Those 60 sockets are:
- 30 data sockets receiving realtime data each 15-35ms per socket.
- 30 signalling sockets receiving data around (average) every 4 seconds per socket.
My question now is: what is the most efficient way of observing those sockets by select()-call followed by reading from the socket(s)? Due design it is prefered to have only 1 thread for observing, but 2 threads (one for data, and for signalling) is also acceptable. My point is that I've the feeling that doing a FD_SET-of-60-sockets and than select() followed by FD_ISSET per channel + reading and processing is not really going well.
With regards,
EiSl
|
|
|
|
|
One solution is an OVERLAPPED I/O model or the IOCP.
Kuphryn
|
|
|
|
|
Hi !
My application is showing two different docking windows. I have a class for the main window and another class for the docking window. I want to call a method of another class from either the menu of the main window, or the context menu from the docking window.
How should I do that : The mainwindow and the dockwindow call a method of the application object, which will call the method of the target object, of the mainwindow and the dockwindow both know the target object and call directly the method of this object ?
Thanks for your suggestions !
Jerome
|
|
|
|
|
Your question is incomprehensible.
First explain the scenario, and then the problem you are facing. may be you can add a few code snippets as well.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors"
|
|
|
|
|
Help !!
I want to rotate the display 90°, I wrote these few lines below but nothing happends running it under XP.
Anyone have any ideas ???
{
LPCTSTR lpszDeviceName = NULL; // name of display device
DEVMODE DevMode; // graphics mode
HWND hwnd = NULL; // not used; must be NULL
DWORD dwflags = 0; // graphics mode options
LPVOID lParam = NULL; // video parameters (or NULL)
DISPLAY_DEVICE DisplayDevice;
DisplayDevice.cb = sizeof(DISPLAY_DEVICE);
DWORD iDevNum = 0;
DWORD dwFlags = 0;
EnumDisplayDevices(NULL,iDevNum,&DisplayDevice, dwFlags);
DevMode.dmSize = sizeof(DEVMODE);
EnumDisplaySettings(DisplayDevice.DeviceName, ENUM_CURRENT_SETTINGS,
&DevMode);
dwFlags = 0;
DevMode.dmPelsHeight = 640;
DevMode.dmPelsWidth = 480;
DevMode.dmBitsPerPel = 16;
DevMode.dmDisplayOrientation = DMDO_90;
ChangeDisplaySettingsEx(DisplayDevice.DeviceName,&DevMode, hwnd, dwflags,
lParam);
}
|
|
|
|
|
Hi friends,
i am doing an mfc application i am having a tree ctrl.
Now the thing is i dont want the tree ctrl to collapse
how to do it any suggestion is welcome.
Thanx
TAKE CARE
|
|
|
|
|
Try this:
void CMyTreeCtrl::CollapseBranch(HTREEITEM hti)<br />
{<br />
if(ItemHasChildren(hti)){<br />
Expand(hti, TVE_COLLAPSE);<br />
hti = GetChildItem(hti);<br />
do <br />
CollapseBranch(hti);<br />
while((hti = GetNextSiblingItem(hti)) != NULL);<br />
}<br />
}<br />
<br />
void CMyTreeCtrl::CollapseAll()<br />
{<br />
HTREEITEM hti = GetRootItem();<br />
<br />
do{ <br />
CollapseBranch(hti);<br />
}while((hti = GetNextSiblingItem(hti)) != NULL);<br />
}
HTH,
K.
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
hi friend,
Hey this code is not working in following senario..
what i have done is i have mapped TVN_ITEMEXPANDING of the Tree ctrl in my Dialog box Class.
then i have assigned a variable to the treectrl named m_treectrl
i have written the code u have provided in the Dialog box class
and have inserted the m_treectrl var before the CTreectrl Class function u have used in the collapse function for eg
GetRootItem(); has been replaed by
m_TreeCtrl.GetRootItem();
and in the TVN_ITEMEXPANDING I have called the collapseall function but it doesnt work. can u suggest any help ??
waiting for ur reply...
Thanx
TAKE CARE
|
|
|
|