|
I'm working on a project that will allow a trace window in release mode, by extending IOStream functionality. Rather than have people have to learn my new modifiers, etc., I am also writing macros to replace TRACE for different circumstances. I want to have a trace window per file, and a global one. I also want a variable watch window, so I can send a variable in such a way that instead of scrolling off in the trace window, it stays visible.
My problem is I'd like to define a macro so I can do something like
VARTRACE(myVariable);
and have the macro pass both the variable and it's name to the stream. Is there a way I can pass the name of the variable given to the macro as an argument ?
Thanks.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I may be totally off base here, but I think you are looking for the ## token pasting operator.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Christian Graus wrote:
Is there a way I can pass the name of the variable given to the macro as an argument ?
The # preprocessor operator quotes a macro argument:
#define VARTRACE(var) YourTraceFunc ( #var, var ) So VARTRACE(myVariable) expands to YourTraceFunc( "myVariable", myVariable );
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Thanks, mate - just what I needed.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I suspect this should be really easy - it's just how!!!!
I have a single selection list control, in report view. The list may or may not fill the control. I want to ensure that one row in the list is always selected, ie the user cannot clickin the white space under the last item in the list, and deselect.
I had hoped there was just a style or flag I could set for this, but cannot find one. I have also looked at handling the NM_CLICK reflected message, but it appears this is too late.
Any help or ideas about how to deal with this would be appreciated!!!!
|
|
|
|
|
Just a guess, but handling the LVN_ITEMCHANGING, LVN_ITEMCHANGED, and LVM_SETITEMSTATE notification messages might be a good place to start. (See the Help for how to handle these notification messages.)
Peace!
-=- James.
|
|
|
|
|
I'd like to know what I need to be able to do the
following. I mean can I do all these using plain Win 32 API and a little MFC or
do I need to use some DirectX SDK or OpenGL 2d/3d/whatever?
- Read a PNG file
- Apply a circular mask, using the contrast between
the light subject and the dark background to size and position the mask - Apply a rectangular mask similarly, possibly
rotating the subject to be perpendicular to the canvas - Apply a feather to mask
- Black fill the background leaving the subject alone
- Write back the PNG to disk
I been asked by my boss whether all this is possible
and having no previous experience in graphics I am stuck. If it involves having
to download some complicated SDKs then I'll probably tell my boss that it is not
feasible. But if it can be done using MFC/API and maybe just a little bit of
Open GL I can make some serious attempts
Any help offered is immensely respected.
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hiya Nish.
Nish [BusterBoy] wrote:
some DirectX SDK or OpenGL 2d/3d/whatever?
DirectX has DirectDraw, but OpenGL is all 3D AFAIK.
Nish [BusterBoy] wrote:
Read a PNG file
Easiest way is to use GDI+, but there are other ways around it if you need W95 support.
Nish [BusterBoy] wrote:
Apply a circular mask, using the contrast between
the light subject and the dark background to size and position the mask
Apply a rectangular mask similarly, possibly
rotating the subject to be perpendicular to the canvas
Apply a feather to mask
Black fill the background leaving the subject alone
This is all possible using Win32, your first step is to deal with a DIBSection so you have easy access to the bitmap data to start comparing light/darkness, etc. What the hell is a feather ?
You basically want to take a picture of something over a darker background, figure out it's position and draw a circle around it, then a rectangle ( rotating the image so that it's perpendicular ) and do a fill of the darker area ? Do you want to rotate in place, or to a bitmap of approproate size ?
The fill part is as easy as pie - step through the bits and any below a threshold get set to 0. The rest doesn't sound over hard, but it's probably of a jump off the deep end if it's your first ever graphics assignment. There is a class here on CP that loads and saves PNG from memory, and GDI+ does it also. Chris Maunder has a DIBSection class here, I am also writing one I could send you, it's simpler than his though. As for the rest, if you could provide some more details, and LMK if you intend on using GDI+ or not, I'd be happy to mail you some more detailed source code to get you started.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thanks Christian
I guess I'll need some help when I get started.
It's been a long time since I had to learn something totally new to me.
I'll start by checking out your GDI+ articles I guess.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish [BusterBoy] wrote:
It's been a long time since I had to learn something totally new to me.
Cool. I had to write a paint package and I had *no* idea about PC grapihcs - it was a VERY bumpy ride ( two rewrites in my own time when I realised I'd taken the wrong track ), but I learned a LOT.
Nish [BusterBoy] wrote:
I'll start by checking out your GDI+ articles I guess.
If GDI+ is an option I suspect it will make a lot of this easier. If you could give me a better idea of what you're trying to do ( what is feathering for example, what sort of image are you dealing with, what's the purpose of all this ) then I might be able to help more specifically. If you like I can also send you the code for my next WDJ article, which was supposed to come out in Jan. It is a simple app that loads and saves images in different formats, but more to the point, it illustrates how to access the pixels directly in GDI+, which you'll need to do from the sound of it.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Christian Graus wrote:
what is feathering for example
This is what I got from wepopedia:-
http://www.webopedia.com/TERM/f/feathering.html
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I see - a soften filter but only on the area we've decided is the edge. Easy stuff, done with a convolution matrix. I'll send you some code - can I get your email address from your CP account details ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Christian Graus wrote:
can I get your email address from your CP account details ?
Yes, you can.
I've also send you a mail with my email details.
My email fullname is "void main".
Please don't delete the mail thinking it is spam
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
how do you do pseudocode for: while, do-while, and for loops. Ive been to a bunch of sites and a couple said there was no way to do a for loop and the while and do-while loops didnt seem very good. Is there an official pseudocode site i could go to?
-Raffi
|
|
|
|
|
I didnt think pseudocode had any set standards or formats
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hello,
How do I write a program in Standard C++ that simply extracts the data contained in an XML document and removes the elements(tags). What I mean is, not a full fledged parser, but a simple program that extracts data and that's it. We could use the fstream object to load in the document and then I guess we will need to compare the document for '<' and '>' and remove those words?
Thanks,
Vinu.
|
|
|
|
|
Take a look at the EXPAT XML parser. Sure, it does a LOT more than you need, but why reinvent the wheel.
I am notorious for hating other people's code and wanting to write my own. But I LOVE EXPAT.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I need to write code to simply report and extract information from the XML document. Hmm, this makes me think of PERL. Anyway, like I was saying, I don't want a parser, just some code so I can extract only the data instead of the elements. Also I just want to use Standard C++ and not MFC.
|
|
|
|
|
Perl could probably do that in one line. Something like:
perl -e '$/=undef; $_=<>; s/<.*?>/ /g; print;' < file.xml > output.txt I think $/ is the right variable to undefine to make <> slurp in the whole file, newlines and all.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
That is good, but it is written in Perl. Could someone translate that into Standard C++ so I can compile it in C++?
Thanks,
Vinu.
|
|
|
|
|
I second Time Smith .
Use Expat.
It's the best SAX parser out there for C/C++ programmers
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Time Nish?
hehehe
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
LOL
Sorry Tim.
I am a bad typist!
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
If you are just going to ignore people's sugestions without even looking at them, then why come here and ask.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Hello,
Trying to bridge the gap between what I was taught in school and MFC.
In school we created Btree file structures. It occurred to me that there is probably already made classes that are more sophisticated than the ones I created in school.
Could someone point me in the right direction? Do I need to learn STL, for example?
Say, for example, I wanted to write an MFC address book. I can do that but how do I write the data to a file and then retrieve when the program is run again?
I mean, I cant see busting out my project and throwing into MFC. Seems like MFC would have a way to do such a common task. Do I need to look at CObject and serialization?
Thanks in advance.
harry
|
|
|
|