|
OK: It does not sound very complicated...
First, draw your dialog and create a class associated to it, let´s name it CKeypadDlg. If you are already lost, mail back
Add a member
int * m_Response
Then overload the DoModal function like this :
int CKeypadDlg::DoModal(int *response)
{
m_Response=response;
return CDialog::DoModal()
}
declare a CString in your KeypadDLg:
CString m_Result
On your second dialog box, you should have a control associated to your CEditBox (let´s name it m_EditCtrl).
When the user clicks on button 1 for instance you will have to catch it in a OnButton... function - Double Click on the Button in the Dialog, and you´ll get :
void CKeypadDlg::OnButton1()
{
m_Result+="1";
m_EditCtrl.SetWindowText((LPCTSTR)(LPTSTR)(m_Result))
}
Same code for all button ...
To get the current result at any moment
int Result_i=_atoi(m_Result);
Finally, override OnOk() with
void CKeypadDlg::OnOK()
{
*m_Response=_atoi(m_Result);
CDialog::OnOK();
}
Oufff ...
use it ike this :
CKeypadDlg myDlg
int final_result=0;
myDlg.DoModal(final_result);
Hope this helps ...
~RaGE();
|
|
|
|
|
Not sure how to use it, it always returns "The parameter is incorrect." when the return value is interpreted with the Error Lookup.
Thanks!
|
|
|
|
|
Hi all,
Any programmer here who has experience with using DSP boards? As I'm not a hardware guy I'm looking for something coder-friendly. Any suggestions would be welcome
|
|
|
|
|
I used a DSP56001 board many years ago. (Like when the 186 was the top dog). It was good and easy to use at that time, considering I hadn't done my programming degree at that time. (that makes it 12 years ago )
Sorry if I can't be more help.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
10x Roger.
Any idea anyone where I can get benchmarks/performance figures. Ideally I'd like to know whether the bang/buck of a DSP compared to a 2Ghz AMD is better, etc and any pitfalls. I couldn't find any perf data on the Texas Instruments site.
|
|
|
|
|
I have am writting an MDI Doc/View app and have a situation where I would like to be able to close a view (there is only one view and it is derived from CScrollView) and leave the document open...then, sometime later, create a new view and attach it to the still open document.
How do I do this?
|
|
|
|
|
To avoid deeper hacking, I'd create a 'dummy' frame/view and hide it. So technically a view would exist - but user would be unaware about that.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks for replying...I thought about that, but there can be many documents/views being opened and closed and if they are not really closed (only inactive), the inactive views continue to receive OnUpdate messages. I am worried about a possible performance hit...It seems that it would be cleaner to close the view, but leave the document open.
|
|
|
|
|
Gary Kirkham wrote:
I am worried about a possible performance hit...
Well, the dummy view would be just a class derived from CView which ignores OnUpdate calls.
You may also try to dabble with undocumented CDocument::m_bAutoDelete. Probably if you set it to FALSE closing last view will not destroy document. I've never played this trick personally, however.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Never mind I figured it out...you gave me part of the answer (m_bAutoDelete)
Thanks
|
|
|
|
|
At the begining of Application SDI, I want a Empty Document but when I write this code :
// no empty document window on startup
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) {
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
}
on App::InitInstance(), it doesn't work ...
Please Help me !
|
|
|
|
|
|
Hey all,
I have a shared resource in my application. I want to allow all running threads to READ from that resource simultaneously, but want them all to block when the resource is being WRITTEN to.
I know there's a standard technique to do that, but I can't remember it, and I have no idea what keywords I should use in the search engines (I do recall that this problem has a formal name).
Thanks!
|
|
|
|
|
MRSW lock (Multi-reader, single writer). You can find a decent implementation at http://www.quality.nu/dotnetguy/2001/21/10.aspx.
|
|
|
|
|
Hello,
I am trying to read a binary file written on a big endian machine(SGI) and read it on my little endian(PC). Does anyone have code or any thoughts on how to do the byte conversion? I would appreciate and help I can get. Thank you for your time.
Josh
|
|
|
|
|
I think you should be able to use ntoh* functions to do the switch, since network order is big endian.
|
|
|
|
|
This should work:
template <typename T> T change_endian(T in)
{
T out;
char *pin=reinterpret_cast<char *>(&in);
char *pout=reinterpret_cast<char *>(&out)+sizeof(T);
for(size_t n=0;n<sizeof(T);++n)*--pout=*pin++;
return out;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, I am using a OCX component, this component return to me a SAFEARRAY Pointer, I am sending this array using a CAsyncSocket component .. like this:
SAFEARRAY **psa;
psa = Data->pparray;
m_UDPSocket.Send((*psa)->pvData, (*psa)-rgsabound[0].cElements);
And I get in the other side like this:
int hr;
SAFEARRAY psa;
BYTE pdata[MAX_BUFFER];
psa.pvData = pdata;
psa.cDims = 1;
psa.cbElements = 1;
psa.cLocks = 1;
psa.fFeatures = FADF_FIXEDSIZE | FADF_AUTO | FADF_EMBEDDED | FADF_STATIC
psa.rgsabound[0].lLbound = 0;
psa.rgsabound[0].cElements = hr;
it´s work well ... but I need to send 2 bits together, I need to represent the number 1 (01), or 2 (10), or 3(00), I want to represent what kind of data I am sending using the Socket. How can I link the array with this 2 bits ?
Thanks a lot
|
|
|
|
|
For mapping software, tiff files can contain positioning information, such as coordinates of the lower left corner, width and height in meters, ... Sometimes this
information is included in a header in the tiff file itself, sometimes it is contained in a separate .tfw file. Has someone some clues for getting this information ?
JPG
|
|
|
|
|
do a google search for LibGeoTiff
-c
Cheap oil. It's worth it!
|
|
|
|
|
A simple question.
Say you have.
iterator itBegin = whatever.begin();
iterator itEnd = whatever.end();
and you after that adds more stuff to 'whatever'
will 'itEnd' point to the real end or will it point
to what was the end when you got it?
/Magnus
|
|
|
|
|
in general, any operation that changes the size of a container will invalidate all iterators. you will have to call whatever.end() after changing the container, if you want to know where the end is.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Depends. On some containers, like vector , any iterator becomes invalid (or is not guaranteed to remain valid) after adding/removing data. For list s, on the other hand, iterators remain valid (unless you erase the very object the iterator is pointing to, of course.) Check the docs for more info on each particular container, this kind of things are thouroughly specified.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
In this case i was using a map and i was thinking about doing something like this
iterator itBegin=map.begin();
iterator itEnd=map.end()
for(it=itBegin;it!=itEnd;++it)
{
AddToMap();
}
to add to the map but not loop trough the new added items.
Joaquín M López Muñoz wrote:
Check the docs for more info on each particular container
That is the one thing i hate about STL, the docs are completely useless.
/Magnus
|
|
|
|
|
I believe that this won't work. For the following reason: most implementations of map store items in sorted order so adding items
to the map will probably be between begin and end. Unless you are adding things that are bigger than what is in the map.
John
|
|
|
|