|
That really takes care of a lot of potential problems I am having when I talk MFC to a dll thats working with char* only. My sincere thanks.
ns
|
|
|
|
|
I totally forget how to print the line hello "world" with the quote..
I tried cout<<"hello\"world"\";
another question.. How can i also set
CString str = "hello\"+" world"\"; cout<< str;
so when you print.. hello "world" will print... I want quote to be printed too.
|
|
|
|
|
You need not the +.
Do like this:
CString str = "hello \" world\"";
Best regards,
Alexandru Savescu
|
|
|
|
|
no... i really want to know the way of
<br />
CString str, word;<br />
word = "world!!!";
str = "hello \"\" + word + "\"\";<br />
I tried that way.. but it didn't work.. CString word; could be any string..
may be
hello "BJ"
hello "Sam"
hello "Mike"
|
|
|
|
|
Well, if you cout << str and str is a CString it will not work as it will output it's address (I think)
You should cout << (LPCTSTR)str; to get it work.
Best regards,
Alexandru Savescu
|
|
|
|
|
ok.. I'm trying to unzip the file with WinZip using system()
<br />
system("wzunzip -d \"c:\\test.zip\" c:\\temp\\); // unzipping the file, test.zip, with WinZip from command prompt.<br />
it works but "c:\\test.zip" can be any file name.. there fore i have to create
<br />
CString commandLine = "wzunzip -d \"\" + fileName +" \"\" + "c:\\temp\\"; <br />
system(commandLine); <br />
|
|
|
|
|
CString str, word;
word = "world!!!";
str = "hello \"" + word + "\"";
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello all,
I am here to pester you guys with more project and code questions.
So here is the current one that maybe you guys can explain to me.
Let's say I do not want my MDI Child window to close when you press the 'X' button in the top right. So, I figured to do this, I would edit OnCloseDocument, and ahve it do...you guessed it....absolutely nothing. I comment out the CDocument::OnCloseDocument(); statement.
Voila, the 'X' button no longer works. So I was kinda right. Here's the fun part. I press the 'X', the project doesn't close, like I figure. BUT, I press exit, to exit everything, and in the Taskmanager, the project is still there.
I think this is bad.
What do you guys think? Anyideas on how to render the 'X' button ineffectual?
Thanks,
NickOne
|
|
|
|
|
Can't you just handle (and do nothing in the handler) WM_CLOSE in mdi child frame class?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Arghh....
You are right if this was a regular MDI program!!!! I did it on a different MDI program and it held up.
The one I am working on right now though doesn't have a Child MDI class. So I can't access WM_CLOSE because there is no class for it. I CAN get to WM_CLOSE in the Mainframe.cpp file, but I don't think that will do me much good.
Thanks though! I appreciate it!
Any more ideas maybe?
NickOne
~Always listening~
|
|
|
|
|
NickOne wrote:
The one I am working on right now though doesn't have a Child MDI class
What do you mean exactly? You're using CMDIChildWnd or MDI child windows are created by code you can't control?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
MDI Child Windows are created by code I can't control.
It'd be cool if maybe I could make my own MDI child windows though, then I could definately control what happens.
But what I am working on right now doesn't have a CChildFrame class or CPP file. I guess the Resource editor does the creating a new MDI window for me.
Is that any clearer? I hope so, if not let me know
NickOne
|
|
|
|
|
Check CYourApp::InitInstance. You should see at least one call to AddDocTemplate. What's the 3rd parameter?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Eeeessshh....
Ok your gonna hate me for this.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_MYDOCTYPE,
RUNTIME_CLASS(CCoMagTestDoc),
RUNTIME_CLASS(CMDIChildWnd),
RUNTIME_CLASS(CCoMagTestView));
AddDocTemplate(pDocTemplate);
This is the a DocTemplate that I added so I could turn my lowly SDI program into an MDI program with a preprocessor definition _MDI. This way it's my choice to make it SDI ro MDI. That obviously is why I don't have a ChildFrame class like the way NORMAL MDI programs do.
So you think maybe I should add a new class entirely?
Thanks,
NickOne
|
|
|
|
|
CMDIChildWnd is an MFC class. You should derive new class from CMDIChildWnd and customize its behavior (by adding WM_CLOSE handler, for example). Then, replace RUNTIME_CLASS(CMDIChildWnd) with RUNTIME_CLASS(CYourMDIChildWnd).
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Sweeeeeeeeeeeeet!!!
Ok this I can definately do. But just to be sure I am going to do this:
1) Add a new class on the File View. Then create a new MFC class that has a base class of CMDIChildWnd.
2) Add all the fun stuff I want to it, since now I will be able to do see the options like WM_CLOSE.
3) Switch the RUNTIME statements the way you said.
Thanks a whole bunch, you have been really helpful!
NickOne
~Yeah! We gon' rock it 'til the wheels fall off~
|
|
|
|
|
NickOne wrote:
1) Add a new class on the File View.
I'm not sure what do you mean by this. In VC6 there's 'New class...' option under 'Insert' menu. There should be some equivalent functionality in VC.NET.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Dear Sir,
I would like to request your help and guidance in the following matter. I have seen one interesting thing while I was trying to delete a file on my 100MB Iomega Zip drive. Instead of regular windows message box saying "Are you sure you want to send "xyz.doc" file to Recycle Bin", it shows Iomega's own message. This gave one good idea . If we can add this behavior to the file operations like open ,delete,move, then we can show our dialog boxes which may contain some password mechanism which user tries to open a file. Of course , password protected document ".doc" files have the facility, but if we can extend this facility to some our important files. Isn't it?. Does shell function like SHFileoperation() come to rescue?.
Kindly let me know if you have any idea.
regards,
T.S.V.R.NAGESWARA RAO,
teli_sha2002@yahoo.co.in
Hydearabad, India
|
|
|
|
|
I can't be certain, but I'm pretty sure that the message box you got was built into the driver software for the zip drive, meaning if you wanted to do similar things on normal drives, you'd have to do it at the driver level.
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Have anybody try to instantiate array of MFC controls? Can u let me know how you do handle the messages to appropiate control ( like passing index of the control). I have tried in Visual Basic before and easily been done. But I have never try to use in Visual C++ and I don't know how. Thx a lot!
NB : The most confusing thing for me is the messaging
|
|
|
|
|
I'm working a lot with arrays of Ctrls:
lets say you have a Ctrl "CHoverButton", then I use the following lines:
CHoverButton *hover[20];
for(...)
hover[i] = new CHoverButton;
hover[i].Create(....,PREDEFINED_ID+i)
with PREDEFINED ID I mean you define some ID's in advance for the Buttons you'll create.
in the class CHoverButton add Handler for WM_LEFTBUTTONUP.
then you add to this handler a
GetParent->SendMessage(WM_YOURCUSTOMMESSAGE,MAKEWPARAM(GetDlgCtrlID(),0),0);
and in the dialog where your controls is positioned a handler for WM_YOURCUSTOMMESSAGE. WM_YOURCUSTOMMESSAGE is just a new Resource-Symbol you have created.
Then add a handler for WM_YOURCUSTOMMESSAGE in your dialog by putting the following lines:
ON_MESSAGE(WM_YOURCUSTOMMESSAGE,Handlecustom(WPARAM w, LPARAM l) (Message Map!)
in the .h file:
afxmsg void Handlecustom(WPARAM w, LPARAM l)
and in the .cpp file:
void DlgClass::Handlecustom(WPARAM w,LPARAM l)
{
switch(w)
case ID_BUTTON1: do something
} and so on
you can also send something else to the parent window - I use the DlgCtrlId because it's then easy to modify the control by using
GetDlgItem(ID)->dosomething()
hope this helps you
silver
I don't want achieve immortality through my work - I want achieve it through not dying - Woody Allen
|
|
|
|
|
You may have a look at ON_CONTROL_RANGE and ON_COMMAND_RANGE macros.
Best regards,
Alexandru Savescu
|
|
|
|
|
can i use both modeless and modal dialogs in a dialog based appication in VC++?
kalyan
|
|
|
|
|
yes, of course. there is nothing about an application type that determines the kinds of dialogs you can use.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Where can I get help html creation program at?
|
|
|
|