|
wow, Thank you. It was the null terminator.
|
|
|
|
|
Hai!
i have an edit box in which user has to enter only 0x00 to 0xFF,
but if he enters more than two digits i. something like "FF2" or "G2" etc
what is the easiest way to check it!
I need in such a way that suppose user enters a wrong value such as "FF1"
and presses enter then i should display a message "Can enter only between 0x00 to 0xFF " and erase the previous data and set the cusor at the same edit box so that the user can enter a valid value.
I think i can use CEdit::SetLimitText () , so as to make the user to enter only 2 characters but what is the case with "G2" like values?
Thanks !
|
|
|
|
|
|
Use GetWindowText() to get the contents of the edit control. Convert that to an int and compare against 0x00 and 0xff .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
i m using a ListCtrl as Report Type and i want to add button inside the ListCtrl.
please tell me how can i do this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
here[^] is a link where you can add a combo box. on similar lines you can do this for a button
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
What I'm trying to do is add tooltips to a CView derived window so that I can change the text in the tooltip (or not display it at all) depending on where the cursor is and the state of various other things going on in the application (it's mostly just going to be for showing error states for things on the network). I'm not using any Windows controls at all on the view - the view basically just draws a bitmap.
What I've done is create the tooltip in PreCreateWindow as follows :
theApp.GetTooltipManager()->CreateToolTip(m_pToolTip, this, AFX_TOOLTIP_TYPE_DEFAULT);
m_pToolTip->AddTool(this, LPSTR_TEXTCALLBACK, CRect(0,0,600,600), 1);
EnableToolTips(TRUE);
m_pToolTip->Activate(TRUE);
I've added a handler in both the view and mainframe classes for the TTN_NEEDTEXT message (I'm not entirely sure which one it's supposed to go to in this scenario). I've also added m_pToolTip->RelayEvent(pMsg) into PreTranslateMessage.
But the TTN_NEEDTEXT message handlers never get called and no tooltip ever gets shown even if I hard code the tooltip text instead of using LPSTR_TEXTCALLBACK.
Can anybody shed any light on this for me? I've no doubt that this is a schoolboy error and I'll feel a complete fool when someone points out my stupidity, but I think I'm ready to accept that now...
Thanks in advance.
|
|
|
|
|
|
Thanks Iain. I know what you mean about the "unique" implementation of some bits of MFC - that's why I'm not using any Windows controls in my application other than the framework itself!
The only reason I wanted to use the inbuilt tooltips was for consistency with the tooltips on the menus and toolbars. Pedantic I know, but these things bother me.
Anyway, in case anyone else ever needs to know I've found a solution through a combination of bloody-mindedness, patience and trial and error. It seems that if you construct the tooltip object in OnDraw the first time it gets called, rather than in PreCreateWindow, then that code works fine.
Why? I'm really not sure TBH. I guess it's something to do with needing the view to be fully created before adding tooltips to it although I haven't seen anything in the documentation about that (not that that means it isn't there!).
|
|
|
|
|
|
1) Install windows
2) RegSetValueEx
|
|
|
|
|
hello,
i want to write data related to my application to registry, i want to know how to write it programmatically, got my point
|
|
|
|
|
Use App class's SetRegistryKey API to set the Application key in HKCU/Software.
Next you can use App class's GetSectionString() or GetSectionBinary() or GetSectionInt() etc to read the registry values.
SetSection..() APIs are also available.
|
|
|
|
|
hemanju wrote: want to write data related to my application to registry
Great. That means you are privileged but BEWARE VISTA settings
hemanju wrote: i want to know how to write it programmatically, got my point
Yes I understood it [ ]
RegCreateKeyEx - The RegCreateKeyEx function creates the specified registry key. If the key already exists, the function opens it.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
If you need to get help you should be specific with your questions.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Do you want to write in registry or you want to get backup of registry? I dont know do you need to CRegKey Class or no?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
COleClientItem::OnGetWindowContext takes CFrameWnd pointer. Now I deriving frame window class from CFrameWndEx. I am getting error when I send the CFrameWndEx pointer to this function. Is there any similar function to COleClientItem::OnGetWindowContext. Please let me know if anyone knows.
|
|
|
|
|
COleClientItem::OnGetWindowContext takes CFrameWnd pointer. Now I deriving frame window class from CFrameWndEx. I am getting error when I send the CFrameWndEx pointer to this function. Is there any similar function to COleClientItem::OnGetWindowContext. Please let me know if anyone knows.
|
|
|
|
|
|
|
i want to know how to set IPAddress control in status bar.
thanks
|
|
|
|
|
you have the ip address. Convert it to some string format and use
SetPaneText (/*params*/) API from CStatusBar class
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Your question ranges over a few subjects.
1/ Putting a status bar on a dialog - and the other reply points you at an article for that.
2/ Putting a control on a pane
3/ and putting it in the Nth pane.
http://www.codeproject.com/KB/miscctrl/progressbar.aspx[^]
Will help with (2) and (3). It uses a progress bar, but that will be easily adaptable to another control type.
Good luck!
Iain.
|
|
|
|
|
I am working on a Win32 based GUI, which has a menu with a static area defined as
CONTROL "",IDC_GRAPH,"Static",SS_GRAYFRAME,17,119,264,54
in the rc file.
In my OnPaint(), the following code gets executed
HWND hStatic = GetDlgItem(m_hWnd,IDC_GRAPH); //m_hWnd is CWnd handle
RECT pRect;
HDC hStaticDC= GetDC(hStatic );
GetClientRect(hStatic,&pRect);
iCX = (pRect->right - pRect->left)/2;
iCY = (pRect->bottom - pRect->top)/2;
COLORREF bkColor = GetBkColor(hStaticDC);
HPEN pen = CreatePen(PS_SOLID,8,bkColor);
MoveToEx(hStaticDC,iCX+4,iCY,NULL);
LineTo(hStaticDC,iCX1+4,iCY);
The code compiles correctly. But the bkColor gets CLR_INVALID and MoveToEx and LineTo returns a zero value. Where have I gone wrong?
modified on Thursday, December 11, 2008 4:20 AM
|
|
|
|
|
Are you using the static as a placeholder on your dialog where your drawing is suposed to go? If so, why don't you simply acquire its position and then draw into the dialog's DC? And make your static non-visible? I think it's a simpler method than trying to draw onto a static from another windows OnPaint... anyhows, are you sure you get a correct DC for that static? And why do you MoveToEx and LineTo the same coord? (*iCX+4,iCY), if you want to make a point use SetPixel or SetPixelV instead. Am not sure if 0 length lines are drawn as a point by GDI or not though.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|