Extracting pixel values from a picture control (continued)

Does anyone see what the problem is with this code, and if my process
makes any sense?

// Local vars
int nImageSizeX = 640;
int nImageSizeY = 480;
char cFilename[256] = {"C:/Test1.bmp"};

// Load the image
HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP) LoadImage(NULL, cFilename,
                IMAGE_BITMAP, 0, 0,
                LR_LOADFROMFILE | LR_CREATEDIBSECTION |
LR_DEFAULTSIZE);
if (NULL == hBitmap)
{
   exit(1);
}

// Set the bitmap to the picture control
// m_picSource1 is a CStatic variable of the picture control on my
dialog
m_picDestination.SetBitmap(hBitmap);
HDC hdc = (HDC) m_picDestination.GetWindowDC();

// Get the pixel data
COLORREF cr;
CString cstrValues;
for (int nIndex = 0; nIndex < 100; nIndex++)     // Just checking 100
pixels
{
   cr = GetPixel(hdc, 0, 0);
   if (cr != 0xFFFFFFFF)
   {
      char cHexValue[256];
      sprintf(cHexValue, "%x, ", cr);
      cstrValues.Append(cHexValue);
   }
}
MessageBox(cstrValues);

I know I am mixing char arrays and CString but this is just to cut down
the code and show the problem. (code snippets)  The image I am loading
it something made in mspaint with pixel values white, black, white,
black, throughout the image.  I would expect the cr values to return as
0xffffffff and 0x00000000 alternatively however all values return as
0xffffffff.  The picture control is really showing the loaded picture,
and all handles appear to have valid addresses.  I must be using one or
more of the functions improperly.  Any clues?

0
11/23/2005 6:56:10 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
707 Views

Similar Articles

[PageSpeed] 9

How do you know that the picture control has drawn the image on the DC? And
there are a dosen more things I can pick at about this code.

Try this instead

HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP) LoadImage(NULL, cFilename,
                 IMAGE_BITMAP, 0, 0,
                 LR_LOADFROMFILE | LR_CREATEDIBSECTION |
 LR_DEFAULTSIZE);
 if (NULL == hBitmap)
 {
    exit(1);
 }


CDC *pDC = GetDC();
CDC MemDC;
MemDC.CreateCompatibleDC(pDC);
ReleaseDC(pDC);

CBitmap Bmp;
Bmp.Attach(hBitmap);
CBitmap *pOldBitmap = MemDC.SelectObject(&Bmp);


MemDC.GetPixel(....);


And if you want to know the width and height of the bitmap then simply call

BITMAP BmpInfo;
Bmp.GetBitmap(&BmpInfo);

GetPixel is a bit slow.  If you want to this a bit quicker then you might
want to get the bitmap bits from the CBitmap object and go through it
yourself, using simple addition.

AliR.


"Morpheus" <adamrobillard@gmail.com> wrote in message
news:1132772170.237622.131290@g49g2000cwa.googlegroups.com...
> Does anyone see what the problem is with this code, and if my process
> makes any sense?
>
> // Local vars
> int nImageSizeX = 640;
> int nImageSizeY = 480;
> char cFilename[256] = {"C:/Test1.bmp"};
>
> // Load the image
> HBITMAP hBitmap = NULL;
> hBitmap = (HBITMAP) LoadImage(NULL, cFilename,
>                 IMAGE_BITMAP, 0, 0,
>                 LR_LOADFROMFILE | LR_CREATEDIBSECTION |
> LR_DEFAULTSIZE);
> if (NULL == hBitmap)
> {
>    exit(1);
> }
>
> // Set the bitmap to the picture control
> // m_picSource1 is a CStatic variable of the picture control on my
> dialog
> m_picDestination.SetBitmap(hBitmap);
> HDC hdc = (HDC) m_picDestination.GetWindowDC();
>
> // Get the pixel data
> COLORREF cr;
> CString cstrValues;
> for (int nIndex = 0; nIndex < 100; nIndex++)     // Just checking 100
> pixels
> {
>    cr = GetPixel(hdc, 0, 0);
>    if (cr != 0xFFFFFFFF)
>    {
>       char cHexValue[256];
>       sprintf(cHexValue, "%x, ", cr);
>       cstrValues.Append(cHexValue);
>    }
> }
> MessageBox(cstrValues);
>
> I know I am mixing char arrays and CString but this is just to cut down
> the code and show the problem. (code snippets)  The image I am loading
> it something made in mspaint with pixel values white, black, white,
> black, throughout the image.  I would expect the cr values to return as
> 0xffffffff and 0x00000000 alternatively however all values return as
> 0xffffffff.  The picture control is really showing the loaded picture,
> and all handles appear to have valid addresses.  I must be using one or
> more of the functions improperly.  Any clues?
>


