|
CFileFind is based on a Win32 API. To do it w/out MFC, use something like this:
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(strCurrentPath + m_szREPORT_FILTER, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
} while ( FindNextFile( hFind, &FindFileData) );
FindClose(hFind);
}
--------
Life is fraught with opportunities to keep your mouth shut. --Shog9 --
|
|
|
|
|
You could also use _findfirst() , _findnext() and _findclose() .
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
CFileFind is supported by ATL so a pure Win32 API project should support CFileFind.
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
Is there an equivalent of CString FormatMessage for STL strings and wstrings?
thanks
|
|
|
|
|
nope.
-c
Cheap oil. It's worth it!
|
|
|
|
|
None that I am aware of. However you can use sprintf.
Best regards,
Alexandru Savescu
|
|
|
|
|
I am trying to create a fstream member function. However, no luck !
I am using VC bw..
this is what I have
yyyy.h
#include <fstream>
class x
{
public:
protected:
ofstream of;
};
that's all.... and I get the following error:
error C2872: 'ofstream' : ambiguous symbol
However, when I move the same declaration to the cpp file, everything works?
So, how do I go about creating a member variable for a file pointer?
thanks
|
|
|
|
|
A note about your post :-
<fstream> would not work on the subject line. As it is HTML.
The answer
Include only the file fstream. Do not include "fstream.h" if you are doing that. Then you need to prefix
#include <fstream>
class x
{
public:
protected:
std::ofstream of;
};
Prefix with std.
|
|
|
|
|
Hem Rama, how did you manage to read the post ???
~RaGE();
|
|
|
|
|
1. View->Source
2. Find Reply URL
3. Type the reply URL on the address bar
|
|
|
|
|
I give you points for enginuity
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
Could you Would you with a goat? - Dr Suess
|
|
|
|
|
click on the title of the article and hit tab
the real question is why we would go through such work to read a post
-dz
|
|
|
|
|
dazinith wrote:
click on the title of the article and hit tab
That's far more simpler.
dazinith wrote:
the real question is why we would go through such work to read a post
The guy did not do it purposefully. It's a mistake which happens everynow and then
|
|
|
|
|
Rama Krishna wrote:
The guy did not do it purposefully. It's a mistake which happens everynow and then
If he is annonymous because he is new, he probably did not realize the situation with HTML.
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
Could you Would you with a goat? - Dr Suess
|
|
|
|
|
I can't build the DAOSDK\SAMPLES\addrbook with VC++ 7.0 . I have got this error message.
c:\inetsrv\scripts\Addrbook.dll : fatal error LNK1120: 1 unresolved externals
"public: class ATL::CStringT<char,class strtraitmfc<char,class="" atl::chtraitscrt<char=""> > > __thiscall CdbLastOLEError::GetDescription(void)"
Thanks
Feri
Feri
|
|
|
|
|
I have got a MDI application. Now I want to add a view to a document apart from the one that is given to me by the wizard. I have inserted a menu File->SwitchView where I want to give a different view of the same data in the doc. Below is my code for handling 'Switch View' but seems like its not working. Will you please let me know what wrong I am doing.
void CMainFrame::OnFileSwitchview()
{
// TODO: Add your command handler code here
CView* pViewAdd = NULL;
CView* pViewRemove = NULL;
CDocument* pDoc = GetActiveFrame()->GetActiveDocument();
if (m_pView == NULL)
{
m_pView = new CNewView();
m_pView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,rectDefault, GetActiveFrame(), AFX_IDW_PANE_FIRST + 1, NULL);
pViewAdd = m_pView;
pViewRemove = GetActiveFrame()->GetActiveView();
}
int nSwitchChildID = pViewAdd->GetDlgCtrlID();
pViewAdd->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
pViewRemove->SetDlgCtrlID(nSwitchChildID);
pViewAdd->ShowWindow(SW_SHOW);
pViewRemove->ShowWindow(SW_HIDE);
// Connect the newly active view to the document, and
// disconnect the inactive view.
pDoc->AddView(pViewAdd);
pDoc->RemoveView(pViewRemove);
GetActiveFrame()->SetActiveView(pViewAdd);
RecalcLayout();
}
m_pView is the one I am trying to view.
Thanks in advance. Looking fwd to a solution. BTW I know the way it is to be handled in SDI.. its the MDI which is giving the trouble.
Thanks again,
Sudip
|
|
|
|
|
Check out this CodeProject article:
http://www.codeproject.com/docview/replacingview.asp
|
|
|
|
|
Just some pointers (ooh I made a C++ joke... :rolleyes) or a tip or two would be helpful. I can figure it out once I get shown the start of the path
I am trying to return more than one result at a time from the CP Webservice and storing them into what I would call an array. Not sure what you call it in C++. Calling the webservice is fine, I have managed to pass it the input parameteres it needs. It is getting out all the results in one go that is troubling me. Right now my code returns it variable by variable, with a call to the webservice for each result and variable! Not very good at all.
I managed to do this:
__gc struct ArticleBriefs
{
public:
String* URL;
String* Title;
String* Author;
String* Posted;
String* Updated;
String* Status;
String* Description;
};
And I managed to load it one at a time like so:
LatestBrief* proxy = new LatestBrief();
ArticleBriefs* cArticles = new ArticleBriefs();
cArticles->Author = proxy->GetLatestArticleBrief(iNumArticles)[0]->Author;
...
However that is not an array (though obviously the right hand bit is an array, but I cannot transfer it over to the left hand, ya see?)
So my simple question is how do I turn that struct into an array and then how do I return the multiple values from the GetLatestArticleBrief web service method into the array?
*grumble* this is so easy in C# or VB *grumble*
And yes, you may laugh yourself silly at my question/code/vb-simplified-mind, I have my thick fire proof suit on
Thanks guys.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Tim Smith wrote:
Over here in the third world of humor (a.k.a. BBC America),
peterchen wrote:
We should petition microsoft to a "target=_Paul" attribute.
|
|
|
|
|
Not sure whether I understood what you want.
But this is enough
ArticleBrief* pArticles[] = proxy->GetLatestArticleBrief(iNumArticles);
You don't need new.
Paul Watson wrote:
grumble* this is so easy in C# or VB *grumble*
It would be same in C++ You can translate easily b/w C# and C++
|
|
|
|
|
Rama Krishna wrote:
ArticleBrief* pArticles[] = proxy->GetLatestArticleBrief(iNumArticles);
That is how I originally thought it was done. I even tried it but kept getting an error. However after re-reading your code I noticed that you had put down ArticleBrief and not ArticleBriefs...
Man do I feel like a mullet. I had it back to front!
Thank you very much
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Tim Smith wrote:
Over here in the third world of humor (a.k.a. BBC America),
peterchen wrote:
We should petition microsoft to a "target=_Paul" attribute.
|
|
|
|
|
ArticleBriefs cArticles[10];
code...
or...
ArticleBriefs *cArticles = (ArticleBriefs*)malloc(sizeof(ArticleBriefs) * 10);
code...
free(cArticles);
in both cases you use cArticles[0] to cArticles[9] to access the 10 items in the array
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
This will not work as ArticleBrief is a managed class.
|
|
|
|
|
Anders Molin wrote:
ArticleBriefs *cArticles = (ArticleBriefs*)malloc(sizeof(ArticleBriefs) * 10);
Thanks Anders.
Your code and Rama's code set me straight.
I think I should have stuck to unmanaged VC++ for my first foray. At least then I would have some good samples and tutorials to help me out. MC++ samples and tuts are thin on the ground.
It is working now:
ArticleBrief* cArticles[] = proxy->GetLatestArticleBrief(iNumArticles);
I had it back to front (ArticleBriefs instead of just ArticleBrief.)
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Tim Smith wrote:
Over here in the third world of humor (a.k.a. BBC America),
peterchen wrote:
We should petition microsoft to a "target=_Paul" attribute.
|
|
|
|
|
I have a CTreeCtrl with Parent nodes which have each 4 Child nodes. I´d like to associate an image on the child nodes, but not on the parent nodes. How do I manage to do that :
TVINSERTSTRUCT tvInsert;
HTREEITEM ChildItem;
CString Text;
CTreeCtrl *pOutprob;
pOutprob=(CTreeCtrl *) GetDlgItem(IDC_TREEPROB);
pOutprob->SetImageList(m_ImageList,TVSIL_NORMAL);
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = TVI_SORT;
tvInsert.item.stateMask=0;
for(i=0;i<Tree.Nb_Vars();i++)
{
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText =(unsigned short *)Text.operator LPCTSTR();
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
ChildItem=pOutprob->InsertItem(&tvInsert);
tvInsert.hParent = ChildItem;
tvInsert.hInsertAfter = NULL;
for(j=0;j<Tree.Variable_Parents[i].weight();j++)
{
tvInsert.item.mask = TVIF_TEXT|TVIF_IMAGE;
tvInsert.item.pszText =(unsigned short *)Text.operator LPCTSTR();
S_ID=pOutprob->InsertItem(&tvInsert);
pOutprob->SetItemImage(S_ID,imgnb,imgnb);
}
}
(Sorry if there is not the whole code here ) This displays an image for both parent and children .. and i do not see why ...
~RaGE();
|
|
|
|
|
Rage wrote:
pOutprob->SetImageList(m_ImageList,TVSIL_NORMAL);
To my concern the problem really is in this line of code. TreeView can either HAVE Images or HAVE NOT images ... so as soon as you declare an ImageList for the Tree it HAS images. To my opinion there's no way NOT to show images for the parent items in that case.
Crey
|
|
|
|