|
I'm generating excel report from MFC. whenever the cell contains data like A1-1 i.e. A/a and some no and the - it gets converted to arabic characters. I found one solution which says about some registery entry. I want to solve the problem programmatically from MFC.
I used worksheet->Cells->NumberFormat = "General"
But if the registery entry is set for that format then it doesn't work.
How can do it through code?
Please mail me if anybody has the solution.
My email id is pankajachavan@gmail.com
Thanks
|
|
|
|
|
Hi all,
Is there any problem in ownerdraw list control having LVS_EX_CHECKBOXES style?
It does not respond to mouse click in the checkbox. But can check/uncheck by pressing spacebar.
Thank you.
- NS -
|
|
|
|
|
|
Sorry. It is not connected with owner draw. It uses custom draw.
- NS -
|
|
|
|
|
I'm attempting to write a program that can store and display a sparse table that shows students and their courses. I'd also like it to show the data values of the next student or course in each list. The table would display course columns and student rows. My goal is to be able to eliminate the arrays I currently have in order to get my program to run faster with a massive amount of data. However, I can't seem to find any useful information on sparse tables using linked lists anywhere. Can anyone help? I'm totally lost.
|
|
|
|
|
nyteryder79 wrote: sparse tables using linked lists
A std::map might also be used for a sparse array or sparse matrix.Other container classes can also be used like vector, list etc depending on your need.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
I have created a propertysheet with two property pages.
In the first property page i displayed 'employee names ' from the database and displayed in the grid lines.
I select on name and activate another property page.Using querysiblings i got the name in the second property page.
And using that ,employeename' i write a query to get the data from the database and displayed in the controls.
First time it is running fine.
Second time if i select another emplyoee name I am getting the correct results from database but the old data is displayed in the controls.
BOOL CCampaignDataEntryDlg::OnInitDialog()
{
CPropertyPage::OnInitDialog();
setUpODBC();// establish database connection
long x=QuerySiblings(1,(long)&m_querySibling);
CString* pString=(CString*)x;
pStr=*pString;
AfxMessageBox(pStr); //display employee name say 'tejaswini'
SQLRETURN sr;
SQLHSTMT hstmt;
CString campid;
campid.Format("SELECT empName,empID FROM EMPLOYEEDETAILS WHERE EMPNAME= '%s'",pStr);
SQLCHAR* SQL = (SQLCHAR*)(LPCSTR)campid;
I read the empName into roow.EmpName;
and empID into roow.EmpID;
CEdit *Name;
Name= reinterpret_cast<cedit *="">(GetDlgItem(IDC_EMPNAME));
Name->SetWindowText(roow.EmpName);
CEdit *EmpId;
EmpId= reinterpret_cast<cedit *="">(GetDlgItem(IDC_EMPID));
EmpId->SetWindowText(roow.EmpID);
}
BOOL CCampaignDataEntryDlg::OnSetActive()
{
if(m_Status!="") //m_Status is to used to know whether the
//property page is activated or not
OnInitDialog();
/*One of our friends told not to call OnInitDialog()here and he suggested to write the code here instead writing in OnInitDialog().I did like that and in the first control that is Edit box is not displaying the text. Other controls are displaying it.*/
return CPropertyPage::OnSetActive();
}
BOOL CCampaignDataEntryDlg::OnKillActive()
{
m_Status="abc";
return CPropertyPage::OnKillActive();
}
Can u plz say How can I solve this problem?
Thanks in advance.
|
|
|
|
|
Is there any message that gets posted on event of a button press?
The ON_BN_CLICKED is used for specific buttons and that message gets sent if the specific button is pressed. If I have a dialog with 10 buttons, and I want to know if a button got pressed (any button, it doesn't matter which), how do I do this?
Thanks,
skyapie
|
|
|
|
|
Derive a class say ButtonEx from CButton and over ride DrawItem( LPDRAWITEMSTRUCT lpDIS )
Create buttons as the object of ButtonEx
ButtonEx::DrawItem( LPDRAWITEMSTRUCT lpDIS )
{
if(( lpDIS->itemState & ODS_SELECTED ))
{
// means buton is clicked
}
}
|
|
|
|
|
This is a very strange way of going about things. The code in question will fire every time a clicked button is rendered and not just once when it's clicked.
Steve
|
|
|
|
|
Thank you for pointing out
I was only thinking about getting the selection status. My solution was poor.
|
|
|
|
|
I like to autosize the owner draw button depending upon the text that it load dynamically based on localization strings. so some strings are large than others. Keeping this I override DrawItem in the inherited class from CButton.
The sample code is below
void CMyGraphicButton::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CString cs;
CString cslong;
ASSERT(lpDrawItemStruct->CtlType == ODT_BUTTON);
LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData;
if (!lpszText || lpszText == (LPCTSTR)-1)
{
GetWindowText (cs);
}
else
cs = lpszText;
// now i m trying to resize , so let try to increase the size of button unconditioally
// I get
//lpDrawItemStruct>rcItem.left =0
//lpDrawItemStruct>rcItem.right =75
//lpDrawItemStruct>rcItem.top = 0
//lpDrawItemStruct>rcItem.bottom = 25
//As my button is on extreme right side of dialog so i tried to extend/increase the size of
// button of the left side as follows
lpDrawItemStruct>rcItem.left -= 25 ;
// but the above causes the text to be moved on right side insead of resize/increase the
//button size.
Any idea or help is appriciated.
Thanks
Anil
}
[AKS]
|
|
|
|
|
u will receive a WM_COMMAND message(OnCommand) when any button is pressed. Also check the HIWORD of the wParam is BN_CLICKED to ensure that the message has arrived due to a button click.
nave
|
|
|
|
|
Handle the BN_CLICK notification in the parent window. This notification is packaged as a WM_COMMAND message.
Steve
|
|
|
|
|
Thanks! It worked
|
|
|
|
|
Hi again,
thanks for the reply last time....
Do you know how to do the same thing for the events where the user moves a scroll bar or clicks in a list box/list control?
I couldn't get it to work using the OnCommand method, so I used OnNotify. See code here...
BOOL CBaseFormView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) <br />
{<br />
NMHDR* pNMHDR = (NMHDR*)lParam;<br />
<br />
<br />
if(pNMHDR->code == 0xFFFFFFF4) <br />
{<br />
AsyncServicesUpdateInactivityTimer(this->m_hWnd);<br />
}<br />
<br />
return CFormView::OnNotify(wParam, lParam, pResult);<br />
}
Except I'm not sure what the notification codes for selecting something within a list box or list control, or moving the scrollbar are.
Thanks again
Skyapie
|
|
|
|
|
The WM_HSCROLL and WM_VSCROLL messages are sent when scrolling occurs in a Window's standard scroll bar. When the user clicks in a control it depends on the control. For example List View controls send the NM_CLICK notification.
Steve
|
|
|
|
|
|
when a button is clicked, the parent of the button will receive WM_COMMAND message. Check whether the high-order word of the wparam is BN_CLICKED.
if( message == WM_COMMAND && BN_CLICKED == HIWORD( wParam))
{
// button is clicked.
}
the lparam will be having the handle of button.
nave
|
|
|
|
|
but i want my button handle click, only use itself message.
LRESULT ButtonProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
........
}
return DefWindowProc(message, wParam, lParam);
}
|
|
|
|
|
in that case u must find the click event by handling the WM_LBUTTONDOWN and WM_LBUTTOUP messages.
nave
|
|
|
|
|
The basic technique used to subclass a window using straight Win32 is as follows:
- Declare a variable of type WNDPROC to point to the old window procedure before subclassing. i.e.
WNDPROC g_pSuperClass;
- Write a replacement window procedure which defers all unhandled messages to the old one. i.e.
LRESULT CALLBACK MyWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return CallWindowProc(g_pSuperClass, hwnd, uMsg, wParam, lParam);
}
- Now subclass the window with code like this:
g_pSuperClass = reinterpret_cast<WNDPROC>(GetWindowLongPtr(hwndButton, GWLP_WNDPROC));
SetWindowLongPtr(hwndButton, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(&MyWindowProc));
Now to specialize the window alter the code in MyWindowProc .
To handle the click event however you don't need to subclass the window. The button sends the BN_CLICK notification to its parent when it's clicked. This messages is packaged in a WM_COMMAND message.
Steve
|
|
|
|
|
Hi all,
I currently have a website running that I built in the programming Language C/C++ using Microsoft Visual C++ and built it to run as CGI. Everything works good, except I have grown tired of using conventional methods of input/outputting data to just dat and txt files, so I was wondering where or how I could learn to incorporate MySQL into my CGI app to store the data for my users on my website. I got mySQL server and installed it, I just more or less need to know how I can read/write to it from my code. Any help is appreciated. Thanks.
|
|
|
|
|
What benefits does this approach give you compared to using C#/ASP.NET ( which has data provider code built in ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Possibly it's already built - this is a huge benefit!
Steve
|
|
|
|