0
AliR3470 (3235)
11/23/2005 7:50:50 PM
Lots of problems...
On 23 Nov 2005 10:56:10 -0800, "Morpheus" <adamrobillard@gmail.com> wrote:

>Does anyone see what the problem is with this code, and if my process
>makes any sense?
>
>// Local vars
>int nImageSizeX = 640;
>int nImageSizeY = 480;
****
Of all possible useless random values you might choose, why "640" and "480"?  Just because
some bitmap *might* be this size is no reason to presume that a real bitmap will be.
****
>char cFilename[256] = {"C:/Test1.bmp"};
***
Why 'char'?  Bitmap values are usually unsigned, and BYTE would be appropriate.  Why some
value like 256?  Why is this a remotely meaningful value?  Depending on your bitmap color
depth, you might require anywhere from (640*480)/8 [monochrome] to (640*480)*3 bytes.  So
the two sets of numbers are completely inconsistent!
****
>
>// Load the image
>HBITMAP hBitmap = NULL;
>hBitmap = (HBITMAP) LoadImage(NULL, cFilename,
>                IMAGE_BITMAP, 0, 0,
>                LR_LOADFROMFILE | LR_CREATEDIBSECTION |
>LR_DEFAULTSIZE);
>if (NULL == hBitmap)
>{
>   exit(1);
****
Writing exit(1) is ALWAYS a coding error, and should never, ever be considered as a
possible option even for tiny little test programs.  Its very existence should trigger a
compilation failure in a respectable system!
****
>}
>
>// Set the bitmap to the picture control
>// m_picSource1 is a CStatic variable of the picture control on my
>dialog
>m_picDestination.SetBitmap(hBitmap);
>HDC hdc = (HDC) m_picDestination.GetWindowDC();
****
Why not a CDC *?  I see no reason to use a raw HDC here!  Note that the (HDC) cast only
works on a CDC, not a CDC *, so what you get back is going to be pretty useless.  All this
is does is take the CDC * pointer and pretend it is an HDC, which isn't going to help. And
do you *really* want a window DC?  For the work you appear to want to do,

CClientDC dc(&m_picDestination);

