|
Hi !
I upgraded my VC++ to 2003 cause the compiler now supports partial template specialization. But i now have the following problem:
Suppose the following code:
--- snip ---
class Test: public std::ostringstream {
public:
Test(const std::string& str);
};
Test::Test(const std::string& str)
: std::ostringstream()
{
*this << str;
}
---- snip ---
This does not compile (error C2679) cause the compiler could'nt find a matching binary operator. What the hell is going on here ? This code compiles on every other compiler i've used (gcc 2, gcc 3, VC6, VC7). Is the compiler buggier than before or am i missing something ?
Many thanks in advance,
Christian Prochnow
|
|
|
|
|
I'm just looking for an easy approach to build a dde server to provide changing data retrieved from internet ressources to other apps (e.g. Excel). Are there any good examples using the MS ddeml library
Alternatively an easy to use ActiveX-control wrapping this stuff would be great appreciated
Thanks for your help.
Mathefreak
|
|
|
|
|
If you want to make Excel a DDE Server
you can try something like this:
DDE Service : EXCEL
DDE Topic : Book1:Sheet1
DDE Item : R2C2 ( refers to Row2, Column2 )
or if you want to create DDE server,
see the SDK DDEML sample "Server Sample: DDE Server" in MSDN.
"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 a beginner. I tried using CToolTipCtrl as given in MSDN but tooltip display is not happening.This is what I've done.
CToolTipCtrl m_ToolTip;
m_ToolTip.Create(this, TTS_ALWAYSTIP);
m_pToolTip.AddTool(...)
m_ToolTip.SetToolInfo(&ToolInfo);
and in PreTranslateMsg
m_ToolTip.RelayEvent(pMsg);
Create and Addtool does not return failure msg and it does not throw any error but still there is no display. Can anyone pls help me out
with this?
meenu
|
|
|
|
|
Creating and displaying tooltips is really a hard job.
Anyway try this link:
http://www.codeproject.com/miscctrl/tooltipex.asp
"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,
Thanx a lot for ur response. But as I told u, I tried it out as mentioned in the link only...But still, There is no tooltip display. Can u figure out what could be the problem.
With thanx,
Meena
|
|
|
|
|
Is it a dialog/view based app ??
Can u give little bit more insight into the scenario ??
"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."
|
|
|
|
|
dear all,
how can i terminate my dlg based mfc app gracefully from a 1) cdialog based class and 2) from the main application class
currently i'm using
AfxGetMainWnd()->DestroyWindow() in both the cases.........is this approach neat?
thnx
rIsHaBh
|
|
|
|
|
1. Call CDialog::OnOK() / CDialog::OnCancel() depending on the return value needed.
2. If you are using DoModal() method to show the dialog, then your main thread is already blocked, so it is just not possible to dismiss the dialog from main thread. If you ar using Create / ShowWindow( ... ) to show the dialog, then you can use DestroyWindow() on the dialog reference.
"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."
|
|
|
|
|
"If you are using DoModal() method to show the dialog, then your main thread is already blocked, so it is just not possible to dismiss the dialog from main thread."
but in this case how do i terminate my application...not just the dialog
rIsHaBh
|
|
|
|
|
You have to first close your dialog using OnCancel()/OnOK(). Then you can terminate your application from your main class.
void MyClass::OnSomeAction()
{
CMyDlg dlg;
dlg.DoModal();
//The thread is blocked at this point, and will resume only if the dialog is dismissed
//Terminate the application here.
}
"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."
|
|
|
|
|
dear all
can a single CDialog based class be associated with 2 dialog resources....
if yes how
regards
rIsHaBh
|
|
|
|
|
|
It can be done like this:
pDialog = new CMyDialog();
//Check if new succeeded and we got a valid pointer to a dialog object
if(pDialog != NULL)
{
BOOL ret = pDialog->Create(IDD_MYDIALOG,this);
//Change IDD_MYDIALOG with another resource ID
if(!ret) //Create failed.
AfxMessageBox("Error creating Dialog");
pDialog->ShowWindow(SW_SHOW);
}
"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."
|
|
|
|
|
Dear all
CString aStr="Learning 中文"; //a mixed English and Chinese string
Without using Unicode, How can i extract the Chinese Character word by word from a Mixed English and Chinese string?
Thanks
|
|
|
|
|
To find the double-byte characters, step through one char at a time and call IsDBCSLeadByte() on each one. When that function returns true, that char and the following one make up one double-byte character.
|
|
|
|
|
Thank you.
can you tell me how to make a one double-bye character?
|
|
|
|
|
|
finite state machine...
recognize the pattern 10110 in the user inputted string..
also handle overlapping if any...like hav to check for aal possible occurrences of this pattern...this pattern 10110 is hardcoded...
Avoid using if else...
use function pointer...
so any one who can help and give me the code for this in C++ i be grateful 2 u...
|
|
|
|
|
|
This looked like a fun little project to create, so I took about 15 minutes of my time to write this. I'm not going to post the code (which was 29 lines from start to finish, including the #include statements.) I'm not sure if my approach is what you are looking for, but I set aside 5 variables (I made an array to hold these) of type unsigned short. Then I just wrote a for loop which looked at each character of the input string and added it to each variable (you have to reset one of the variables back to zero each pass through the loop, just use the mod operator.) At the end of my for loop I looked at my variable that I'm going to reset the next time through my loop (it should contain 5 characters by now) and if the bit pattern in this variable is the same as the bit pattern you are looking for, then it outputs the place in the string where this pattern came from. That's it!
Give this a try for a while and if it's killing you then post a reply to my message and I'll post you the code (I don't mind helping people with homework.) I wanted you to try it first since I gave you some ideas on how to approach this. Hopefully I wasn't too vague but I don't want to give away the entire solution right away!
Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
Hi! I have been assigned to design a database program that is capable of reading a barcode via a barcode device. The problem is, I have never done anything involving serial ports. Are there any good tutorials about serial ports or could you point me in the right direction by listing a few of the functions involved?
-- Steve
|
|
|
|
|
To open a COM port, you can use the CreatFile( ... )
To access COM port properties, use GetCommProperties(...)
To write to a COM port, use WriteFile(...)
see this link:
http://www.control.com/966781257/index_html
"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."
|
|
|
|
|
I have the following code:
<br />
void* fixaddr;<br />
DWORD delta<br />
.<br />
.<br />
.<br />
<br />
*((WORD *)fixaddr) += HIWORD(delta);<br />
.<br />
.<br />
.<br />
During compilation I get the following error:
warning C4244: '+=' : conversion from 'int' to 'unsigned short', possible loss of data
Since I don't want any warnings appear in my code I wonder how to fix this ?
|
|
|
|
|
You could turn down the warning level
|
|
|
|