|
Also, if you're going to copy 4 characters to your Mycut array, you need to make
its dimension 5 to have room for the null terminator.
char Mycut[5];
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
msogun wrote: char str[80000];
[...]
Mycut = str.substr(0,4); /// Error here
str is defined as a pointer to an array of 8000 chars, allocated on the stack.
Now, you call the member function substr on that pointer.
But pointers do not have member functions to call. Hence the compiler tells you that in order to call a member function, left of it must be a class/struct/union. Not a pointer.
Clearer now?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Adam,
How do you think the code should be. Sample please.
|
|
|
|
|
When I change my application from UNICODE to MultiByte support the look of my UI changes. Understandable, but is there a way to get the XP (VS 2005) look and feel while still supporting MultiByte character set?
Thanks.
|
|
|
|
|
masnu wrote: is there a way to get the XP (VS 2005) look and feel while still supporting MultiByte character set?
Try adding the following line to the bottom of your stdafx.h file...
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
...and rebuild.
masnu wrote: When I change my application from UNICODE to MultiByte support the look of my UI changes. Understandable
How is that understandable? Why would the character set used by the code have an effect on the UI?
Internally, Windows APIs use all Unicode - has been that way for a long time.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Look at the bottom of your stdafx.h file... you'll find a group of #pragma statements surrounded by
#ifdef _UNICODE
...
...
...
#endif
Remove the line with the #ifdef _UNICODE and the corresponding #endif.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I have a rookie question for you guys. I need to write a GUI based application (not too complex) for a windows platform that cannot have the .NET framework installed. The .NET Framework is absolutely out of the question.
I've attempted to create a Windows Form application for C++ under Visual Studio 05, but when I compile it runs on my machine but not the remote machine. All it is is a blank form, so it's not a code bug.
How should I go about creating a Form based GUI app for my circumstances?
Thanks...
|
|
|
|
|
MFC?
Silence is the voice of complicity.
Strange women lying in ponds distributing swords is no basis for a system of government. -- monty python
Might I suggest that the universe was always the size of the cosmos. It is just that at one point the cosmos was the size of a marble. -- Colin Angus Mackay
|
|
|
|
|
(now my ignorance will become evident)
I've just created an MFC solution in VS05, but wasn't sure what to choose for the project settings so I used the defaults. I'm not seeing how to interact with the main form. Can I use the graphical form designer with this type of project?
|
|
|
|
|
yes
Silence is the voice of complicity.
Strange women lying in ponds distributing swords is no basis for a system of government. -- monty python
Might I suggest that the universe was always the size of the cosmos. It is just that at one point the cosmos was the size of a marble. -- Colin Angus Mackay
|
|
|
|
|
Could you elaborate on how to do so? When I try to add a form, it wants to add support for CLR, which means .NET framework, if I'm not mistaken..
|
|
|
|
|
Ah! It's called a dialog here. I've added a Dialog and can design willy nilly. Sweet.
|
|
|
|
|
You have two options with MFC. You can create a dialog based application or a SDI/MDI application using CFormView.
A dialog based application generally does not have a menu or toolbar. What you get is a dialog box (WinForm in the .Net world), that you can drag and drop your controls into and then write the code behind it to do what you want.
If you want menus and toolbar, then I would go with either an MDI or SDI application. This is more like windows notepad and Visual Studio. Visual Studio is an MDI (multi-document application) and SDI is like notepade (single document interface).
When creating a SDI/MDI applicaiton, the last page of the application wizard lets you choose what type of view you want. If you want to be able to display some control, like buttons, lables, edit control...., you would want to change the view class from CView to CFormView.
Let me also add that jumping into something like this without doing some homework could turnout to be somewhat overwhelming.
Good luck,
AliR.
Visual C++ MVP
|
|
|
|
|
Overwhelming indeed. I've decided to forget the GUI for now until I get my C++ logic and syntax down. So far I've successfully made a custom class that performs a WMI query to some info I need. I'm now working on figuring out some datatyping issues I'm running into that I never ran into in C#.
Thanks for the advice, I'll certainly put it to use when I get to adding a GUI.
|
|
|
|
|
alanteigne wrote: How should I go about creating a Form based GUI app for my circumstances?
You can't.
Its that simple. Forms are .NET. Period.
To create an unmanaged GUI, you need a different Framework than Windows Forms.
MFC was mentioned, WTL is also an option.
Also, you could try using other frameworks:
wxWidgets[^]
Qt[^]
come to mind.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
As others said MFC, QT, etc are common... if your application is really trivial (maybe one dialog and a few interactive controls) you can also do plain Win32. The advantage is that you don't have to learn a whole framework like MFC and get really slim code... search for "win32 tutorial".
Hope it helps.
|
|
|
|
|
Hello all. I have this application that was built with VC6. Now I am migrating it to VC8, and as it compiled perfectly, it is not running. It is a dialog-based app, but when I call CDialog's DoModal, it fails miserably (returns -1) without even calling OnInitDialog.
Now, I already checked for the resources and they all seem to be alright. Any reason why it is failing, any clue?
Thanks in advance.
[EDIT]
So I finally managed to set up the (remote) debug environment. It is failing while calling CreateDlgIndirect .
I'm calling GetLastError and it is returning error 1408, whose translation would be something like: "invalid window, it belongs to another subprocess". What the...?
[/EDIT]
Regards,
FG.
Stupidity is an International Association - Enrique Jardiel Poncela
modified on Thursday, February 21, 2008 5:15 PM
|
|
|
|
|
Fernando A. Gomez F. wrote: ...it fails miserably
Which means what?
Fernando A. Gomez F. wrote: ...without even calling OnInitDialog
How are you verifying this?
Does it work if you add the DS_NOFAILCREATE style to the dialog template?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Nope, it is still failing...
Stupidity is an International Association - Enrique Jardiel Poncela
|
|
|
|
|
And what about the debugger?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What about stepping into DoModal() in the debugger to see why it's failing?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hehe, yes, I'm trying that, but I don't have yet the environment setup in my machine (the app needs several components to work) thus I could only debug it in a remote way; still, at the time, I don't have access to the server and I can update the program only with a ridiculous tool which uploads it via FTP...
Stupidity is an International Association - Enrique Jardiel Poncela
|
|
|
|
|
Fernando A. Gomez F. wrote: I don't have yet the environment setup in my machine (the app needs several components to work) thus I could only debug it in a remote way
I'd work on that part ... debugging-by-guessing sucks hehe.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It's failing while calling CreateDlgIndirect, it seems it's throwing an exception. I'll post more details as I get them.
Stupidity is an International Association - Enrique Jardiel Poncela
|
|
|
|
|
It would not happen to be using a Rich Edit control in the dialog, or an ActiveX control, would it? The dialog aborts if any of its controls fails to create.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|