would have been more appropriate.
****
>
>// Get the pixel data
>COLORREF cr;
>CString cstrValues;
>for (int nIndex = 0; nIndex < 100; nIndex++)     // Just checking 100
>pixels
>{
>   cr = GetPixel(hdc, 0, 0);
***
	cr = dc.GetPixel(0,0);
although incorporating the index nIndex into the coordinate system would be a bit more
useful, because all this does is return a single pixel value 100 times, the pixel at the
0,0 coordinate
****
>   if (cr != 0xFFFFFFFF)
>   {
>      char cHexValue[256];
>      sprintf(cHexValue, "%x, ", cr);
***
Use of sprintf is even more evil than the use of exit().  What antique programming style
is this supposed to represent?  Oh, yes, the
"I-don't-care-about-buffer-overflows-or-security" style.  As soon as you write sprintf,
you should immediately recognize you have made a fatal coding error.  

The correct code is
	CString HexValue;
	HexValue.Format(_T("%06x"), cr);

Use of obsolete, error-prone, security-hole coding styles should be abandoned as quickly
as possible.  Don't even consider these as viable techniques for modern programming (they
were not viable techniques in 1975 when I first encountered them, and 30 years later they
*still* suck).  It is particularly odd that such obsolete styles are still used even
though modern styles are actually *easier* to use!
****
>      cstrValues.Append(cHexValue);
****
Why not
	cstrValues += HexValue;
?

Note that you will not be able to tell what the colors are in the string because you did
not include any punctuation, and the strings are variable lengths.  In your scheme, the
following produce the same results:

	0000FF
	00FF00
	000000
	000000
which formats in your scheme as
	FFFF0000
and
	FFFF00
	000000
	000000
which formats in your scheme as
	FFFF0000
Hence the use of %06x, so all 24-bit color values are printed out as six hex digits,
always.
****
>   }
>}
>MessageBox(cstrValues);
>
>I know I am mixing char arrays and CString but this is just to cut down
>the code and show the problem.
****
It doesn't cut the code down; it takes MORE code to show the wrong way.  It also takes
less intellectual effort; for example, why 'char'? Why 256? When declaring a CString makes
it perfectly evident what is going on!  So why mix values pointlessly?  Instead of
"cutting down" the example, you actually made it *harder* to read!
****
>(code snippets)  The image I am loading
>it something made in mspaint with pixel values white, black, white,
>black, throughout the image.  I would expect the cr values to return as
>0xffffffff and 0x00000000 alternatively however all values return as
>0xffffffff.  The picture control is really showing the loaded picture,
>and all handles appear to have valid addresses.  I must be using one or
>more of the functions improperly.  Any clues?
****
You need to declare a BITMAP structure and do a GetBitmap operation to fill in the
information.  This will tell you the actual number of bits used to represent it.  Perhaps
the fact that the first pixel is white, and your loop does not use nIndex in any fashion,
suggests that you are constantly reporting the one-and-only-(0,0)-pixel consistently.  

It is not safe to assume that a bitmap has a particular size, or a particular bit-plane
layout, unless you *ask* it what its size and color depth are.
				joe

****
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15978)
11/23/2005 10:19:18 PM
You people don't read the details... as I said, I hard coded values
simply to give an idea of what the code is supposed to do.  If I had
included the entire code including how to inquire the size of the
bitmaps and the command line parsing to get the filenames then it would
have been a 200 page post.  Get over yourself...  you are nothing
special.  This is called messing around with different function calls,
just to get something working.  Technique and proper syntax is useless
if your code doesn't work.  I have been working in this industry for
many years, and really don't need to be lectured from some
"know-it-all".  What are you, 12?

PS->  C++ is based on C.  There is no true C++ OOP language, when is
the last time you say a true OOP language with a main function.  Using
char's are perfectly acceptable, (normally unsigned char but like I
said it was more for the point of the function's usage).  Anyways, MFC
completely sucks...  using these functions only makes the user (you)
lazy.  The day Windows dies, where will the MFC lover be?  Nowhere...

BTW:  I created my own functions for loading the bitmap, and it works
like a charm.  I am now working on blob analysis using my buffers, do
you even know what blob analysis / pattern matching / Geometric model
finding is?  Didn't think so.

0
11/24/2005 5:31:35 PM
Then the correct approach is to write

int width = ... compute width...;
int heigfht = ... compute height...;

otherwise, we have to assume that you are posting code that is truly representative of
what you wrote.

Post code that looks like a beginner, you will be treated like a beginner.  Doesn't matter
how many years you've been around.  We see code like this all the time, and it is the
programmer's first attempt to write a piece of graphics code, just having finished "Learn
MFC in 21 days".  Bad code is bad code, and we can't figure out, if you post bad code,
whether you are just posting bad examples or you really believe that you've posted what is
a good example.  Remember, the only evidence we have of what you know is what you have
posted.

As far as years of service, I'm now in my 43rd year in the profession.  I see bad code all
the time, and confusing char and BYTE (unsigned char) as you did is a real newbie mistake.
It does not take 200 pages to indicate that you know how to compute a bitmap size; it
takes two lines (e.g., the lines above).

Using chars does not make sense when the data is unsigned.  It is surprising that someone
with your experience has missed this. A char is widened to an int by sign propagation, so
you will get definitely bogus output as a result of using char.  If you knew better, then
why write such beginner code?

If you don't like MFC, don't use it, but don't complain about it unless you have some
superior replacement.  I don't quite understand why C++ and MFC are confused in your mind;
what about all those Unix and Linux users who write in C++?  Your comments about OOP apply
equally to them...

