|
Thanks a lot, it works for me.
Stuart Dootson wrote: This uses C++/CLR rather than Managed C++, which is why I have System::String^ rather than System::String* (^ is a managed pointer in C++/CLR)
And for this explanation too.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi
I am able to open(display) a text file using the "system" command as follows.
if(strPgmName =="FCS")
{
system("fcs.txt");
}
But along with fcs text file,even cmd.exe also is also getting opened,I dont want the cmd.exe window to get opened,so what should I do.Can anyone pls give me a suggestion.
Regards,
|
|
|
|
|
The system command is a nasty thing. Use ShellExecute[^] instead.
::ShellExecute(NULL, _T("open"), _T("fcs.txt"), NULL, NULL, SW_SHOW);
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thank u so much..its working now.
|
|
|
|
|
Anyone knows where I can get the MFC Feature pack sample projects?
|
|
|
|
|
|
It's not there.
|
|
|
|
|
Stumbled upon the samples here
|
|
|
|
|
Hi,
I've created CCustomEdit inherited from CEdit and managed to change its background color and text color.
I'm trying to change the shape of it ( eg : on each end i plan to make it like curve a bit rather than 90 degrees )
Is there any ways to change the shape of the CEdit ? Any tutorials/sample would be highly appreciated. Can GDI able to change the style of it?
My project is MFC based.
With thanks,
KarHong
good
|
|
|
|
|
karhong wrote: Is there any ways to change the shape of the CEdit ?
Not only edit control, but the shape of any window can be changed by setting appropriate region. In your case, create a round rect region using the CreateRoundRectRgn() function and set that region to the edit control using the SetWindowRgn() function.
|
|
|
|
|
Thank you very much.. I'll get back to you later after i tried your method..
good
|
|
|
|
|
what place should i place the CreateRoundRectRgn() and SetWindowRgn() ?
I've try below code but it seems like the EditBox keep on blinking
CRect rcItem;
CDC* pDC=this->GetDC();
this->GetClientRect(&rcItem);
CRgn rgn;
rgn.CreateRoundRectRgn(rcItem.left, rcItem.top, rcItem.right, rcItem.bottom, 50, 50);
SetWindowRgn( (HRGN)rgn.Detach(), TRUE );
Thanks,
KarHong
good
|
|
|
|
|
karhong wrote: what place should i place the CreateRoundRectRgn() and SetWindowRgn() ?
The PreSubclassWindow() function is a good place.
karhong wrote: CDC* pDC=this->GetDC();
Why are you calling this function?
|
|
|
|
|
oh i'm using the pDC to draw the rectangle. That one I'm just testing out with the link given by Chandrasekharanp
I'm taking pDC out now and try your method.
But after i put below code, and execute it then the button went dissapear
void CCustomEdit::PreSubclassWindow()
{
CRect rcItem;
this->GetClientRect(&rcItem);
CRgn rgn;
rgn.CreateRoundRectRgn(rcItem.left, rcItem.top, rcItem.right, rcItem.bottom, 50, 50);
SetWindowRgn( (HRGN)rgn.Detach(), TRUE );
CEdit::PreSubclassWindow();
}
good
|
|
|
|
|
This may help you
http://www.codeproject.com/KB/edit/EditStyle.aspx
|
|
|
|
|
Hi, I've tested out but the shape of the box is still square.
Thanks for your reply
good
|
|
|
|
|
There are two classe of dialog windows:
class CMainDlg2 : public Cdialog // modal
CString m_sADDRESSHOM;
class CAdderDialog2 : public CDialog // MODELESS
#include "adderdlg2.h"
#include "modeldlg2.h"
There are in the code attached to command button OK set:
m_pModeless7 = new CAdderDialog2(this);
if (m_pModeless7->Create() == TRUE)
{
m_sADDRESSHOM = "London";
}
View the fragment of code modeless window:
BOOL CAdderDialog2::OnInitDialog()
{
CDialog::OnInitDialog();
CMainDlg2 dlg7;
MessageBox(L"dlg7.m_sADDRESSHOM=\n" + dlg7.m_sADDRESSHOM);
// display empty - the contents from constructor of modal
dialog window
}
How to receive "London" ?
|
|
|
|
|
Pass the pointer of the first dialog in the modeless one as you are doing by passing this. Write a get/set function in the modal dialog and declare variable that will be used in get/set functions. Create a pointer variable for the modal dialog in the modeless one and initialize it in the constructor of the modeless dialog since you pass the this pointer. This done, you can invoke the get/set function and set the value in the string to what ever you wish using the modal dialog pointer in the modeless dialog.
Alternatively, you can access the values using the dlg7 object as well.
Hope it is clear.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I've implemented a method in my app to paste a bitmap from the clipboard as an OLE object. I take the CF_DIB data, write it to a temporary file, and then use COleClientItem::CreateFromFile to create the object.
However, this is subject to the vagaries of file associations and installed applications. I'd like to be able to code something that says 'I want to insert an OLE bitmap object created with mspaint.exe' so that behaviour is more consistent from system to system.
Looking at some of the underlying ::OLE (eg OleCreate) functions, this seems like it might be possible, but I can't make it work. Does anyone with a better understanding of OLE have any tips? (or teh c0d3z? )
Cheers
|
|
|
|
|
Hi All,
How can we validate the edit box such that it accepts only one zero in the first place.
|
|
|
|
|
You should handle the WM_CHAR message in the edit control class and do necessary validation when the key pressed is zero.
|
|
|
|
|
See the EN_CHANGE notification. When the user enters the first character you can check whether it is a 0 or not. If not, you can clear the text in the edit window. So for every EN_CHANGE notification you can take the string from the edit window and check if char at 0th index is 0 or not.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi
I tried with EN_CHANGE notification onchange() is like below
CString Str;
char *Ch;
m_Edit1.GetWindowText(Str);
Ch=Str.LockBuffer();
if(*Ch=='0')
{
Str.UnlockBuffer();
m_Edit1.SetWindowText("0");
}
This is giving stack overflow error...
|
|
|
|
|
In EN_CHANGE:
CString str;
m_edit.GetWindowTextA (str);
if(str.GetAt(0)!='0')
{
}
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Thank u very much
|
|
|
|