|
i'm so glad for your patient answer though i don't need it any more
|
|
|
|
|
Hi,
Is it possible to export a string to CSV when the string contains a comma, and then without losing the format of the string?
I dont want to replace the comma with a different character because I am exporting the string so it can be auditted by a different person.
If so, could you point me to where it explains to do it.
Thanks
Tony
|
|
|
|
|
Outwardly (I've not tested) yes, just surround with double quotes the fields containing commas: [^].
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]
|
|
|
|
|
Spot on, thanks a lot for that
|
|
|
|
|
I want to get the string selected in a list control(not in list box) and save it in another variable. Smebody plz help.
Thanks in advance.
|
|
|
|
|
Use ListView_GetSelectionMark [^] to retrieve the selected item index and then use such index in ListView_GetItemText [^] call.
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]
|
|
|
|
|
I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided.
Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it?
Thanks,
Nandu
|
|
|
|
|
How are you creating your window? Do you use the WS_CHILD value while creating it?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
As I mentioned mywindow2 is not a child of mywindow1. mywindow2 is total a separate window.
|
|
|
|
|
Since you know when first window is alive or not (after all you create, destroy or hide the window...) why don't you set a global flag and use it?
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]
|
|
|
|
|
What will happen or what will be the problem if I hide and create window as mentioned above. Why we should go that way and problem it will cause and why is it a bad idea?
|
|
|
|
|
Nandu_77b wrote: Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it?
Using FindWindow() could work or it could possibly result in a failure or a deadlock. What FindWindow() does internally is call EnumWindows() , and for each top-level window handle found, it sends a WM_GETTEXT message to the window handle. Now if the thread that owns the handle is blocked (e.g., on a Semaphore, a Mutex, an Event, an I/O operation, or some other manner), the SendMessage() call will block until that thread is freed up. Worst case, this may never happen so FindWindow() will block forever.
"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
|
|
|
|
|
I want to draw an image on wizard(CpropertySheet - wizard mode)'s top, it has Wizard97 style and I hide the header, so that this image can be seen on every page of that wizard.
I have drawn the image in OnPint() handler and return TRUE from OnEraseBkgnd() handler of CPropertySheet derived class. From every page, I return FALSE from OnEraseBkgnd() handler.
But this is not working as I want to work.
BOOL MyWizardSheet::OnInitDialog()
{
if(NULL == m_hBitmap)
{
m_hBitmap = (HBITMAP)LoadImage( NULL,
szManufactureLogoName.GetBuffer(),
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE );
szManufactureLogoName.ReleaseBuffer();
}
return CPropertySheet::OnInitDialog();
}
void MyWizardSheet::OnPaint()
{
CPaintDC dc(this);
CBitmap cbitmap;
BITMAP pbm;
if(NULL != m_hBitmap)
{
cbitmap.Attach(m_hBitmap);
cbitmap.GetBitmap(&pbm);
CDC dcMemory;
dcMemory.CreateCompatibleDC (&dc);
CBitmap* pOldBitmap = dcMemory.SelectObject (&cbitmap);
CRect rect;
GetClientRect (&rect);
dc.StretchBlt(0, 0, rect.Width(),pbm.bmHeight,
&dcMemory,
0, 0, pbm.bmWidth, pbm.bmHeight, SRCCOPY);
dcMemory.SelectObject (pOldBitmap);
}
}
|
|
|
|
|
You may try moving your drawing code to CPropertyPage derived classes.
|
|
|
|
|
Morning,everybody !
why doesn't this code use option "/O2" in VC/VS2003 compiler, it can print "Error".
but if you use "/Od" , it doesn't print Error. why ???
#include <stdio.h>
int main()
{
static const int T[1] = {0};
int n = 0;
for(int i = 536000000; i < 536000004; ++i)
{
if(i < 0)
{
printf("Error is %d\t%x\n",i,i);
break;
}
if(i >= 0 && i < 1)
n += T[i];
}
printf("end\n");
return n;
}
Thanks for your reply !
Best Reguards !
|
|
|
|
|
Appears to be a compiler bug.
It disassembles to:
; 12 :
; 13 : for(int i = 536000000; i < 536000004; ++i)
00003 b9 00 b6 f2 1f mov ecx, 536000000 ; 1ff2b600H
00008 b8 00 d8 ca 7f mov eax, OFFSET FLAT:_?T@?1??main@@9@4QBHB+2144000000
$L585:
; 14 : {
; 15 : if(i < 0)
0000d 3d 00 00 00 00 cmp eax, OFFSET FLAT:_?T@?1??main@@9@4QBHB
00012 7c 25 jl SHORT $L599
|
|
|
|
|
wangningyu wrote: but if you use "/Od" , it doesn't print Error. why ???
Because /Od suppresses code movement, the compiler likely removed the if() block since it detects i is never less than 0 .
"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
|
|
|
|
|
This appears to be fixed in newer compilers.
|
|
|
|
|
|
VC6/VS2003 are old compilers and so I don't think the bug is "new".
|
|
|
|
|
|
Here's some code:
View declaration:
class CCookItDBView : public CRecordView
{
enum{ IDD = IDD_COOKITDB_FORM };
CMyDB* m_pSet;
// Attributes
public:
CCookItDBDoc* GetDocument() const;
void InsertItemsIngred();
void SetExtendedIngred();
void SetColumsIngred();// gives error at runtime NOT Compile time
// Operations
public:
// Ingredients LC
CListCtrl m_cIngred_LC;
CRecipeDataVec m_vRecipe;
CRecipeData m_cRecipeData;
.....
};
void CCookItDBView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_INGRED_LC, m_cIngred_LC);IDC_INGRED_LC is the List Control and m_cIngred_LC is it's varable
// you can insert DDX_Field* functions here to 'connect' your controls to the database fields, ex.
// DDX_FieldText(pDX, IDC_MYEDITBOX, m_pSet->m_szColumn1, m_pSet);
// DDX_FieldCheck(pDX, IDC_MYCHECKBOX, m_pSet->m_bColumn2, m_pSet);
// See MSDN and ODBC samples for more information
}
void CCookItDBView::SetColumsIngred()
{
//CString csWorkDate = "";
CString csAmt = "Amount:";
CString csUnit = "Unit:";
CString csIngred = "Ingredients:";
// insert two columns (REPORT mode) and modify the new header items
CRect rect;
m_cIngred_LC.GetClientRect(&rect);// gives error at Runtime NOT compile Time
int nColInterval = rect.Width()/7;
m_cIngred_LC.InsertColumn(0, csAmt, LVCFMT_LEFT, nColInterval*2);
m_cIngred_LC.InsertColumn(1, csUnit, LVCFMT_LEFT, nColInterval*2);
m_cIngred_LC.InsertColumn(2, csIngred, LVCFMT_LEFT, nColInterval*2);
}
A C++ programming language novice, but striving to learn
|
|
|
|
|
Where are you calling SetColumsIngred from.
You cannot call it from the dialog constructor.
It has to be called From the OnInitDialog function.
|
|
|
|
|
void CCookItDBView::OnInitialUpdate()
{
SetColumsIngred();
m_pSet = &GetDocument()->m_CookItDBSet;
}
ass you can see, I am calling it from the CRecordView class (see previous header code)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Set a breakpoint in OnInitialUpdate and single step into SetColumsIngred .
|
|
|
|