|
Sorry, didn't read #2 well enough...
You should use
<br />
if(m_lpszString != NULL)<br />
{<br />
free(m_lpszString);<br />
}<br />
in the destructor of the class
The basic rule is:
If you ever call strdup(), you must free() it somewhere.
A better alternative is to use a string class, either MFC or STL.
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
Ok, I understand now, thanks.
|
|
|
|
|
hi
i have an empty document. and i draw some line and image in it, even i minimize and then maximize the window, all of the document window content will be cleaned. how can i stop this ? i think i sould Invalidate() it but how can i findout that the window in minimized (or even window goes under another windows it will be cleand)
thnx anyway
|
|
|
|
|
HellShrimp4free wrote:
how can i stop this ?
You can't. It's by design. How else can it work ?
HellShrimp4free wrote:
i think i sould Invalidate() it
It invalidates itself, the problem is that you're not doing your drawing in the OnPaint or OnDraw or OnEraseBackground message handlers, which means that it's not redrawn when the Invalidate occurs.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-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
|
|
|
|
|
thanks mr christian. i write the drawing code in OnPaint and the content saved. So it mean that it will redrawn itself when needed and i don't have to check for redrawn opearation?
my another question is : in a sample in MSDN it loads and shows a Bitmap from a .bmp file. is there any way to load bitmaps from Resources ? (for Emxaple IDB_BITMAP1)
in GDI+ i mean.
|
|
|
|
|
HellShrimp4free wrote:
is there any way to load bitmaps from Resources ?
Look up the LoadBitmap() API.
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
HellShrimp4free wrote:
So it mean that it will redrawn itself when needed and i don't have to check for redrawn opearation?
Yes.
HellShrimp4free wrote:
in GDI+ i mean
I believe that you can build a Bitmap from a HBITMAP, which is probably the way to go.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-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
|
|
|
|
|
Hi:
am new to Visual C++ and have found www.codeproject.com to be an invaluable resource.
Can anyone please advise me on how to find out what version of the Windows SDK is installed and if needs to be upgraded.
Am currently running VC++ 6 SP5 on Win XP Prof.
Thanks in advance for any help.
Martin
|
|
|
|
|
If you haven't installed any of the actual Platform SDK's, then you are using the (very old) headers supplied with VC6. If you do have one or more versions of the SDK's installed, there should be a 'readme' file (usually found in <program files>\Microsoft SDK\readme.htm) that will include the date of the SDK.
For the latest SDK, see the MSDN[^]. I highly recommend buying a subscription, since it gets you the MSDN library and all of the SDK's on CD, as well as opens up download areas on the MSDN site.
Software Zen: delete this;
|
|
|
|
|
Gary:
thank you for the response.
Looks like I'm currently using the headers supplied with VC6.
Will look into a MSDN subscription as you advised.
Thanks,
|
|
|
|
|
|
Thanks:
but a bit large for a dial up connection.
Martin
|
|
|
|
|
Hi !
I have a homework about placing bitmaps on menus. In fact it is menu elements made of bitmaps entirely (Like in the Petsholts' book). If anyone could show me a sourcecode for this I would be greatfull;
(Both Mfc and c source acceptable)
Thanks.
|
|
|
|
|
The folks at Code Project don't mind helping with homework assignments, but you need to at least try to do it yourself first. You've apparently seen some source code (e.g. your reference to Petzold's* book), so you at least have an idea of what you need to do. Get the project started, and if you get stuck with a specific problem, feel free to ask.
* Note how the man's name is spelled
Software Zen: delete this;
|
|
|
|
|
I've tryed to find information and/or codesamples om how to create binary registry key/value, but with no luck.
Yes, I'm a newbie! But I'm trying...
All I've found so far, is information and codesamples on how to create strings and dword registry entries. I've tryed to study the MSDN help as well. But with my level of VC++ knowledge, this is quite cryptic for me.
Is there any savior out there that could just give me a short sample on how to create binary registry key. For example:
Create:
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Test
Value(hex): a4,9d,bd,32,84,95,cb,01,fa,98,6d,5d
Best regards,
Peter
|
|
|
|
|
Try the following:
RegSetValueEx(key,name,0,REG_BINARY,data,data_size)
where key is the registry key you want to write, name is the name of the value, REG_BINARY indicates a binary value, data is a pointer to the data, and data_size is the size of the data in bytes.
Software Zen: delete this;
|
|
|
|
|
Cheers!
I'll try that. Thanks a lot.
Peter
|
|
|
|
|
hai,
We customized the default open dialog by deriving the class from
cfiledialog . These are the issues that we faced.
Issues:
1. How to handle the default messages in cfiledialog class?
2. In Win'2000 & above, we tried to change the listview style to
LVS_REPORT using Modifystyle method The style is changed, but the files and
column headers are not displayed.
3. In Win'98, how to remove the separator in toolbarwindow32.
Please give me the solution as early as possible.
sureshb
|
|
|
|
|
1. How to handle the default messages in cfiledialog class?
Make a new class inherited from CFileDialog, that would solve.
2. In Win'2000 & above, we tried to change the listview style to
LVS_REPORT using Modifystyle method The style is changed, but the files and
column headers are not displayed.
Call the member function InsertColumn(...).
And 3.... I dont know...
Maxwell Chen
Lets make bugs better!
|
|
|
|
|
What do i need to have for programming a program like CD Box Labeler Maker. if you have some sample, it very useful for me. Or what's the library i need?
|
|
|
|
|
MFC. Seriously, it's pretty simple, standard stuff. Everything you need is in articles on this site.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-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
|
|
|
|
|
Can you tell me some exactly sampler, which you ask in MFC
|
|
|
|
|
MFC is the Microsoft Foundation Classes, and I honestly could not create an example without doing the whole thing. Look at some samples on printing and on GDI ( graphics ).
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-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
|
|
|
|
|
I am thinking about building a firewall and was looking at Winsock SPI. What I want is opinions on weather it is a good idea to do it with a LSP or if there is a better way of doing it.
P.S. if I finish it I will post it on CP
- Matt Newman / Windows XP Activist
"Well, the guy that's giving you a hard time is a f***in moron, and you can tell him thats straight from another Linux user." - John Simmons on Linux Users Just do the American thing and shoot him... - Jim Crafton on Linux Users Wh3n my l33t skillz 1mpr0v3, I w1ll h4ck M$, 4nd th3n wh0 w1ll b3 l4ugh1ng ? N0t Bill. H4 h4 h4 h4 h4 h4 h4. - Christian Graus
|
|
|
|
|
Personally I wouldn't bother since HW firewalls are so cheap today.
If you really must do it, http://www.ndis.com/papers/winpktfilter.htm[^] seems to be a good place to start looking at options.
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|