|
You may want to try calling SHFileOperation() (use the "print " action) from your console app. You'll need to link with shlwapi.lib (and possibly other libs).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
How to monitor the folder in the MFC.Suppose the new file is come to that folder ,it indicate the file name.Please Urgent .Help me
Sunsen
|
|
|
|
|
sunsen wrote:
How to monitor the folder in the MFC
This Api Will Help :- ReadDirectoryChangesW
Here is an Article, that might help you :-
http://www.codeproject.com/file/directorychangewatcher.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
There's also FindFirstChangeNotification() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Okay, I don’t get it. Perhaps someone can help me out a little. I set up a client / server over Winsock no problems. But once a client receives the data from the server what’s the best way of storing that information for later use?
Here is an example of the type of data I'm receiving at the client end
WorkOrder | Date | SiteNumber | SiteContact | SitePhone | Device | Summary | Comments
00001 | 07/09/05 | 0001 | Joe | 111-111-1111 | 1 | Test | Test
00002 | 07/10/05 | 0001 | Jane | 111-111-1111 | 0 | Test2 | Test2
Etc
The number of rows is variable (depending on how many service calls exist). I started using a simple pointer to a struct. But that “feels” messy, is there a better way? I know there are several different types of single dimension arrays in C++, but I have yet to find a multi-dimensional array.
Any pointers anyone? Hope My post was clear. Thank you for you time and consideration.
-------------------------------
|
|
|
|
|
sfdougl wrote:
I started using a simple pointer to a struct. But that “feels” messy, is there a better way?
Why are you going after OLD C method such like creating your own link list and other collection, when there are dozens of Collection classes available in market such as STL or MFC Collection classes, that are much more optimized and fast.
You just have to implement you structure in that collection classes!.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote:
Why are you going after OLD C method such like creating your own link list and other collection, when there are dozens of Collection classes available in market such as STL or MFC Collection classes, that are much more optimized and fast.
You just have to implement you structure in that collection classes!.
I knew I was doing something wrong. That’s why I stopped at a certain point and said wait a minute, there has to be a better way. Can you point me to something explaining structures in collection classes?
Thank you
-------------------------------
|
|
|
|
|
Look for the STL (Standard Template Library) collection classes. The vector class behaves like a dynamically expandable array, if you want linked list like behaviour, there is the list class and so on. Using those classes is very simple.
vector <YourStruct> v;
You can then use methods on v to add and remove elements from the collection.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Sorry if I'm being a little dense here but still not clear. I understand that Arrays, Vectors, Linked Lists are all good for housing data. The thing I need is multiple columns.
If I may be so bold to speculate but to do what I need would I create a class to wrap together the collections and access the data via member functions? Or is there a pre written object?
Your example was hidden.
So could I do something as simple as?
(Sorry pseudo code here, I'm not anywhere near my developing environment)
<br />
struct WORKORDER <br />
{<br />
int WorkOrder; <br />
CString Date;<br />
Cstring SiteNumber;<br />
Cstring SiteContact;<br />
...<br />
} <br />
<br />
vector <WORKORDER> v;<br />
Referencing the data members like so
Int iWo = V[0].WorkOrder
I'm not opposed to doing a little work. I just don’t want to do work that’s well incorrect. Thanks for the help.
-------------------------------
|
|
|
|
|
Yes, you're on the right track. A vector can be used as a collection of *anything*, even a collection of vectors etc. So yes, you could store a collection of instances of your structure, so you'd get the multi column array functionality you wanted.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Ah okay, so its no where near as complicated as I was thinking.
Man, You and everyone else who helped are life savers.
-------------------------------
|
|
|
|
|
Yes, that's it. You create a structure that contains all the fields for one 'worker' (so contains all the data for one 'row'). And then you can use the vector:
std::vector<WORKORED> YourVector;<br />
WORKORDER Data;<br />
YourVector.push_back(Data);<br />
Then, to retrieve one data of the vector:
WORKORDER Data = YourVector[0];
Then you can work with the structure.
|
|
|
|
|
cedric moonen wrote:
Yes, that's it. You create a structure that contains all the fields for one 'worker' (so contains all the data for one 'row'). And then you can use the vector:
std::vector<workored> YourVector;
WORKORDER Data;
// Fill Data
//
//
YourVector.push_back(Data);
// Fill other structures
//
//
Then, to retrieve one data of the vector:
WORKORDER Data = YourVector[0];
Then you can work with the structure.
Perfect! Just what I needed to make the necessary connections in the old Gray matter.
Thank You, Cedric.
-------------------------------
|
|
|
|
|
sfdougl wrote:
Can you point me to something explaining structures in collection classes?
Yeap, just check out this link :-
http://www.codeproject.com/vcpp/stl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks for the reading material. Your help is appreciated.
-------------------------------
|
|
|
|
|
ThatsAlok wrote:
sfdougl wrote:
Can you point me to something explaining structures in collection classes?
Yeap, just check out this link :-
http://www.codeproject.com/vcpp/stl/[^]
I found an article in the STL that explains Vectors quite well. Thought I would post it in case some else has this same problem.
A Presentation of the STL Vector Container - STL[^]
Thanks Everyone for you help.
-------------------------------
|
|
|
|
|
Alright, I'll take a stab.
The most simplistic form of a record is that provided by an C-structure, it has the advantage of being a fixed size (speed of access). It also means that it may waste memory, because irregardless of the actual size required, you have to allocate enough memory to store (a fixed size for) each record..
You can create a class that reads a record on a per-field basis....
I am sorry, but I can't explane more at this time (it is almost 4AM and my brain just locked up).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
John R. Shaw wrote:
The most simplistic form of a record is that provided by an C-structure, it has the advantage of being a fixed size (speed of access). It also means that it may waste memory, because irregardless of the actual size required, you have to allocate enough memory to store (a fixed size for) each record..
Thanks John,
If I understand your post correctly that’s more or less what I did initially to solve the problem. A struct controlled by a class, but it just “felt” incorrect.
John R. Shaw wrote:
I am sorry, but I can't explane more at this time (it is almost 4AM and my brain just locked up).
Don’t worry, I have been toiling over this for a few days now. I'm in no real hurry, the boss is used to me laughing at his ridiculous deadlines.
Thanks for you input.
-------------------------------
|
|
|
|
|
|
Okay, will do, Thanks Ravi
-------------------------------
|
|
|
|
|
create a new mfc sdi project, in onDraw fuction add the following:
pDC->SetDCPenColor(RGB(0,0,0));
when compile, this error happens:
error C2039: 'SetDCPenColor' : is not a member of 'CDC'
according to msdn, CDC has this member. when i input these, there is even a auto completion.
how could this happen?
|
|
|
|
|
Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Unsupported.
1) Are you using Win 9x?
2) The code for SetDCPenColor is wrapped using
#if (_WIN32_WINNT >= 0x0500)
so you'd need to set the _WIN32_WINNT constant to at least 0x0500 (which should be the constant for Win2K) in the stdafx.h file in your project.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENS
|
|
|
|
|
set 0x0500 works.
thanks.
|
|
|
|
|
What version of the IDE are you using, because SetDCPenColor() does not exist.
CPen pen(PS_SOLID,1,0);
CPen* pOldPen = pDC->SelectObject(&pen);
... draw something
pDC->SelectObject(pOldPen)
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Ok- basic question:
Ive downloaded source files and the accompanying .ocx file for use in a basic visual c++ project. The .ocx file works.
Now- when i edit the source files a bit to add new functuality, how the heck do I recompile them using visual studio into a brand new .0cx file??? Im lost on this aspect.
rich
|
|
|
|