As to the last time I saw an OOP language with a main function, exactly what are you
talking about?  Why should an OOP language *not* have a main function, or the equivalent?
Is Java OOP?  Whoops, there are main functions in Java...and there is no main function in
MFC, so I guess if the presence or absence of a main function is your criterion, then MFC
must be OOP.  If you're going to rant, at least try to be self-consistent in your rants.

Actually, those of us who use MFC will simply move on to the next platform.  C#, Java,
whatever the next platform is.  Windows shows no signs of dying, by the way, or have you
missed the fact that most machines today are Windows machines?  

As someone who used to program X windows (and regularly crash the X server by sending
legitimate command strings to it...) I wonder how people who don't like Windows actually
manage.  For example, X didn't support mapping modes or transformation matrices.  I wonder
why you think there is a problem with "MFC", and not with, for example, X.  Or do you have
other graphics platform you prefer?  OpenGL (whoops, Windows supports that...)?  

You seem to be confusing the Windows platform, C++, and MFC, which seems inconsistent with
someone of your claimed experience.  As far as I could tell, nothing in your original
question applied to MFC directly, but rather to Windows graphics.  Doing GetWIndowDC
instead of using GetDC or better still, CClientDC, is a newbie graphics mistake and a
newbie MFC mistake.  Having a loop which sequences across the bytes in the wrong order
(bottom to top) is a fairly common oversight made by people who don't read the DIB
documentation, but doing a GetPixel on (0,0) consistently (and wondering why all you see
is the same value) is definitely a newbie error.  And from this we are to infer you are a
sophisticated programmer?

Actually, in spite of your answering my question for me, I know a lot about blob analysis,
pattern matching, and geometric model finding, having done some of this in my career. I've
written edge detection algorithms, contrast enhancers, noise eliminators, geometric
pattern recognizers (look for the second derivative...sound familiar?), feature
extractors, and a few other interesting little projects. I've read bar codes that have
stuff written on top of them with black pen (requires heuristic pattern matching).  I've
determined the orientation of images of scanned pages so we could auto-rotate them to the
correct orientation.   And when I post questions, I don't make my postings look like I am
clueless about basic programming or confuse elementary data types.
					joe

On 24 Nov 2005 09:31:35 -0800, "Morpheus" <adamrobillard@gmail.com> wrote:

>You people don't read the details... as I said, I hard coded values
>simply to give an idea of what the code is supposed to do.  If I had
>included the entire code including how to inquire the size of the
>bitmaps and the command line parsing to get the filenames then it would
>have been a 200 page post.  Get over yourself...  you are nothing
>special.  This is called messing around with different function calls,
>just to get something working.  Technique and proper syntax is useless
>if your code doesn't work.  I have been working in this industry for
>many years, and really don't need to be lectured from some
>"know-it-all".  What are you, 12?
>
>PS->  C++ is based on C.  There is no true C++ OOP language, when is
>the last time you say a true OOP language with a main function.  Using
>char's are perfectly acceptable, (normally unsigned char but like I
>said it was more for the point of the function's usage).  Anyways, MFC
>completely sucks...  using these functions only makes the user (you)
>lazy.  The day Windows dies, where will the MFC lover be?  Nowhere...
>
>BTW:  I created my own functions for loading the bitmap, and it works
>like a charm.  I am now working on blob analysis using my buffers, do
>you even know what blob analysis / pattern matching / Geometric model
>finding is?  Didn't think so.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15978)
11/25/2005 7:03:34 PM
Zealots.. & arse's.. can't stand them..

Joseph M. Newcomer wrote:
> Then the correct approach is to write
>
> int width = ... compute width...;
> int heigfht = ... compute height...;

With those 43 years in the business I assume it was selling sofware at
a local 3rd game shop. First off your insight is horrible, you're just
a troll hiding under a bridge. The guy didn't come here to get flamed
he asked a question..

Buddy, in all those years since it's release did you even realise it's
not called "X WINDOWS".
But that's typical, of someone who's programmed "X-Windows"..  as you
said it's a newbie mistake.. should I start to flame you for it?

