Hexadecimal & Text Box

Hi,

I overrided WM_CHAR to allow only some
characters to be entered in a text box..

But the text box allows the paste command...
How can I know when the user "paste" so I can
verify the input !?

Thanks a bunch

Mike 


0
someone913 (592)
3/6/2006 5:52:56 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
287 Views

Similar Articles

[PageSpeed] 42

You have to catch the WM_PASTE message and check the content.

take a look at this example
http://www.codeproject.com/editctrl/NumEditCtl.asp

AliR.

"Mike Gleason jr Couturier" <someone@microsoft.com> wrote in message
news:u7vtJbUQGHA.4900@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I overrided WM_CHAR to allow only some
> characters to be entered in a text box..
>
> But the text box allows the paste command...
> How can I know when the user "paste" so I can
> verify the input !?
>
> Thanks a bunch
>
> Mike
>
>


0
AliR3470 (3236)
3/6/2006 6:09:36 PM
>I overrided WM_CHAR to allow only some
>characters to be entered in a text box..
>
>But the text box allows the paste command...
>How can I know when the user "paste" so I can
>verify the input !?

Mike ,

If you handle EN_UPDATE you can cater for both situations:

void CHexEdit::OnUpdate() 
{
	CString str;
	
	GetWindowText( str );

	/* Access the string buffer directly */
	LPSTR pBuff = str.GetBuffer( 10 );

	bool bProblem = false;

	for ( int indx = 0; indx < str.GetLength(); indx++ )
	{
		char nChar = pBuff[indx];

		if ( ( ( nChar >= '0' ) && ( nChar <= '9') ) ||
			( ( nChar >= 'A' ) && ( nChar <= 'F' ) ) ||
			( ( nChar >= 'a' ) && ( nChar <= 'f' ) ) )
		{
		}
		else
		{
			bProblem = true;
			break;
		}
	}

	str.ReleaseBuffer();

	if ( bProblem )
	{
		int start, end;

		/* Find the current caret position */
		GetSel( start, end );

		/* Restore the last good text that was entered */
		SetWindowText( m_LastGood );

		/* Restore the caret */
		SetSel( start-1, end-1, true );

		/* Let the user know */
		MessageBeep( MB_OK );
	}
	else
	{
		/* Store the last good entry string in a
		 * member variable of the Hex edit class
		 */
		m_LastGood = str;
	}
}

Dave
0
davidl7375 (2060)
3/6/2006 8:24:39 PM
Reply:

Similar Artilces:

