|
hi,
as CPallini stated, please first read the Posting Guidelines[^].
then edit (not repost) your message consequently.
now, a question.
why are you declaring dlg (which is not even initialized) ?
is the list you want to add items into located in another dialog ?
if it's not, just replace dlg by this (or remove it, it will be implicit). otherwise, you have to rethink your technical design. things cannot be done like this.
|
|
|
|
|
WHY oh WHY did you deleted your post ????
are you that selfish to ask a question on a forum and not to share the answers ?
I told you to edit your message, not to repost a new one, but that was obvious to me that i wasn't at all telling you to move out (with your question !).
when I told edit your message, it meant to put the code sample into <pre></pre> tags...
come on, please edit your message again !
thank you for editing.
now please reply my first post, because i don't understand what dlg is there for...
modified on Thursday, July 31, 2008 4:10 AM
|
|
|
|
|
ab_pq wrote: dint work
No surprise there. Where do you call DoModal() ? Why are you calling AddString() on a control that does not exist?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
i have made a sdi application, but have changed its menu bar. my problem is when i press ctrl+s save as window pops up.
How can i remove this shortcut working.
Thanks in advance
|
|
|
|
|
VCProgrammer wrote: my problem is when i press ctrl+s save as window pops up.
How can i remove this shortcut working.
Goto your resource tab, open "Accelerator" resource, delete the line ID_FILE_SAVE Ctrl + S VirtKey, and recompile.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi all,
How can i know a purticular file exist at selected location?
For example:: test.txt is a file, i want to save it in MyDocuments.
so, how can i check before saving of test.txt, test.txt is exist in MyDocuments or not.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I already told you it can be done by using FindFirstFile API. If the file does not exists INVALID_HANDLE_VALUE is the return value else you get a handle to the file.
Why a new thread is needed to post a query?
The previous thread was not too long [That of - Only copying done not replacing in SHFileOperation !!!]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
CString m_strFile = _T("C:\\path\\to\\file.txt");
if (::PathFileExists(m_strFile)) {
}
else {
}
|
|
|
|
|
The "classic" Win32 way (without MFC):
1. use GetFileAttributes()
2. check the return value
3. if it is 0xFFFFFFFF then check what
4. GetLastError() returned (if the file does not exist, it would be ERROR_FILE_NOT_FOUND )
|
|
|
|
|
Have you tried _access() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi Friends
I need your help...in MFC
How to create Address book in MFC?
Regards
Nisha
|
|
|
|
|
One of the options would be to take the input from the UI entered by the user and put it into the database. The database would contain tables to store the information for a contact.
You can also use a file to store the information or XML.
There are many a ways you can do this. you need to figure out what fits your problem description, complexity and what would be the size of the address book
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
nisha00000 wrote: How to create Address book in MFC?
Possibly programming.
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]
|
|
|
|
|
CPallini wrote: Possibly programming.
Very Iainesque!
Iain.
|
|
|
|
|
Trying to emulate the master.
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]
|
|
|
|
|
nisha00000 wrote: How to create Address book in MFC?
An address book in general, or the Windows Address Book (wab.exe)?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have a list control. Now i want that my list control should show two properties simultaneously :-
i) alternate row colour
ii) when i run my thread it should display green or red colour
i have code for exibiting both propertirs but they are not working simultaneously......
code for displaying alternate ro colour is as follows:
*void CColoredListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
int iRow = lplvcd->nmcd.dwItemSpec;
switch(lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT :
{
*pResult = CDRF_NOTIFYITEMDRAW;
return;
}
case CDDS_ITEMPREPAINT:
{
lplvcd->clrText = RGB(0,0,0);
*pResult = CDRF_NOTIFYSUBITEMDRAW;
return;
}
case CDDS_SUBITEM | CDDS_PREPAINT | CDDS_ITEM:
{
if(iRow %2){
lplvcd->clrTextBk = m_colRow2;
}
else{
lplvcd->clrTextBk = m_colRow1;
}
*pResult = CDRF_DODEFAULT;
return;
}
}
}
and for displaying color at runtime is as follows
void CColoredListCtrl::OnCustomDraw ( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
{
COLORREF clrNewTextColor, clrNewBkColor;
int nItem = static_cast<int>( pLVCD->nmcd.dwItemSpec );
CString strTemp;
if(http_list == 1)
strTemp = Obj_Http->m_Main_List.GetItemText(nItem,pLVCD->iSubItem);
else if(smtp_list == 1)
strTemp = obj_SmtpNew->m_SmtpList.GetItemText(nItem,pLVCD->iSubItem);
else
strTemp = Obj_SP->m_SP_List.GetItemText(nItem,pLVCD->iSubItem);
if(strTemp == "OFFLINE")
{
clrNewTextColor = RGB(0,0,0);
clrNewBkColor = RGB(255,0,0);
}
else if(strTemp == "ONLINE")
{
clrNewTextColor = RGB(0,0,0);
clrNewBkColor = RGB(0,255,0);
}
else
{
clrNewTextColor = RGB(0,0,0);
clrNewBkColor = RGB(255,255,255);
}
pLVCD->clrText = clrNewTextColor;
pLVCD->clrTextBk = clrNewBkColor;
*pResult = CDRF_DODEFAULT;
}
}
i want to merge these two piece of code but not getting the way...
How can i do this....
|
|
|
|
|
I'm not sure I'm seeing your problem.
One section of code is using switch (lplvcd->nmcd.dwDrawStage) { case XXXX: , and the other is using if (lplvcd->nmcd.dwDrawStage == XXXX) else if... but that should hardly be a challenge.
So your last case statement gets bigger?
Another thought you could have...
Why not keep your code? If each works in clearly separated circumstances, try:
void CColoredListCtrl::OnCustomDraw ( NMHDR* pNMHDR, LRESULT* pResult )
{
if (Am_I_in_a_thread ())
OnCustomDrawThreaded (pNMHDR, pResult)
else
OnCustomDrawNotThreaded (pNMHDR, pResult)
}
and just rename your two functions!
Iain.
|
|
|
|
|
Hi all,
I m taking help of this article for Coying file of Fileoperation.
http://www.codeproject.com/KB/shell/cshellfileop.aspx?msg=2655963#xx2655963xx[^]
But there is only one problem when i copy one file from one location to another if it is already exist than it not replace it,and create another copy.
How can i stop making no. of copies when file already exist.
I want the file is exist than it gives message for replacing and than replace the file.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Use FindFirstFile to check if the file is already existing at the desired location. If it exists display a message box with Yes/No buttons. If the user clicks yes, delete the file and then use CopyFile/SHFileOperation
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
"_$h@nky_" wrote: But there is only one problem when i copy one file from one location to another if it is already exist than it not replace it,and create another copy.
Are you using the FOF_RENAMEONCOLLISION flag?
"_$h@nky_" wrote: I want the file is exist than it gives message for replacing and than replace the file.
Assuming you are just going to respond in the affirmative to that message, have you tried the FOF_NOCONFIRMATION flag?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm starting a service that is dependent on a dll.
On doing so I get the below error
The procedure entry point XXXX could not be located in the dynamic link library LLLL.dll
The service and other related binaries are the release binaries while the dll that is copied is a debug one. I have also copied all the debug dependent dlls in the folder without avail.
Should the dll be also release to solve this problem.
|
|
|
|
|
the only way a release build will fix it is if the release build exports different functions than the debug build does. that would be unusual, though not impossible.
but, i'd look at the DLL and see if it's actually exporting the missing function or not, first.
|
|
|
|
|
Visual C 6 comes with a handy program called depends.exe. Use it and look at your executable, and it will look at dlls it depends on, and give you nice red exclamation makrs if there are problems.
I'd be shocked if later versions didn't come with an equivalent tool. I'd be surprised if they didn't come with the *same* tool. It works rather well.
Iain.
|
|
|
|
|
Iain Clarke wrote: I'd be shocked if later versions didn't come with an equivalent tool.
Through 2005 it does. Although there is no Start menu entry for it and it's buried in folder structure under Program Files so using a Search is about the only way to find it.
led mike
|
|
|
|