In my years on this planet I've learned something called "Manners &
Apathy" looks like you just have spite & Envy in place of them.. So
have you been an asshole all those 43 years, or something just recently
made you like that?


> otherwise, we have to assume that you are posting code that is truly representative of
> what you wrote.
>
> Post code that looks like a beginner, you will be treated like a beginner.  Doesn't matter
> how many years you've been around.  We see code like this all the time, and it is the
> programmer's first attempt to write a piece of graphics code, just having finished "Learn
> MFC in 21 days".  Bad code is bad code, and we can't figure out, if you post bad code,
> whether you are just posting bad examples or you really believe that you've posted what is
> a good example.  Remember, the only evidence we have of what you know is what you have
> posted.
>

If you couldn't figure out what he's trying to do.. maybe you just
don't know what you're doing.. and as to what kind of person you are
again.. "Remember, the only evidence we have of what you know is what
you have posted."

> As far as years of service, I'm now in my 43rd year in the profession.  I see bad code all
> the time, and confusing char and BYTE (unsigned char) as you did is a real newbie mistake.
> It does not take 200 pages to indicate that you know how to compute a bitmap size; it
> takes two lines (e.g., the lines above).

Newbie.. BYTE = unsigned char.. Question is who's the newbie? Have you
ever bothered to read the ISO specs fo C/C++? 43rd year.. you mean 1st
year college right?

I see bad code all the time, and confusting BYTE with unsigned char,
and neglecting the existance of ubyte is one of them, and does this
wreak havoc with portability, blue screen and security holes when
typing in a language other than 7bit ASCII

If in 43 years of using different compiles, and reading specs.. and you
still think BYTE is compatible with unsigned char.. then please refrain
from using byte, until you get a proper education.

>
> Using chars does not make sense when the data is unsigned.  It is surprising that someone
> with your experience has missed this. A char is widened to an int by sign propagation, so
> you will get definitely bogus output as a result of using char.  If you knew better, then
> why write such beginner code?

Achem... Ditto.. a byte is widened to an int, a ubyte is widened
unsigned int. So again, please read the ISO specs for both C & C++

  And when I post questions, I don't make my postings look like I am
> clueless about basic programming or confuse elementary data types.
> 					joe

No, when you post answers it appears that you're clueless about basic
programming, and
confuse elementary data type..

>
> On 24 Nov 2005 09:31:35 -0800, "Morpheus" <adamrobillard@gmail.com> wrote:
>
> >You people don't read the details... as I said, I hard coded values
> >simply to give an idea of what the code is supposed to do.  If I had
> >included the entire code including how to inquire the size of the
> >bitmaps and the command line parsing to get the filenames then it would
> >have been a 200 page post.  Get over yourself...  you are nothing
> >special.  This is called messing around with different function calls,
> >just to get something working.  Technique and proper syntax is useless
> >if your code doesn't work.  I have been working in this industry for
> >many years, and really don't need to be lectured from some
> >"know-it-all".  What are you, 12?
> >
> >PS->  C++ is based on C.  There is no true C++ OOP language, when is
> >the last time you say a true OOP language with a main function.  Using
> >char's are perfectly acceptable, (normally unsigned char but like I
> >said it was more for the point of the function's usage).  Anyways, MFC
> >completely sucks...  using these functions only makes the user (you)
> >lazy.  The day Windows dies, where will the MFC lover be?  Nowhere...
> >
> >BTW:  I created my own functions for loading the bitmap, and it works
> >like a charm.  I am now working on blob analysis using my buffers, do
> >you even know what blob analysis / pattern matching / Geometric model
> >finding is?  Didn't think so.
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm

0
Kamjin (1)
12/6/2005 3:35:36 PM
Reply:

Similar Artilces:

Counting cells with a calculated value.
I have been trying without success to do the following in 2007: Count cells in a named range (Col."H" abt 300 out of 1000 lines containing data) that are >= to columns "(C+H)+2". The format is "Currency" in both columns. I'm sure there is a way, but........ Thanks -- Sylvio If I correctly understand what you are asking, try something like =SUMPRODUCT(--(H1:H1000>=C1:C1000+H1:H1000+2)) or =SUMPRODUCT(ISNUMBER(H1:H1000)*(H1:H1000>=C1:C1000+H1:H1000+2)) These array formulas use the fact that the logical values TRUE and FALSE can be coerce...