how to increase mail box to receive large messages using outlook ?
I am having messages bounced saying mail box not large enough -- how do I fix this ?? Thanks Chris speak to your email admin - if they are messages you send, speak to the recipient so they can ask their admin. (but don;t hold your breath that you'll get it increased) -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Author, Google and Other Search Engines (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Jo...

Prblm w/ photos ninserted in MS Word text box
I'm running Word 2004 on a Mac G5 running OS 10.4. When inserting a photo in a text box in a Word doc, some of the Picture Effects are not active.I want to add a shadow around the edge. When I click on the picture, the Picture Formatting Pallette opens, but the Shadow effect, next to "Effects" in the second row down is not active. What's going on? Mike in Atlanta On 12/20/05 5:35 PM, in article 1135118110.792146.154940@z14g2000cwz.googlegroups.com, "Mike in ATL" <mike.ventura@comcast.net> wrote: > I'm running Word 2004 on a Mac G5 running OS 10.4....

sum of check box
Hi, I made a report from a query. In my report I have multiple check box (yes/no). I would like to sum all the yes check box at the end of the report. I tried =Abs(Sum([name_of field])) as well as =Sum(IIf([name_of_field]=True,1,0)) and for both, I get the result on the report as ''yes''....???... Any suggestion? Thanking you in advance! Cheers, Ka Fix the format property of the sum control (xerox engineering?) Pieter "ka" <ka@discussions.microsoft.com> wrote in message news:C09F5EB4-C98C-452C-A1A7-E0AFE8099D72@microsoft.com... > Hi, > >...

Text box displaying columns from a combo box
I'm using text boxes to display the column data from a combo box. Trouble is when I move to another record or close the form and ome back in, those results are not displayed anymore and I have to reslect the values in the combo boxes to fill in the text boxes. Is there a way to lock the results to the text box for each record? TIA -- Don, Sydney Australia Don, I take it that you have a combo bound to a field in your table. When the combo is dropped down, you see several columns, but when it's not dropped down you can see only one. Therefore you have added some other text boxe...

Combo Box help please
I have a combo box with 4 fields which is using a query made from 2 related tables. Column 0 populates the primary table and I need column 1 to populate the secondary table once selected in the form. The details from each field are located on the form (hidden with a visible field which joins columns 2&3 into one field) Is there a way to do this? Really do not want to split this down if I can help it. If I do need to split it, is there a way to select column 0 and it make the 2nd combo box only show related entries e.g Current Combo - 0=Company Name, 1=ContactID, 2=F...

Adjust Row Height for Text
I am working on a worksheet, and I have a row that contains text that I want to restrain in length so the text automatically wraps around and starts a new line within the row. I've tried "help" in Encel, but I can't figure how to do this. I want a wrap around in the row, because I don't want the text to exceed the limits of the paper when the worksheet is printed out. Any help would be appreciated. Pedro -- To contact me directly by email, please remove the words "NO" and "SPAM" from the reply address above. Alt click on the cell you want...

toolbar is not getting resized while adding and removing text to buttons of toolbar
hai all, i actually created three Image lists and added bitmap array to each of them then added to toolbar as shown below-> m_wndToolBar .GetToolBarCtrl().SetImageList ( &m_ImageListToolbar ) ; wndToolBar .GetToolBarCtrl() .SetDisabledImageList ( &m_ImageListDisabledToolbar ) ; m_wndToolBar .GetToolBarCtrl() .SetHotImageList ( &m_ImageListRolloverToolbar ) ; now i was asked to remove are add text to buttons of toolbar depending on the option which is placed as a check box in the dialog. i am invoking that dialog from CWinApp derived class. for that i...

Where is the text strikethrough command in Publisher?
Please use this space to be courteous. -- Ed Bennett - MVP Microsoft Publisher You lost in this white space somewhere! ...

Need a simple macro that will import any one of a number of text files in a folder
I'm having problems coming up with a macro that will allow me to import a text file of choice from my default file location that I have set up with Excel which contains several text files. I want the macro to open a "Open" file dialog window where I can then choose the text file of choice. I also need it to open the file as delimited, starting at row 23 and with the tab selected as the only delimiter. Please help... thanks, steve Steve I have been using the following for several years to obtain a spreadsheet from a .csv file downloaded from a bank. You will need to add the...

ow to create comparison chart using text as value data?
lplease help me. I am trying to set up a comparison chart of 3 computers cost and features! I cannot figure out how to use the features as values on the x or y axis says data range is to complex so cant select rows or columns. I am trying to enter the features as my source data too bungled dont know what to do term project is now overdue and I am stressing out!~ Dont want to fail. please help me!do i have to redo the whole chart or what any suggestions and demonstration would be deeply appreciated. thanks, Dee Johnson The first thing you need to do is think how the chart should look. Wh...

Changing text "A" to a number?
In cell A1 I have the either Letter a, b or c. I would like to give them a numerical value of 1, 2 and 3 in the adjacent cell. Can someone post or point me to the formula? Thanks Try this: =3DCODE(LOWER(A1))-96 Then copy down. Hope this helps. Pete On Apr 11, 5:15=A0pm, Larry <Yak...@gmail.com> wrote: > In cell A1 I have the either Letter a, b or c. > I would like to give them a numerical value of 1, 2 and 3 in the > adjacent cell. > Can someone post or point me to the formula? > Thanks One way: = CODE(UPPER(A1)) - 64 another: =MATCH(A1,{"a","...

Blank text in Sent Messages
When I compose a New message in MS Office Outlook 2003 or Reply to a message after I have Sent the message, I review my Sent Items folder and there is no message in the forwarded message and No Text in the New message, only address information and Subject information. It is as if any outgoing message content gets deleted. I cannot find the proper setting and I have shut down and restarted my pc several times. Please Help! ...

Auto-select combo box entry when only one row
I have 2 combo boxes the second is dependent on the first. When the first is clicked, I requery the second in the OnClick event. When the requeried combo box has only one row, I'd like this to be auto selected. How can I do this? Thanks. "mscertified" <rupert@tigerlily.com> wrote in message news:3AACB546-54A0-4BC2-8AFA-03AEB37F001E@microsoft.com... >I have 2 combo boxes the second is dependent on the first. When the first >is > clicked, I requery the second in the OnClick event. When the requeried > combo > box has only one row, I'd like this to be...

extract covert dollar value in text cell to just dollar value
cell value/contents: 10 for $1,700.00 to just $1,700.00 for Cell A1 use =MID(C29,FIND("$",A1),72) this will extract everything to the right of (and including) the $ sign -- Alex Delamain ------------------------------------------------------------------------ Alex Delamain's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=11273 View this thread: http://www.excelforum.com/showthread.php?threadid=275359 On Thu, 4 Nov 2004 10:08:06 -0800, "Kelly" <Kelly@discussions.microsoft.com> wrote: >cell value/contents: 10 for $1,700.00 to ...

Slow check box
HI all, Have a prob. I have multiple check boxes on my sheet but, they tak approx 2 seconds to select when 'clicked'. I know it still runs but have others similar that run instantaneously. Any ideas???? Cheers!! -- gavme ----------------------------------------------------------------------- gavmer's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=666 View this thread: http://www.excelforum.com/showthread.php?threadid=32029 ...

New Excel Comment Box Issue
My Excel comment boxes are showing up as a solid black box. On the surface, it looks like the same issue as all the other posts that I have read. I'm running Office 2000 on Windows 2000 desktop. This has suddenly stopped working in the past week or so. I'm having problems with all spreadsheets with comments. I can access the spreadsheet on different computers without problems - all with the same setup. I have tried the following to no avail- Reinstalling Excel (2000) Checking the settings for the comment boxes - my settings are fill color: automatic style is set to 3/4 pt ...

between date text boxes will not link to subform
This is what I have done. I know it is not correct. I have added this to the 'Link Master Fields' property in a subform : Between [Forms]![SUB_ORDERS]![StartDate] And [Forms]![SUB_ORDERS]![EndDate] However, I cannot get the form to output on this criteria. Instead when I run this I get a pop up parameter with the exact code above printed on the popup. When I key in a date it goes straight to the form. I just wanted to use two text boxes with the between date functionality. Please tell me what I am doing wrong. Please. Thanks, Mitchell -- Message posted via AccessMonster.com http:...

Why does calendar dates that I receive go directly to "Delete" box
Calendar dates that I receive from others in the bldg. go directly to my "Delete" box. Does anyone know how I can change them to go to my "Inbox"? Are the appointments added to your calendar? What is your configuration in Tools, options, email options, tracking options: http://slipstick.me/jing/receipts.png -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newslette...

Disable Dialogue Box To Save & Replace File
Hi, I'd like to have a macro to NOT have excel ask me if I want to replace the existing file when i save, ie, when I save a file and there's already one in the folder, I want excel to just overwrite the file without having a dialogue box asking me if I want to overwrite the existing file. Is it possible? Regards, Dolphin Hi, Fish. :) Dave Hawley has an article here: http://www.ozgrid.com/VBA/prevent-save-prompt.htm ************ Anne Troy www.OfficeArticles.com "Dolphinv4" <Dolphinv4@discussions.microsoft.com> wrote in message news:D2E93992-EC0F-4D02-89D1-B565131...

show text when mouse rolls over hyperlinnk
How do I get a text box and description display when I roll the mouse cursor over text or a hyperlink? Reference: Using Tool Tips in Publisher Web Publications : http://msmvps.com/blogs/dbartosik/pages/81254.aspx If you have more questions about Publisher webs, then post in the web group and we will try to help you there: news://msnews.microsoft.com/microsoft.public.publisher.webdesign DavidF "rm1231" <rm1231@discussions.microsoft.com> wrote in message news:F2004526-4D2F-4ED7-9578-F157F04BED3C@microsoft.com... > How do I get a text box and description display when I r...

using Publisher, how do I bend text to fit inside a circle shape?
Using Publisher, how do I bend test to fit inside a circle shape? With WordArt. What version Publisher? I have a short tutorial for a circle shape here, scroll way down http://msauer.mvps.org/wordart_in_microsoft_publisher.htm -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "bruce" <bruce@discussions.microsoft.com> wrote in message news:E166C91C-79FD-467A-A128-6E71A4C431CC@microsoft.com... > Using Publisher, how do I bend test to fit inside a circle shape? ...

Rotating a Text Box in a Chart
Is there a way to rotate general text on a chart? There does not appear to be a way to rotate a text box. Thanks, Paul If it is in a cell then you should be able to right click on cell and goto format cell then click on alignment tab and you can rotate upto 90 degrees up or down. >-----Original Message----- >Is there a way to rotate general text on a chart? There >does not appear to be a way to rotate a text box. > >Thanks, >Paul >. > There is some basic capability. Double-click the textbox, and in the resulting Format Text Box dialog box, click the Alignment...

first letter of text box referece
i have created a user input form in VBA, which works fine. "organisation" is a field on the form if a user enters an organisation beggining with letters A-F for example, i want the data entered to go into sheet 1. if the organisation begins with G-L, i want it to go into sheet 2 etc... i have managed such a formula in excel, but does not work in VB. my current attempt looks like this: If Organisation.Value(Left >= CHAR(65), Left <= CHAR(70)) Then ActiveWorkbook.Sheets("sheet1").Activate Range("A2").Select ElseIf Organisation.Value(Left >= CHAR(71)...

Populate Word UserForm Combo Box from Access
Does anyone know how to reference/populate a combo box which is on a userform within a Word document. I am trying to overcome the 25 item limit on a drop down combo box on a Word form. The way to do this seems to be to create a UserForm and add the combo box onto that. - this allows more than 25 items, but i cannot see how to populate it from within Access. The normal combo boxes on the document I populate like this: doc.FormFields("EmployeeName").Dropdown.ListEntries.Add Name:=rs!employeename I can populate the combo box on the userform from a Macro in the document itself...

Automatically Hyperlink Text in certain cells?
Anyone know if it is possible to automatically hyperlink. i looked under format cells but no such option. for example if i type: testfile.zip into Cell A1 it will automatically make the text a hyper link to testfile.zip tia You have a couple of options: #1. You could type in a longer string: file:////c:\my documents\zipfiles\testfile.zip (include the "File:////" and the full path to the file.) #2. You could use an adjactent cell that uses a worksheet function: =if(a1="","",hyperlink("file:////c:\my documents\zipfiles\" & a1, "Click m...