|
hugPW wrote:
GetEditCtrl() ;
This should be:
CEdit &edit = GetEditCtrl(); hugPW wrote:
CEdit::GetWindowText() ;
This should be:
CString strText;
edit.GetWindowText(strText); There are other changes to make, but see how you can fare with these first.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Now we are really getting somewhere!
code looks like this
void CReverseView::OnReverse()
{
// TODO: Add your command handler code here
CEdit &edit = GetEditCtrl();
CString strText;
edit.GetWindowText(strText);
_strrev(strText);
edit.SetWindowText(strText);
GetDocument()->SetModifiedFlag(TRUE) ;
}
doesn't like _strrev, get this error. After that it should work!
error C2664: '_strrev' : cannot convert parameter 1 from 'class CString' to 'char *'
I was going to write my own bit of code but if the function exists I might as well use it.
Thank you I really appreciate this help.
|
|
|
|
|
hugPW wrote:
error C2664: '_strrev' : cannot convert parameter 1 from 'class CString' to 'char *'
The answer is in the error message. You need to figure out how to "convert" a CString object to a char * that _strrev() expects. Become very familiar with the CString class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thank you once again for all your help!
Kind Regards
Peter
|
|
|
|
|
Hi,
I have a Property Sheet Class with three pages.
My question is, how can I disable/enable the OK button based on the user input on
any of the pages?
I have a Property Sheet Class with three pages.
BOOL CPropSht::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CWnd *wnd=(CWnd*)GetDlgItem(IDOK);
wnd->EnableWindow(FALSE);
return bResult;
}
I have seen that OK button is disable.
I have added three pages page1,Page2 and Page3 in a property Sheet.
Now, suppose user changes something on any of the pages then in this situation OK
button should be enable.
I mean, OK button should behave like apply button.
Please provide me some idea.
Thanks!
rajesh
|
|
|
|
|
|
Hi,
I am trying to use cdhtmldialog to display a html page in the resource folder, it works fine untill I want to have more than one html file.
Do anyone know how to change to the other html file while having the original one displayed? Thanks a lot!!!
|
|
|
|
|
hi all,
I am using SQLConfigDataSource(HWND hwndParent,UINT fRequest, LPCSTR lpszDriver, LPCSTR lpszAttributes) Method to configure the ODBC datasource..
The Problem is I have used the above Method Like this:-
SQLConfigDataSource(NULL,ODBC_ADD_DSN, "SQL Server\0","DSN=myfinger\0" "Server=SERVER\0" "Database=emp\0");
This working perfectly and create the DSN..
Now I want to give the DSN ,server ,Database Name as variables..
But when I create create Like this This is not working..
CString var4,v1,v2,v3;
v1="myfinger";
v2="SERVER";
v3="emp";
var4.Format(" \"DSN=%s\0\" \"Server=%s\0\" \"Database=%s\0\" ",v1,v2,v3);
SQLConfigDataSource(NULL,ODBC_ADD_DSN, "SQL Server\0",var4);
But No error When compilling the Program..But Not creating the DSN..
So please any know the correct way to show this please send me a reply...
Thanks in advance..
|
|
|
|
|
There is no need to put the extra \0 characters in the string. CString::Format() does not like them. Looking at var4 after calling Format() would have confirmed this.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Also, when you have a variable number of arguments, which follow a formatting type string, the compiler does not necessaily know what to types to cast the arguments into, so you should probably always cast the CString manually in such a situation. I always do and boy have the wierdness factors decreased.
So, it would like something like this, following mine and David's suggestions:
var4.Format(" \"DSN=%s\" \"Server=%s\" \"Database=%s\" ",(LPCTSTR)v1, (LPCTSTR)v2, (LPCTSTR)v3);
|
|
|
|
|
hi ,
Sorry that is also not working..
Compilling the Project perfectly..But Not creating the DSN..
If I used the Method like this:
SQLConfigDataSource(NULL,ODBC_ADD_DSN, "SQL Server\0","DSN=myfinger\0" "Server=SERVER\0" "Database=emp\0");
This working perfectly and create the DSN..
This is working ...
But I want to pass the values for DSN,Server and Database/b>
please help...
|
|
|
|
|
SQLConfigDataSource -> lpszAttributes
List of attributes in the form "keyname=value". These strings are separated by null terminators with two consecutive null terminators at the end of the list.
Try this instead:
CString var4, v1, v2, v3;<br />
<br />
v1 = "myfinger";<br />
v2 = "SERVER";<br />
v3 = "emp";<br />
<br />
var4.Format("DSN=%s\0Server=%s\0Database=%s\0", (LPCTSTR)v1, (LPCTSTR)v2, (LPCTSTR)v3);<br />
<br />
SQLConfigDataSource(NULL, ODBC_ADD_DSN, "SQL Server", (LPCTSTR)var4);
I think this will work for you.
|
|
|
|
|
hi,
Thanks for ur reply..But it is also not working..You can also try to create DSN using above ur code:
void testDlg::OnButton2()
{
CString var4, v1, v2, v3;
v1 = "myfinger";
v2 = "SERVER";
v3 = "emp";
// this generates paramaters separated by a single NUL character
// and a sting terminated with two NUL characters
var4.Format("DSN=%s\0Server=%s\0Database=%s\0", (LPCTSTR)v1, (LPCTSTR)v2, (LPCTSTR)v3);
if(!SQLConfigDataSource(NULL, ODBC_ADD_DSN, "SQL Server\0", (LPCTSTR)var4))
AfxMessageBox("error");
}
But I got Error for this..
Thanks in advance..
|
|
|
|
|
I have created a separate thread to continuously monitor the serial port (i.e. to wait for something to arrive and then read it out)
Is it possible to write to the serial port at the same time (in the main thread), or does the read thread block. I have tried...it didn´t work, but the problem might be somewhere else...
If I cannot send while monitoring the port, what would be the proper solution? Do I have to temporarily Suspend, Sleep or Abort the thread while performing the write operation?
doneirik
|
|
|
|
|
IIRC you should use overlapped IO for the serial read write.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
it is not neccessary to write in a thread - thread is for waiting (reading) events.
before u write, u need to check if writing (sending) buffer is empty - otherwise writing fails.
i have worked for years on your current job.
includeh10
|
|
|
|
|
How can I change the background color of dialog form in a MFC application.
can anyone help me regarding this project ?
Philip
|
|
|
|
|
Write an event handler for WM_CTLCOLOR and change the color there.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
Here is Small Code that Will Help
HBRUSH CExeCreatorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor ==CTLCOLOR_EDIT)
{
return hbr;
}
::SetTextColor(pDC->GetSafeHdc(),DLGTEXTCOLOR);
::SetBkColor(pDC->GetSafeHdc(),PUNTO_BGCOLOR);
hbr=CreateSolidBrush(PUNTO_BGCOLOR);
return hbr;
}
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok, I am Butt not Bhatt . There is a very small difference in spelling but a lot of difference otherwise.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
Bro!
Please Don't Mind, there is Nothing Intentional.
Aamir Butt wrote:
there is a very small difference in spelling but a lot of difference otherwise.
Yeah I know the meaning of these two Surnames, I am sorry by heart, If it hurt you.
"I Think this Will Help"
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Its OK, no hard feelings
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
I have seen the code u sent to me through email. Normally its not a good idea to contact individual person coz if u ask question here, other people can get benefit of it as well.
Well, the problem in that code is that the place where u have checked
if(pWnd->GetDlgCtrlID() == IDD_BGCOLOR_DIALOG)
replace it simply with
if(pWnd == this)
Well, the reason is that you want to change the background color of dialog and GetDlgCtrlID returns the IDs of controls on the dialog not of dialog itself. You can check it simply by the if condition I have written above.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
dear all,
OS: Windows XP/2k
I am developing an application running with service. can anybody tell how to add desciption to the service
(i.e in control panel display -> service description)
rohit
|
|
|
|
|
use ChangeServiceConfig2()
eg:
SERVICE_DESCRIPTION sdBuff;<br />
sdBuff.lpDescription = _T("This description is shown by SCM.");<br />
ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &sdBuff);<br />
suhredayan There is no spoon.
|
|
|
|