Multiplied Values
Hi, Is it possible to design a VBA Macro to execute the following? I have in C6-C76 currency values. I'd like to have these values to be multiplied automatically by the month of the year located in A2. Ex: C6 = $168.92 Ex: A2 = Nov-04 I'd like to have C6 * 11 or C6*12 (If A2 =Dec-04) Hi if A2 is a real date value try: =C6*MONTH(A2) -- Regards Frank Kabel Frankfurt, Germany Jeff wrote: > Hi, > > Is it possible to design a VBA Macro to execute the following? > > I have in C6-C76 currency values. > > I'd like to have these values to be multiplied automa...

Error: Value in Formula of wrong data type
I have a worksheet that uses custom formulas on several inputs from that page. I've used it for a while and never had a problem, but made some changes elsewhere in the worksheet (not linked to this part) and now on many of the cells using these formulas, I get a '#VALUE!' error, stating 'Value in Formula of wrong data type.' The data type is the same it has always been, so I don't know why it's not working now (formula just uses if thens to compare different numbers and return values like 0, 1, or 2). What's even more perplexing is that several ...

Tracking item quantities and values
I'm wondering if there is a way to track the quantity of items in a category or department over a history of time, including the total value of those categories or departments at that specific time. For example, I tried a report on Reports > Items > Value List and was able to get extended quantities and extended cost for the current time, but I am unable to change the time in the filter. I have also tried Reports > Items > Item Movement History and changed the range to Year to Date. This includes the change in quantity, but not the change in extended cost. It seems like ...

extracting totals from within a spreadsheet
I need to know how to take different information from within a spreadsheet --where two conditions/catogories must apply so that a third column where i have inputed hours, will total for those conditions only... can anyone help? Please spell out what you want we are not mind readers -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Jovetta" <Jovetta@discussions.microsoft.com> wrote in message news:91442C6D-03DF-4FC1-A069-AAB43FA57485@microsoft.com... >I need to know how to take different information from within a spreadsheet > --where two condi...

Can not see CString's value when debugging
I'm very sure I'm in the CString's life scope, but I can not see its value but only some "???". Any other type of variables are ok. But some days ago, in the same project, I can see CString's value when debugging. So, what's wrong of CString in debug mode? Now I nearly can't do the debugging job! >So, what's wrong of CString in debug mode? It's a limitation of the debugger. Newer versions of CString have optimisations for the storage of small/long strings that the debugger doesn't cater for :( Dave ...

Making a worksheet and a graph that doesn't show zero values
Hi I am trying to build a template worksheet for my research. I get a file of logged data per day. I want to be able to copy the logged data from a .CSV file to a template file. Then separate worksheets will look at the raw data and import data from certain columns into that worksheet. The data is not logged in a regular way, there can be 30 cells between logging intervals or 29 or 31 cells. I can select that every cell in a column of Worksheet 1 looks at a set cell in the "Raw Data" worksheet. This will then give me a column consisting of logged data values with zeroes ...

extracting icons
Is there any way to extract an icon from an application? Take a look at the ExtractIcon[Ex]() API Cheers Check Abdoul --------------------- <davegreb@gpxinc.com> wrote in message news:c6c54da6-574c-4c8e-8ec9-3b77b99a5523@d70g2000hsb.googlegroups.com... > Is there any way to extract an icon from an application? ...

Value-of Select
Hi there, Im in a pickle chaps. I need to fetch information out from our raw XML files into a Style XSL sheet. Basically I have the commant <xsl:value-of select="Product/ProductCode"/> However the structure of the XML file is based like the following example <root> <Product> <ProductCode type="Seller">V1145</ProductCode> <ProductCode type="Buyer">H05439</ProductCode> </Product> </root> As you can see, we have different product codes based on Buyer and Sellers. However in my style sheet I only wan...

