|
Yes..i saw MSDN..i tried connecting the device to the port and then initializing..it didn't work..
|
|
|
|
|
ERROR_PORT_ALREADY_OPEN is the error
|
|
|
|
|
This is probably a known problem with an easy workaround, but I haven`t seen it yet.
The problem is that I want to use code written in Visual C++ 6.0 in Visual Studio 2005. When I compile I get the following errors e.g.:
CString temp = pOrder->GetItemNr();<br />
pOrder->GetItemNr() returns a const char*
the error I got is:
error C2440: 'initializing' : cannot convert from 'const char *' to 'ATL::CStringT<basetype,stringtraits>'
What can I do so that this assignment works again? Anyone got any ideas?
Thanks for any help,
Davy
|
|
|
|
|
GDavy wrote: CString temp = pOrder->GetItemNr();
Modify this to,
CString temp = CString(pOrder->GetItemNr());
Prasad
MS MVP - VC++
|
|
|
|
|
Isn`t there a better way?
In my old code I have a lot of places where a const char* is assigned into a CString sometimes directly sometimes as a parameter in a function. It`s a lot of places to do this.
Anyway thanks for your answer, I was affraid this might be the only solution...
|
|
|
|
|
What's the difference ? Both will call the same CString constructor so I don't see why it would work...
|
|
|
|
|
That's what I thought too originally, but doing this does make it work (compiler error is gone)
So I guess I`ll just have to do this for all the cases in my old code .
Just came back from easter hollidays and now this mind-numbing job of putting CString () whereever the compiler complains... I need hollidays again
|
|
|
|
|
Cedric Moonen wrote: Both will call the same CString constructor
I thought that way initially. But, some how it is converting char* to wchar_t* in this case.
Cedric Moonen wrote: I don't see why it would work...
And it is working.
Prasad
MS MVP - VC++
|
|
|
|
|
I certainly use this construct regularly in VS2005 and it works OK for me. What I have just checked is:
<br />
const char lpszFiles[] = "FileInfo"; <br />
<br />
CString str = lpszFiles;<br />
essentially the same.
You haven't got unicode defined have you?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
I have actually.
It`s necessary because sometimes more than 1 language needs to be displayed.
In VC 6.0 the conversion from const char* to WCHAR* used by CString happened automatically, this doesn`t seem to be the case anymore
|
|
|
|
|
hi all i have to import some files to regedit. how to do this in mfc. please help me. i am new to this concept
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: i have to import some files to regedit
I don't get you. Do you need to write values into the registry?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
i have to install a package, for this i have to add some files in regedit.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
If you are using an installer, look in its help for setting up registry values. If you are writing your own installer then you will have to write to the registry. There may be something about .reg files that can help you, but I have never used them for this.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
deeps_cute wrote: for this i have to add some files in regedit.
What do you mean when you tell that you need to add some files in regedit?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
I have two dialogs.In first Dialog i have a one button.When i click that button the next dialog will appear .After that i have pressed the Escape key the both dialog is closed.I want to close only the child dialog.
How to do this.plz help me?
|
|
|
|
|
I have two questions:1: r ur dialog boxes modal? 2: how long time did u keep pressing on the ESC key?
life is like a box of chocolate,you never know what you r going to get.
|
|
|
|
|
how to find model and modeless dialog
|
|
|
|
|
how to find model and modeless dialog
:rose:
|
|
|
|
|
prathuraj wrote: how to find model and modeless dialog
If you used DoModel() API, for the child dialog to show it, then the child dialog is model.Instead if you used other API to show the dialog,say, ShowWindow(..),then its modeless
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
|
By default, the escape key triggers the OnCancel() event of a modal dialog. You must override the OnCancel function in your dialog class. Example from MSDN:
void MyDialog::OnCancel()
{
if ( AfxMessageBox("Are you sure you want to abort the changes?",
MB_YESNO) == IDNO )
return;
CDialog::OnCancel();
}
|
|
|
|
|
OnCancel is not only called by hitting ESC key, also called by closing dialog box, for settling this, I think u may overwrite CDialog::PreTranslateMessage funcion like this.
BOOL CdlgtestDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->hwnd == m_hWnd || ::IsChild(m_hWnd,pMsg->hwnd) && (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP))
{
if(pMsg->wParam == VK_ESCAPE)
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
life is like a box of chocolate,you never know what you r going to get.
|
|
|
|
|
I have created a file which stores the employee details.
now I am trying to ovrwrite the employee details based on the input EmployeeId
given by the user using
ofstream obj(filename::ios::out);
obj<
|
|
|
|
|
if the variable empName is of fixed length or upto the length that
u have to created intialise the variable value to zero of
its allocated length,
char empName[15];
//lenempName =15 or what ever its size
memset(empName, 0, sizeof (char )* lenempName );
hope it will help u.
|
|
|
|