|
It may be an object of CSpinButtonCtrl..
nave
|
|
|
|
|
yes
CSpinButtonCtrl m_spin;
CEdit m_edit;
..
m_spin.SetBuddy(&m_edit)
...
|
|
|
|
|
yes
CSpinButtonCtrl m_spin;
CEdit m_edit;
..
m_spin.SetBuddy(&m_edit)
...
|
|
|
|
|
zeus_master wrote: How to make the edit display the value by hex string?
If "2F" is already in s string-type variable, just use CEdit::SetWindowText() :
m_edit.SetWindowText("2F"); If not, please explain more clearly what you are after.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
In fact, I want to build a simple tool to debug some registers. the registers value range is from "0x00" to "0xFF". only display the string from the hex value
please see sketch map below:
____
|DE | // edit value display is 00,01,02.......,0A,0B,....0F,...1E...FF
<||> // spin left<- ->right
|
|
|
|
|
Now I understand. Unfortunately, the only solution I can think of is to make the edit control right-justified and just wide enough to hold FF.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
what you mean is this function m_edit.SetWindowsText("FF")?
would you tell me the way of you setting?
thank you
|
|
|
|
|
I assumed you simply wanted to know how to set the text of an edit control.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
yes, it is also a problem for me.
how to set the text/string of edit control that display the value from "00" to "FF"?
|
|
|
|
|
Why don't you set it through code?
Remove the style UDS_SETBUDDYINT .
Handle the notification for spin control.
Now get the current integer value of the spin control and get it in hex format using Format function of CString or by using sprintf .
for ex:
sprintf(buf, "%x", spinVal);
Nibu thomas
Software Developer
|
|
|
|
|
thank you very much for your suggestion,
I removed the style UDS_SETBUDDYINT, and added the code below.
void CFlexgridDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
BYTE str;
str = m_UpDown.GetPos();
m_edit.Format("%02x",str);
m_edit.MakeUpper();
UpdateData(false);
*pResult = 0;
}
the text of the edit display the hex string I want now.
but I met another problem is if how to limit input value from keyboard of the edit is hex string format.
CEdit m_edit1Ctrl;
CString m_edit;
void CFlexgridDlg::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char chartemp;
char edit1sel;
UpdateData(TRUE);
edit1sel = m_edit1Ctrl.GetSel();
if(edit1sel)
chartemp = m_edit.GetAt(edit1sel-1);
else
chartemp = 0x00;
if(!(isxdigit(chartemp)))
{
m_12.SetSel(edit1sel-1,edit1sel);
m_12.Clear();
}
UpdateData(false);
}
the code can work well while the edit is not a buddy of the spin, if set edit as a buddy of the spin. the error occurs, UpdateData() cann't work here?
|
|
|
|
|
zeus_master wrote: but I met another problem is if how to limit input value from keyboard of the edit is hex string format.
Subclass CEdit and handle WM_CHAR .
Check for valid hex characters.
If not valid hex characters eat the message else display char.
Nibu thomas
Software Developer
|
|
|
|
|
thank you.
|
|
|
|
|
zeus_master wrote: how to set the text/string of edit control that display the value from "00" to "FF"?
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
hi
i just starting using cv++ express and i find a problem with DATABASE reading.
i have an access database that i fill it with information ,but i got a problem to read from my database in the other version of vc++ i can use CRecordSet,but with vc++ express its not possible.i am lloking for help to read from my database?
thank u
|
|
|
|
|
1. r u using cdaodatabase, cdaorecordset class?
2. Access database version ?
|
|
|
|
|
aguest wrote: ...in the other version of vc++ i can use CRecordSet,but with vc++ express its not possible.
Right, because MFC is not available with the Express edition. You will need to do what MFC is doing behind the scenes for you. See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi,
I'm using an imported dll in my application. All works well until i perform a drag and drop to a window that is based upon a differnet dll. From this point on i get the message "Error loading bitmap with ID=" even though it has found this resource before the flow moved to the dll.
i know it has something to do with afxSetResourceHandle() but where, when and how? Does anybody have a clue how to fix this?
Thanks in advance.
Snir
|
|
|
|
|
hii,
u hav to get the modulehandle of dll first.
HModule hMod = ::GetModuleHandle("path");
then use afxSetResourceHandle(hMod) it will give you Exe handle.
later u set the Exe handle back.
|
|
|
|
|
Hi,
Using
CSplitterWnd m_wndSplitter;//header file
//in .CPP file
m_wndSplitter.CreateStatic(this,2,1);
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTest1),CSize(rcRect.Width()),rcRect.Height()),pContext);
m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CTest2),CSize(100,100),pContext); return TRUE;
I have taken an MDI,Default application will be shown Maximized, then i Restore it ,how to handle the Size of the two view.They are show properly.
Thanks in before
James
|
|
|
|
|
RockyJames wrote: They are show properly.
So if they are shown properly, what exactly is the problem?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi
I have created an MFC application which on perticular event creates new desktop using CreateDesktop() functions and then switches to new desktop using SwitchDesktop() function. Also I have used SetThreadDesktop() function to set the current(newly created) desktop as the current one. Now I have inserted one new dialog from Menu Insert->Resources. And created new class for it, Say CMyDlg.
Now after creating new desktop I switch to that new desktop and try to show my dialog over there in this way.
// hDesk is my newly created desktop's Handle.
bRes = SetThreadDesktop(hDesk);
hWnd = GetDesktopWindow();
CWnd *MyWindow;
MyWindow = CWnd::FromHandle(hWnd);
CMyDlg dlg(MyWindow);
dlg.DoModal();
Here it shows the new dialog form on my new desktop, but when I try to move my mouse or try to click any button that I have created, it shows assertions and fails. It shows following error.....saying error in WINCORE.cpp
void CWnd::AssertValid() const
{
if (m_hWnd == NULL)
return; // null (unattached) windows are valid
// check for special wnd??? values
ASSERT(HWND_TOP == NULL); // same as desktop
if (m_hWnd == HWND_BOTTOM)
ASSERT(this == &CWnd::wndBottom);
else if (m_hWnd == HWND_TOPMOST)
ASSERT(this == &CWnd::wndTopMost);
else if (m_hWnd == HWND_NOTOPMOST)
ASSERT(this == &CWnd::wndNoTopMost);
else
{
// should be a normal window
ASSERT(::IsWindow(m_hWnd));
// should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
CObject* p;
ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
ASSERT((CWnd*)p == this); // must be us
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
//
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
//
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
}
}
Any idea how to overcome this? Or any alternative how to show my dialog form on my newly created desktop and use my other events?
With best regards and thankx in advance.
|
|
|
|
|
|
no. if u have the solution tell me
|
|
|
|
|
The MSDN says
The SetThreadDesktop function will fail if the calling thread has any windows or hooks on its current desktop (unless the hDesktop parameter is a handle to the current desktop).
did u checked that ?
nave
|
|
|
|