Extract emails from cells with text
I have a row in column A which includes an email address in the text that I'd like to extract to column B. Is there a formula I can use to accomplish extracting the email address only to column B? Here's an example of different cells in column A: Please email example@law.ufl.edu to contact us...... OR Schedule an appointment for assistance, or email example@uga.edu with your questions... Thank you Try this... All on one line: =TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND (" ",A1&" ",FIND("@",A1))-1)," ", REPT(" ",...

Active x controls 04-27-10
I can't seem to get Art mail created in Outlook Express to work properly in Windows Live mail. Message comes up that one or more Active X controls could not be displayed because either: 1) Your current security settings prohibit running ActiveX controls on this page or 2) You have blocked a publisher of one of the controls. As a result the page might not display correctly. I have checked all security settings but ......... Any suggestions appreciated To be honest I've never tried this but I would think that WLMail simply does not support the ActiveX controls requir...

Excel: extract and sum numerals from mixed text/numeral cell range
I have a large (30x20) grid of cells with data, and I want to extract and then sum up certain numerals from this entire range. The catch is that the data is mixed numerals and text, as you'll see below. Here's an abbreviated 3x3 example, with a value in each of the nine cells: V7.1 T H P1 A T B V3 P4.5 If I just wanted to sum up the instances of "T" appearing, I could use COUNTIF() for the entire range to come up with answer ("T" appears 2 times). Easy enough. But, what I'm trying to accomplish is to sum up the numerals associated w...

Newbie: How to Access Controls on a Dialog
I'm making my first stab at an MFC program. Basically a dialog box with some controls. I started out with basic edit boxes placed on the main dialog using the resource editor in VC++ (6.0). To set text, I have been using the SetDlgItemText(IDC_MYEDITBOX, "Sample Text"). Works fine. Now I working with Check Boxes. Okay, placed it using the dialog editor. Looked for some sort of equivalent to SetDlgItemText to check and uncheck the box using the control ID ("IDC_MYFIRSTCHECKBOX"). Nothing. Reading through Prosise's "Programming Windows with MFC"...

Query and Extract
Hello all, This seems basic, but I just cannot get it. While using SQL Server 2005 and the Microsoft SQL Server Management Studio, I created a database called AssetQuote. Inside I have on table called assetquotes. From there, I have three columns, (date, quote, author) The column type for date is datetime and the other two are just text. My Query is something this: INSERT INTO AssetQuote (date, quote, author) VALUES('052010','No act of kindness, no matter how small, is ever wasted.', 'Aesop'); When I run the query I get this result: Msg 208, ...

extracting individual numbers from "ranges"
I'm trying to get EXCEL to extract stock prices quoted in individual cells as 52-week ranges --e.g. 11.76-19.90-- and do the following calculation: (higher price - lower price)/lower price Obviously, this a problem because each cell appears to handle the range as text or something. Is there are way to get EXCEL to handle the "text" (or however else it is interpreting what's in the cell) as individual numbers? Great thanks for any help. Hi do your entries always look like lower_number-higher_number if yes you may try the following formula in the adjacent row (lets assum...

Cannot Ungroup a Picture in Words2003
Hello! I have a picture drawn in WORDS2003 sometime ago. But I can't ungroup it now. Can someone help? Many thanks. Lee CC You should be able to select the picture, right click, select Grouping, and Ungroup. "LeeCC" wrote: > Hello! > > I have a picture drawn in WORDS2003 sometime ago. But I can't ungroup it now. > > Can someone help? Many thanks. > > > Lee CC ...

most frequently occurring value
hello how do i find out the most frequently occurring value, digit, or numbe in a set of rows & columns ? then i need to find out the second most occurring value then the 3rd then find the least frequently occurring value then the second least occurring value then the 3rd thanx.. -- Pivotren ----------------------------------------------------------------------- Pivotrend's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=406 View this thread: http://www.excelforum.com/showthread.php?threadid=49572 Look in HELP for the FREUQUENCY() function -- Kind reg...

Blocking spam sent in picture format
Hello world, I recently installed Exchange SP2, and IMF V2 is working very well. The xml file to block certain keyword is great. The next challange i'm facing is alot of the junk mails which simply has an image in the body of the emails are getting pass the filter. I can't block those becase the spammer are copying paragraph from books, wep pages. Does anyone have any recommendations on how to block those spams? Thanks in advance. Ramy On Fri, 16 Mar 2007 07:17:03 -0700, ITDUDE27 <ITDUDE27@discussions.microsoft.com> wrote: > >Hello world, > >I recently install...

blank cells plot as zero values
This is a problem that's been discussed before, but I haven't seen this aspect addressed: If you select the chart in question and go to Excel>Preferences>Chart, you can indicate that empty cells should be plotted as 'Not plotted (leave gaps)". (This is one of 3 options including "Zero" and "Interpolated".) Thing is, this doesn't work! As far as I'm able to determine, the ONLY thing that Excel will do is treat your blank cells as zero values (yeah, yeah, unless I replace those blank cells with "#N/A"). The work-arounds are fine, but ...

Equation of items value
Dears, We have GP 10.0 SP2, we’re using average cost for inventory items. We’re trying to make an equation for inventory value from inventory module Equation of value = (IV BB + ADJ IN + PUR RCT + Sales Returns) – (Sales Invoices + ADJ OUT). We’re using the Smartlist inventory transactions to get above data, and filter by document type for each part, the result of this report should tie to the result of stock status Report since we are working on a snap shot of 2008 “no TRX in 2009 entered” so when we export the item QTY from Smart list with current cost the result of “QTY * Current Cost...

Printed scaled images pixelated
Whipping up a 400+ item catalog (sarcasm) and I'm importing images from the website which I had previously created. I need to scale them down of course, but when the page is printed, the images are pixelated so bad the image can't be distinguished. It's just a pixelated technicolor blob. Any ideas? Suggestions? Publisher 2002, Epson 1520 printing on ledger sized paper. To respond via email, the typical nospam must be removed. Thank you for any help. My experience has been that when I take something off a web site, I have to first save it in a different format and the...

Hiding a zero Value plus 0.2
I am using this formula, =CELL("contents",C18)*24+0.2, and in the blank cell it puts 0.2 Is there anyway that the cell can be left blank until I enter data into the referenced (c18) cell? Thanks in advance for your help. Miles Reed Hi Miles, =IF(C18="","",CELL("contents",C18)*24+0.2) -- Kind Regards, Niek Otten Microsoft MVP - Excel <milesreed2@aol.com> wrote in message news:2f2601c4c119$f84e9820$a601280a@phx.gbl... >I am using this formula, =CELL("contents",C18)*24+0.2, > and in the blank cell it puts 0.2 Is there ...

Novice - MsgBox Yes/No
I have a form to be completed by staff ONLY if they have approval to proceed with the work. I've managed (with this group's assistance!) to have a message box pop up but I want to add a wrinkle where if they press "yes", they can proceed to fill in the form, if they press "no", the file closes. I've never done If/Then in VBA (this is actually my first foray into VBA). Help please!: Sub Auto_open() MsgBox "The Project Manager's or Project Administrator's approval must be obtained prior to proceeding with this work. Has approval been obtain...

extracting hours from a sum of time
I have a cell which sum a bunch of cells containing an elapsed time. The sum totals to more than 24 hours. I have to a cell with a cost per hour and I need to caclculate the total cost. The problem is that the hour function returns values in the range of 0-24. My current sum is 25:30 and the hour function return 1 and not 25. Any ideas how to bypass it? It "returns" the correct number, but doesn't show. Format Custom as [h]:mm and it will. To convert to a number that you can multiply with an hourly rate, first multiply by 24; times in Excel are fractions of a day and a day is s...

Enter value if certain criterias are met...
I am doing something very wrong… Form. Fruits. Field. Colours Subform. Basket In the subform and in a combox “after update” event I want the following code: If Me.Type = “Banana” And Form![Fruits].[Colours] = And Not Is “yellow” or “green” Then MsgBox. ,…. In other words, Type “Banana” can not be chosen if Colours are other then green or yellow.. Am I thinking right here….? Peter wrote: >I am doing something very wrong� > >Form. Fruits. Field. Colours >Subform. Basket > >In the subform and in a combox �after update� event I want the following...