|
If it's a bmp, LoadImage will load it. Otherwise, GDI+ will probably load it. Then you need to select it into a DC, draw text on it and save it again ( which probably means you need GDI+ and will load it into a Graphics object ). I have several articles on gDI+ here, one of them is called 'doodle' - it will show you how to load and save an image, and draw on it. Just change the code to draw text instead.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I cant find the the article... would u mind giving me the link?
Its a bmp but not not necessarily in the resource folder...
|
|
|
|
|
I don't see how you could miss it. I typed 'doodle' in to the search and it was the first hit. You could also click on my name and 'view articles'.
http://www.codeproject.com/vcpp/gdiplus/doodle.asp[^]
The bmp would have to be on disc, not a resource.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
CImage m_Image;
m_Image.Load("d:\\picture.bmp");
in the function OnPaint(event WM_PAINT)
CPaintDC dc(this); // device context for painting
BitBlt(dc.m_hDC,0,0,800,600,hdc,0,0,SRCCOPY);
dc.TextOut(40,40,"test",5);
|
|
|
|
|
Hey, just trying to use a variable to hold multiple values so that I can then send those values back to my originating app. I have three values that I need to store in my variable before I return it.
I am using something like this:
for(d=alldevs; d; d=d->next)
{
if (d->description) {
strcpy(descp,d->description);
//strcpy(dev,descp);
}
}
return dev;
If I uncomment the commented line, I see only the second value, if left as is, I see only the first value, I of course, want all three or as many as there will be --probably no more than three. I am trying to enum the adapters in the system, btw.
Any help is appreciated, as always. If you need more info, please let me know. have a good day and thanks in advance.
EDIT: figured it out --I used strcat instead of strcpy and it works. thanks anyway.
-- modified at 19:37 Sunday 2nd April, 2006
|
|
|
|
|
I need some help getting a edit window to select, copy and paste text.
An article on the subject would be helpful or an example of code.
Thanks
Merlin Vilhauer
|
|
|
|
|
How do you mean ? You have an edit control and you want to select and copy text out of it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi guys, I have a problem concerning a constructor.
I have a code like this:
CClass *pClass;
pClass = new CClass();
pClass->CClass::CClass( param1, param2 );
CClass has 2 constructors, the first called with new, and the second one has to be called after it.
The VC compiler accepts this syntax, but GCC does not.
What can I do? Redesign won't work, I need it exactly like this!!
Thanks for advice,
Alex
Don't try it, just do it!
|
|
|
|
|
Simply speaking, you can't. I am actually surprised that it compiles with VC++.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I have to and I know that it works for GCC, too... I just don't know the syntax, that's the problem.
Don't try it, just do it!
|
|
|
|
|
You are not really calling 2 constructors, you are only calling one, then calling an function, which happens to be an overloaded constructor.
Overloading functions is ok, but some compilers will complain if you try overloading a constructor. Perhaps you should create just the one and pass null values to the first call.
I'm curious to know why you need it to be like this?
|
|
|
|
|
CClass *pClass;
pClass = new CClass();
pClass->CClass::CClass( param1, param2 );
What is it you are trying to do here? You are creating a pointer to an object, calling its default constructor which should be
pClass = new CClass; then trying to call it's overloaded constructor. You can only call one of them, calling the second will only initialise a new object. I'm surprised this compiled.
|
|
|
|
|
waldermort wrote: pClass = new CClass();
nop walder, this line is correct.
> using no parameter will always implicitely call the default constructor.
> using parenthesis without parameters will call the same default constructor, but explicitely.
> using some parenthesis with parameters will make the compiler look for the best fitting constructor.
you must know that some constructors can be declared as explicit , and such constructors cannot be called without parenthesis !!!!
|
|
|
|
|
there is no way to re-design it.. i need it exactly as i described!!! i solved the problem using inline assembler now, but it is not the best solution i think. The problem is not the overloaded constructor. the problem is, that the GCC does not want me to call a constructor.
Don't try it, just do it!
|
|
|
|
|
You could try using 'placement new'.
e.g.
new(pClass) CClass(param1, param2);
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Why would you want to do such a thing?
Steve
|
|
|
|
|
|
hi
hope everyone will now be familiar with the environment of new express edition of Visual c++ .
so if any one can help me out with my problem
i have have to make menus, so i need to have coding for "open file" , "Save As", "exit"
if u also explain step by step the procedure of how and where to attach the code.
Thanx
if possible reply on :
aliashar86@yahoo.com
FASTIAN
|
|
|
|
|
perhaps you could search google for some C++ tutorials, there are many tutorials available for both beginners and professionals, ranging from creating a simple text editor to reprogramming your mothers hairdryer.
This one here[^] covers most of the basics.
|
|
|
|
|
Hello all.
Let's assume I have commands like this:
"c:\Program Files\Product\command.exe" -arg1 -arg2
\\.\c:\Program Files\Product\command.exe -a 1
I would like to know how to extract the "command.exe" part from whatever possible command syntax Windows allows.
Thanks all.
-- modified at 12:22 Sunday 2nd April, 2006
|
|
|
|
|
Wont argv[0] give you the exe name .
int main(int argc, char* argv[])<br />
{<br />
char *exeName = argv[0];<br />
TCHAR szFileName[_MAX_PATH];<br />
_tsplitpath( exeName , NULL, NULL, szFileName, NULL );<br />
return 0;<br />
}
// after seeing michael answer it striked me you were looking for the exe name
Regards,
FarPointer
-- modified at 13:23 Sunday 2nd April, 2006
|
|
|
|
|
|
Hi all,
have any of you had any experience coding debbuger traps? You know those pices of code which detect if somebody is trying to reverse engineer your app. I you have any code samples or links to useful websites dealing with this I would be very much appreciative.
Thanks in advance.
|
|
|
|
|
The classic is the IsDebuggerPresent API.
Steve
|
|
|
|
|
I have a library in a file libgsl.a, which I want to make use of in my .dll that I write in VC++. How can I actually force compiler to link it? I tried adding the path to additional library path, but I still get the "unresolved external symbol" error...
Kordzik
|
|
|
|