|
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
|
|
|
|
|
Instead of using this handle i used Current window handle ie
CMyDlg dlg(AfxGetMainWnd());
or
CMyDlg dlg(this);
dlg.DoModal();
Same assertion occurs
bRes = SetThreadDesktop(hDesk);
hWnd = GetDesktopWindow();
CWnd *MyWindow;
MyWindow = CWnd::FromHandle(hWnd);
CMyDlg dlg(MyWindow);
dlg.DoModal();
|
|
|
|
|
No.. thats not the problem...
For u to display a dialog in another desktop...First create a new thread. Then write the above the code in that thread function...
bRes = SetThreadDesktop(hDesk); <br />
hWnd = GetDesktopWindow(); <br />
<br />
CMyDlg dlg; <br />
dlg.DoModal();
plz check if this is working..Also let me know the result
nave
|
|
|
|
|
|
How to get scrool bar of List Control? And make list scroll to some pos.
|
|
|
|
|
use the CListCtrl member function "Scroll"
Scrolls the content of a list view control.
BOOL Scroll(
CSize size
);
Parameters
size
A CSize object specifying the amount of horizontal and vertical scrolling, in pixels. The y member of size is divided by the height, in pixels, of the list view control's line, and the control is scrolled by the resulting number of lines.
Return Value
Nonzero if successful; otherwise zero.
also take a look at GetScrollPos to get the scroll position
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
We have developed one project in which we have to sort out the fields based on filter condition. The project should be similiar to the one we have in the excel sheet. The first Row in data grid control will be static and we cannot edit anything in that. It actually has the column names from the database. But the filter condition has to be placed there. A dropdown box should appear when we click that column name and the unique values residing under that column has to be displayed. The rows in the grid has to be refreshed according to the filter condition we applied.
please let me know the ways in which it can be implemented. please give me the source code if possible.
|
|
|
|
|
by using RegNotifyChangeKeyValue() ,we can notify the changes,then how i can capture the changed key name ,value,status i used RegQueryValueEx(),
i got some garbage value like iiiiiiiiiiiiiiiiii.
Any one give idea about how to capture the name after identifying the notification.
Thanks
Kiran.V
|
|
|
|
|
show the code you are using to capture the change of a key name, and we will see why you get a garbage....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|