|
WinExec() most Simple
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi everybody,
here's a newbie one for y'all:
I was hoping that I'd be able to create an instance of CMap using very simplistic keys with something like:
CMap< int, int&, CMyClass, CMyClass& > m_myMap;
But I get a "'operator =' function is unavailable" error from the compiler. Is this because I have to use keys that are objects of a class, or what?
Best regards,
Håkan Olsson
------------------------------------
Håkan Olsson, M. Sc.
Technical Project Manager
Airborne Hydrography AB, Sweden
http://www.airbornehydro.com
NOTE: All standpoints, opinions, suggestions etc in the above stands for me and me alone and are not in any way affiliated with or endorsed by Airborne Hydrography AB.
|
|
|
|
|
It is saying that you need to implement an operator = within CMyClass.
CMyClass& operator =(const CMyClass& right)
{
<p></p>
return *this;
}
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)
|
|
|
|
|
UHh... OK. I thought that the "= not defined" thing was about CMap member functions not being able to compare keys rather than the objects...?
Anyway, thanks I'll try that!
------------------------------------
Håkan Olsson, M. Sc.
Technical Project Manager
Airborne Hydrography AB, Sweden
http://www.airbornehydro.com
NOTE: All standpoints, opinions, suggestions etc in the above stands for me and me alone and are not in any way affiliated with or endorsed by Airborne Hydrography AB.
|
|
|
|
|
If it was complaining about a compare method it would be "==" not "=".
Mike
|
|
|
|
|
i have a tga file and it has the parts specfied in it that is to be masked.....but since i am only familiar with the LoadImage function,i converted this .tga file to .bmp file.....what i want to know is:
1)is it still possible to mask with the converted bmp image??
2)if the first isnt possibl,then how do i load a .tga file and use the masking option???
plz help!!!!!
|
|
|
|
|
How can we trap errors in Constructors (C++)
Ranjish
|
|
|
|
|
What type of error???
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
what kind of errors ?
( based on Scott Meyers' More Effective C++ )
one problem is that if there are problems when constructing an object, and an exception is thrown, the object will not be destroyed because it is not fully constructed.
one solution, if possible, is to delay the class initialisation after the object is fully created.
Other solution, if the class absolutly needs to create and allocate members in the constructor, is to use auto_ptr pointers instead of ordinary pointers ( see above reference for full explanation )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi,
I am a new programmer in C++ and Vb. I have got a dll written in c++ and using that dll in vb. There are three functions in the dll namely
absmov(window,double)
relmov(window,double)
posreq(float *pos)
I have only these infos about the dll. So in vb I declared them as subroutine and passing single for float by ref in posreq which is working just fine but for the others I am passing window handle of the form as window and double value for movement. But it is not working doing nothing. What is the error here. What does this window paparemeter means and how to pass these kind of parameters. Any help will be highly appreciable.
|
|
|
|
|
sangit84 wrote:
absmov(window,double)
Buddy,
actually window is not a predefined datatype or structure, i think creator of Dll has written his own structure or what ever .
i htink you have to ask developer of dll about what window do.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
OK, never posted here before so please feel free to shout at me if i've committed a cardinal sin or something. If you do not then please could you help with my problem.
1. I know no C or C++
2. My colleague is abroad with no internet
3. He is trying to do some error handling using try() and catch(). However, the C compiler says that it doesn't understand the function try(). Does he need to put something in include or something?
Thank you so much in advance if you can help.
Cheers
|
|
|
|
|
If its C and not C++ then use Structured Exception Handling. You can search on Google and MSDN for more information about it.
Try, Catch, Throw exception handling mechanism used in C++ and not in C.
I hope this helps
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Thanks for the prompt response!
It is C code within a program that uses C++ (i think!).
Just to clarify then, you CANNOT use try() and catch() within C, only C++?
Thanks again
|
|
|
|
|
Yes. The file must be compiled as cpp and probably has to have a cpp extension.
John
|
|
|
|
|
Yes. Try() and catch() are part of C++, but not C itself! Therefore C code cannot use try and catch.
Note that C++ is almost a superset of C. Odds are very good that his program will work just fine if he compiles it as if it is C++ even though it is C. However this isn't 100%. Depends on how it is used.
Note that "extern C" might be required all over depending on how other things are defined. Look this up though, and experiment. (extern C might also turn off exception handeling though, I don't know. See what works, and test carefully, particularly if this is cross platform)
|
|
|
|
|
Anonymous wrote:
Just to clarify then, you CANNOT use try() and catch() within C, only C++?
Yes, as I said, try,catch and throw are part of C++ and not C. If you wish to use them in C then one option is to make your .C file to .CPP file and compile with the C++ compiler. All the code remains in C only, just change the extension and use it with C++ compiler. Many a times we use this approach just to use few features of C++ like - strict type checking, ability to declare variables at the exact place where they are needed rather than at start of function etc.
But if you want it to be pure C and compiled in C compiler then better use Structred Exception handling.
I hope this helps
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Also I hope he's not actually including the parentheses '()'. I don't know, but just in case, it's like this:
try
{
}
catch(CSomeException)
{
}
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Hello everyone,
My question is how to change the font color of slide.
I have Automated PowerPoint Using Visual C++ MFC,such as:
_Application app;
Presentations presentations;
_Presentation presentation;
Slides slides;
_Slide slide;
ShapeRange shaperange;
Shapes shapes;
Shape shape;
TextFrame textframe;
TextRange textrange;
Font font;
FillFormat fillformat;
ColorFormat colorformat;
ShadowFormat shadow;
if(!app.CreateDispatch("Powerpoint.Application", &e))
{
CString str;
str.Format("CreateDispatch() failed w/err 0x%08lx", e.m_sc),
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
app.SetVisible(TRUE); Presentations presSet(app.GetPresentations());
_Presentation pres(presSet.Add(TRUE));
Slides slideSet(pres.GetSlides());
_Slide slide1(slideSet.Add(1, 2));
// Add text to slide, by navigating the slide as follows:
// slide1.shapes(#).TextFrame.TextRange.Text
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)1)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("My first slide");
}
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)2)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("Automating PowerPoint is easy\r\n"
"Using Visual C++ is powerful!");
font = textrange.GetFont();
font.SetName("Comic Sans MS"); //Set the font name.
font.SetSize((float)48);
}
Now the question is how to change the font color????
Help me,please!!
Thanks a lot!!;P
cengyikun
|
|
|
|
|
hi all,
I want to add multiple rows using Edit Control.
I did like this:
CEdit m_edit;
m_edit.SetWindowText("hellow \n code \n project\n");
But this is not working .
when I compile and run the application.it is displayed like this:
hellow|code|project|
But I want to show the output like this using Edit Control:-
hellow
code
project
So can any body help me to solve this..
Thanks in advance
|
|
|
|
|
Did you choose multiline for the options of the edit control ?
Right click on the edit ctrl -> properties -> 'Styles' Tab -> check 'Multiline'.
|
|
|
|
|
hi
yes..I already check the multiline
Is there a another way to set string instead of SetWindowText()
??
|
|
|
|
|
pubududilena wrote:
CEdit m_edit;
m_edit.SetWindowText("hellow \n code \n project\n");
Try this instead:
CEdit m_edit;<br />
m_edit.SetWindowText("hellow \r\n code \r\n project\r\n");<br />
|
|
|
|
|
yes ..Thank u for correct me..
That is working now..
|
|
|
|
|
I build an ATL control, but after fresh many time, it will crash.
I find that column "Gdi objects" in "Task Manager" will be 9999.
I doubt that there are some problem in below code:
Line1 HRGN rgn = CreateRectRgn(...);
Line2 SelectClipRgn(hdc, rgn);
Line3 Draw Something;
Line4 SelectClipRgn(hdc, NULL);
Line5 DeleteObject(rgn);
I find that column "Gdi objects" will increment randomly after execute Line1; but when execute Line5, the column value be always unchanged(I assume it will decrement).
Is there any relationship between "Gdi objects" and windows gdi objects?
and why?
|
|
|
|