|
Germghost wrote: Now I'm stuck - I don't know how to connect my recordset to this so that I get a list of customers. Currently all I get is an empty list control with just column headers.
Did you loop through the recordset and call InsertItem() to add the items to the list control?
Germghost wrote: Any help appeciated!
See if this is of any help.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Hi
Thanks for your post. I have read that article (a couple of times). Unfortunately it does not cover what I am trying to acheive - it uses a dialog and databinds controls on that. I'm using a view derived from CListView. Whilst I can get at the list view control using GetListCtrl(), I can't bind my data in the same way it seems.
I can't actually find any examples of binding a recordset to a CListView view, which is very frustrating. I can't believe it's THAT difficult and I'm sure I'm missing something quite simple here
|
|
|
|
|
Hi all,
Years ago I wrote a datamapper in 16 bit C which is still in use. Later I added a debugger that is based on the same code with a user interface in front. When we changed to windows interfaces, I rewrote the interface in c++ (Visual Studio 6) still mixing it with the original C mapping code. Then I migrated to Studio 2005. Works fine. I however recently moved to studio 2010. Now, the system crashes on every "malloc" statement in my C code. It throws an exception at the HEAP_ALLOC (Can't really follow anymore, the last part is in assembly for which there is no source studio says).
Anyone any idea if there has been a change in memory alignment? Is there a compiler option that I should use?? Please help you wise men and women out there!!!!
Thanks in advance
William
|
|
|
|
|
Could you give more details about your project? Is it composed with your DLL s?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The program is a Dialog based program that calls the datamapper's main loop (replaced the original "main" in the production datamapper by a routine called "StartMapping" in case of the debugger) from the "OnInitDialog". The dialog is c++, the datamapper is C and it does call some Studio6 built libraries that hold stuff like a standard error handling, license check etc. That has all been passed when at some point in the mapping, I use a malloc (or - after having removed the malloc for a test - a _fullpath with a NULL pointer for the target)
Point is that it all worked fine when compiled in Studio2005, and it no longer works now that I have it compiled by Studio2010. It crashes when calling HeapAlloc in ntdll.dll, which tends me to believe that something changed in memory alignment.
William
|
|
|
|
|
Couldn't you rebuild the 'Studio6 built libraries'?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Could do that, but:
1. They are still used in other programs too
2. Some of these programs have also already been built in Studio 2010 and they all work.....
William
|
|
|
|
|
Hi William,
Try linking your exe with Data Execution Prevention off: Project->Properties->Linker->Advanced->Data Execution Prevention (DEP)->No.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hello everyone!
I am trying to alternate an SDI application which is used to operate a spectral camera as part of my diploma thesis. Since it's not my code entirely I tried to simulate a bit of the functionality I want add in a simpler example. So I created an MFC SDI application using Creation Wizard of Visual Studio 2005 (it's a bit old I know but what can you do...). The code I added implements a new class derived from CDialog which creates an invisible message-only, and posts/sends two user-defined messages. These two messages are supposed to be handled by an object of my class CInvisibleWnd. Everything seems to work fine (no errors and no warnings during building) and all my objects are successfully created but the code inside the event handlers is not reached! Do you have any suggestions?
Here's a code snippet of my added classes:
#define WM_MITSOS (WM_APP + 14)
#define WM_TAKIS (WM_APP + 15)
class CDialogMsg : public CDialog
{ DECLARE_DYNAMIC(CDialogMsg)
public:
CDialogMsg(CWnd* pParent = NULL);
virtual ~CDialogMsg();
enum { IDD = IDD_DIALOG_MSG };
CInvisibleWnd* pWnd;
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedButtonCreate();
BEGIN_MESSAGE_MAP(CDialogMsg, CDialog)
ON_BN_CLICKED(IDOK, &CDialogMsg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &CDialogMsg::OnBnClickedCancel)
ON_BN_CLICKED(IDC_BUTTON_CREATE, &CDialogMsg::OnBnClickedButtonCreate)
END_MESSAGE_MAP()
void CDialogMsg::OnBnClickedOk()
{
SendMessage(WM_MITSOS, (WPARAM)1, (LPARAM)3);
}
void CDialogMsg::OnBnClickedCancel()
{
SendMessage(WM_TAKIS, (WPARAM)2, (LPARAM)4);
}
void CDialogMsg::OnBnClickedButtonCreate()
{
pWnd = new CInvisibleWnd;
}
class CInvisibleWnd : public CWnd
{ DECLARE_DYNAMIC(CInvisibleWnd)
public:
CInvisibleWnd();
virtual ~CInvisibleWnd();
protected:
DECLARE_MESSAGE_MAP()
afx_msg LRESULT OnMitsos(WPARAM w, LPARAM l);
afx_msg LRESULT OnTakis(WPARAM w, LPARAM l);
};
IMPLEMENT_DYNAMIC(CInvisibleWnd, CWnd)
CInvisibleWnd::CInvisibleWnd()
{
CString wnd_class_name = ::AfxRegisterWndClass(NULL);
this->CreateEx(0,wnd_class_name,_T("CMyMessageOnlyWindowClass"),0 ,0 ,0 ,0 ,0 ,HWND_MESSAGE,0);
AfxMessageBox(_T("Invisible Window created!"));
}
BEGIN_MESSAGE_MAP(CInvisibleWnd, CWnd)
ON_MESSAGE(WM_MITSOS, &CInvisibleWnd::OnMitsos)
ON_MESSAGE(WM_TAKIS, &CInvisibleWnd::OnTakis)
END_MESSAGE_MAP()
LRESULT CInvisibleWnd::OnMitsos(WPARAM w, LPARAM l)
{
AfxMessageBox(_T("Hi Mitsos"));
return LRESULT(true);
}
LRESULT CInvisibleWnd::OnTakis(WPARAM w, LPARAM l)
{
AfxMessageBox(_T("Hi Takis"));
return LRESULT(true);
}
The CDialogMsg object is created by C"MyProjectName"Doc object...
I could not incorporate message-only CWnd to C"MyProjectName"Doc due to multiple inheritance which is, as I found out, very difficult to implement. The best source I found for message-only CWnd in MFC is here: How to make a Message Only Window
Any ideas?
Thank you very much!
Best Regards!
Ody -- Always look on the bright side of life --
modified on Thursday, June 23, 2011 11:40 AM
|
|
|
|
|
Possibly try something like, pWnd->SendMessage(...)?
|
|
|
|
|
Thank you very much! it worked and I just couldn't see that....
|
|
|
|
|
See my answer if you have some question as to why his code wasn't working.
|
|
|
|
|
There's two ways to send messages in windows (not including PostMessage() ):
Using the WinAPI[^]
OR
Using MFC[^]
Each one can do pretty much the same thing. In your posted code, you're using the MFC version, but since you're calling the method internal to CDialogMsg , you're posting the message to that specific CDialogMsg object (you have him sending that message to himself), not to any CInvisibleWnd object.
How can you specify to send it elsewhere?
pWnd->SendMessage(...);
SendMessage( pWnd->GetSafeHwnd(), ...);
On a related note, you probably shouldn't name your messages with the "WM_" preffix, as that's there to indicate its an internal windows framework message.
|
|
|
|
|
Hi Developers,
Can anybody help me for a sample application of list control( Report View ) in MFC.
Actually I was handling a employee table. I want to show it's records in list control.
Thanks in Advance
|
|
|
|
|
|
Amrit Agr wrote: Can anybody help me for a sample application of list control( Report View ) in MFC.
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Hi Developers,
Suppose there is one text file in which I have stored database of Employee table like this:
EmpID EmpName Age Designation
101; Amrit; 23; Software Developer;
102; Ganesh; 25; Software Developer;
I want to take these record ( field by field ) based on these delimeter which is ;
Pls help me out to do that.
Thanks in advance.
|
|
|
|
|
Use string::getline to read the file line by line in a loop.
For each line read use the tokenize functions like strtok_s or wcstok_s with ; as the separator.
|
|
|
|
|
«_Superman_» wrote: For each line read use the tokenize functions like strtok_s or wcstok_s with ; as the separator.
Why not string::find_first_not_of ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, why not?
In this case that will work since it is a single separator.
|
|
|
|
|
Yeap Thanks,
CString::Tokenize works better if we are getting the text in CSTring object, as I was using CStdioFile::readString().
|
|
|
|
|
This is a good answer, but I think it's interesting to mention that when dealing with large files, reading line-by-line will make this a very slow process.
Reading the file or a large part of it into memory and then scanning that would speed it up.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
That is true, but Windows also does this for you by pre-fetching from disk to memory.
So even if you do this, the performance improvement may not be so great.
But you never know.
|
|
|
|
|
See the section titled "A string tokenizer" here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
i have a project depend on converting mathematical C formula to mathematical formula used in calcualtors
for example
pow(x , 2 ) .....>x^2
the same as roots and all expreesions
which topics i must search ? must i search for tex and latex and MathML ?
help please
thnx in advance
|
|
|
|