|
CodingLover wrote: Can someone tell me how to convert BOOL in to System::String* __gc
I'm not sure I would ever ask such question, anyway, if I should, then I would ask it in the managed C++/CLI forum [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'll join in the chorus of "wrong forum!".
But before you ask the question there, think about it yourself.
You have two things:
1/ A BOOL. This is a thing which has two states, true or false. 1 or 0. Orange or green. I use BOOL to represent whether something is on or off. So, it could also mean "Give Iain Money" / "Give Iain Kisses".
2/ System::String * is some weird thing from another language. But it sounds a lot like a string. (I know, I'm a genius with psychic powers). So, it would be some sort of text representation.
So, you need to understand what that BOOL represents before you can turn it into text.
Start this conversation:
CodingLover's Mum: "Darling, what does this mean when it's on?"
CodingLover: "Ah, it means __________________________"
CodingLover's Mum: "Darling, what does this mean when it's off?"
CodingLover: "Ah, it means __________________________"
But you're not done... Try this conversation also:
CodingLover's Swedish Girlfriend: "Älskling, vad innebär det när den är på gång?"
CodingLover: "Ah, it means __________________________"
CodingLover's Swedish Girlfriend: "Älskling, vad innebär det när den är avstängd?"
CodingLover: "Ah, it means __________________________"
Text is a pain - for some reason, people all over the world like to use their own language, instead of God's Good English!
Iain.
ps, Power of google, my Svensk is far from good enough yet...
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thanks for the comment. I'm not an experienced person in C/C++, and that's why I ask a question here, after different things workout.
Anyway, I'll try my best next time what you are saying in the above post.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Well, the answer to your question isn't really a "how do I write this code" answer, it's a "what does this mean / how do I represent it to the user" question, and that will be the same whether you write in VB, FORTRAN, C, ruby, etc.
In my miniscule experience, the hard questions are not coding ones, they are deciding what to code...
Good luck,
Iain
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
|
If you want to get a string value representing the BOOL, then this function ought to do you:
System::String^ GetStringFromBOOL(BOOL b)
{
return Boolean(b!=FALSE).ToString();
}
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).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
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
|
|
|
|