|
I wrote an MFC Draw application that allows the user to draw a Line and a Rectangle. I am trying to implement 'RESIZE' for the Line and the Rctangle. Does anyone know how to resize the Bounding Rectangle for the objects???
Doru
|
|
|
|
|
I strongly suggest to check out a sample called DrawCli (MSDEV CD samples).
|
|
|
|
|
do you have the doc for the DrawCli ?
i feel good.
|
|
|
|
|
zhdleonid wrote:
do you have the doc for the DrawCli ?
what do you mean by doc? That's a sample source code, so the doc is the source code. And the debugger breakpoints come to the rescue for tiny details.
|
|
|
|
|
How can I have a toolbar bitmap with more than 16 colours? The resource editor doesn't like anything else and wants to "fix" it whenever I try
|
|
|
|
|
Open the bitmap in the resource editor, view properties, and change the colors to 256. The VC editor doesn't support more than 256, so if you need more colors you'll need to use some other app to create the bitmap.
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
u can use ms paint app edit it
|
|
|
|
|
How can I implements a tab control window like in Visual Studio Net. Tab controls can be displayed either horizontally, or vertically and docked to any inner side of the window. Tab items in the tab control window can also be grouped.
programming
|
|
|
|
|
what's the best way to send an email from my WIN2000 adv server? if i do NOT have SMTP server running?
and what about WIN98/ME/XP/NT.. ?
norm
norm
|
|
|
|
|
1. MAPI
2. Write your own code that can talk to the remote mail server (the server where the recipient is). There are plenty of classes that do this, some of them on CP too. This approach would be better IMO if your program is a server and you need to send emails on a server like scale. MAPI has got a large footprint, and sucks in a server environment. With your own class you can at least optimize things to suit you.
I assume you want to send emails from your program. Otherwise you may need to install an email server, or use some other email server as a relay for your emails.
Regards,
Rohit Sinha
|
|
|
|
|
|
how can i return a string from one of the methods of a component created using ATL-COM in vc++ i want to use it in VB
|
|
|
|
|
Use a parameter declared [out,retval] BSTR* pRetval , for ex.
STDMETHODIMP CSomeClass::SomeMethod( BSTR* pRetval)
{
if ( NULL == pRetval )
return E_POINTER;
SysFreeString ( *pRetval );
*pRetval = SysAllocString(L"Hi Bob!");
return (NULL == *pRetval) ? E_OUTOFMEMORY : S_OK;
}
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Can anyone think of why a symbol would be visible whilst linking one object file but not another?
I have something like this:
extern const int whatever;
const int whatever = 76;
header.h gets included by several of my files. source.cpp is part of my project.
The trouble is that some of my files get links, while others complain about not being able to see the whatever symbol.
Does this make sense?
J
May the bear never have cause to eat you.
|
|
|
|
|
If I remember my finer points of the C++ spec right, extern and const are at odds - a global variable that is declared const automatically gets internal linkage (that is, it needs to be defined in the same translation unit (CPP file) as the declaration). When the compiler gets to another CPP file, it knows there's a constant called whatever but it does not know its value. Adding extern doesn't change the variable's linkage because the compiler still doesn't know the value of whatever . It's similar to templates, where the entire template class has to be visible to all CPP files.
You should be able to put const int whatever = 76; in the header file, and there won't be any symbol collisions because each CPP file will have its own whatever with internal linkage.
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Michael Dunn wrote:
You should be able to put const int whatever = 76; in the header file, and there won't be any symbol collisions because each CPP file will have its own whatever with internal linkage.
Sure, but it will also have all of those constants stored in each translation unit, won't it? Considering I'm not just storing a single constant int, it's a lot of overhead that I'd like to avoid.
Anyways, it turns out that once I included header.h in source.cpp, everything became fine and dandy again. It seems to need to see that the constants are marked as extern before it allows other translation units (some) to see them.
It probably makes sense. I just can't see it right now.
J
May the bear never have cause to eat you.
|
|
|
|
|
Jamie Hale wrote:
Sure, but it will also have all of those constants stored in each translation unit, won't it?
I'm not a guru on the details of optimization, but I think in release modes, the optimizer should put the value 76 right into the compiled code, instead of referencing a variable, so you won't have multiple variables (one per CPP file).
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
Can anyone please tell me how to hide the cursor from blinking in a rich edit control? I made it read only, since I don't want users to enter anything, but they can still select stuff, and the cursor is there when they click anywhere inside it. Both of these I don't want.
I tried using HideCaret() but it's not working for me. Am I doing something wrong here?
I basically want it to look and behave like a static control but want the formatting capabilities of a rich edit control. Hmm, if nothing works out I may have to dig the RTF specs and do things on my own, which I don't want.
Thanks to anyone who helps me out.
Regards,
Rohit Sinha
|
|
|
|
|
Hi, I would like to store some pictures in memory in their raw format. What is the best way to do this memory wise? Should I use "new" or "malloc" or some built in windows function. The largest file will probably be no larger 500k - 1MB. Should I allocate individual chunks or one large chunk that will fit them all and just keep pointers to the their positions? Should I do anything else?
Thanks,
Clint
|
|
|
|
|
new and malloc are identical internally. and, they're both fine for the sizes you're talking about. if you start getting into utterly huge images, like 50MB or so, you might want to consider VirtualAlloc and friends.
clintsinger wrote:
Should I allocate individual chunks or one large chunk that will fit them all and just keep pointers to the their positions?
i always alloc them individually, under the assumption that the heap manager can do a better job of allocating and paging memory than i can do it myself.
i write a lot of image processing apps, and i've never had a problem with new/malloc (or LocalAlloc) for images in the 500-1000K range (or even in the 10-20MB range).
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
I am a very beginner in MFC programming. Right now I have to find a way to load and display an bitmap image and get the RGB values for each pixel into an array. But I have no clue what classes and methods to use. Could anybody give me some instructions on this? Any help is appreciated.
Thanks very much!
|
|
|
|
|
Check out Chris Maunder's DIBSection wrapper. A DIBSection is an image which provides you with a pointer to the byte array containing the image information. If you can use GDI+, even better. My C# image processing articles convert very easily to C++, which will give you what you want. I've written a number of articles on GDI+ in C++ as well.
There are no MFC classes to help you. ::LoadImage is an API call you can use to load a bitmap from disk, otherwise, it's GDI+ or third party classes.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Arrrrgh.
I jumped through the appropriate hoops to change my application to use MFC in a static library. And then, silly me, I tried to change it back.
181 link errors like this:
nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual void __thiscall CWinThread::Delete(void)" (?Delete@CWinThread@@UAEXXZ) already defined in mfc42d.lib(MFC42D.DLL)
I've compared my project settings to other applications and I can't see any difference.
What am I missing?
The project is set to use MFC in a shared DLL. The C runtime is Multithreaded DLL. _AFXDLL is defined. As is _MCBS (or whatever).
J
May the bear never have cause to eat you.
|
|
|
|
|
The linker is pulling in both the static version of MFC (nafx*.lib) and the import LIB (mfc42d.lib). So double-check your preprocesor settings, and do a rebuild-all.
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|