|
I am new into writing C++ providers.
Can anyoone let me know the basics of provider writing.
I mean I wanted to know about Provider types(Instance, Method, Indication) and why are they needed etc
What are properties, mof, cim, schema etc.
|
|
|
|
|
Providers are used to provide dynamic data which are not stored in internal datastore for the CIMOM .
More details[^] can be found in the link.
Also if you could google with "C++ provider" keyword you can get more results and channels to start.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
Thanks Anshuman I will have a look at the link.
|
|
|
|
|
|
Thanks Topcoder for the links
|
|
|
|
|
Hello Friends
I want to copy an array of Point3 object to Dynamic Array object of Point3.
I am having Point3 verts[1000],which stores point3 for some size ,say 600.
i want to copy to another Point3 object with size of 600.
Like, Point3* tempVerts = new Point3[600]
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
tempVerts[i] = verts[i]; // i would be a variable incremented each time by 1 in a loop
BTW can you use a vector<point3> rather than allocating an array dynamically if it fits your design?
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
How'bout:
Point3* tempVerts = new Point3[600];
memcpy(tempVerts, verts, sizeof(Point3)*600); ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Correct (+5)... but if it's dynamic then it would be more like (to clarify for OP)...
Point3* tempVerts = new Point3[array_size];
memcpy(tempVerts, verts, sizeof(Point3)*array_size);
|
|
|
|
|
Also correct (+5).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
thanks
|
|
|
|
|
There's a caveat to this: the data must be blittable.
Steve
|
|
|
|
|
You are right, i simply assumed that Point3 is made up of simple types like 3 coordinates stored as floats or integers, but of course this might not be the case.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
The C++ way to do this would be
copy(verts, verts + 600, tempVerts);
For this you have to add the following lines first -
#include <algorithm>
using namespace std;
You will get a warning which you can avoid by using checked_array_iterator class.
|
|
|
|
|
Thanks Everyone For Reply.
Regards
Yogesh
|
|
|
|
|
Hi all. I have an MDI application that have more then 2 kind of documents : CMy1Doc, CMy2Doc, CMy3Doc, etc. How can I know for sure if an document is already open, if yes then I bring it to foreground, if not then open it ? Thank you.
|
|
|
|
|
You would normally open your documents as a result of user action: button click, menu selection etc. So your program does not need to know whether the document is loaded, it just displays the content in the child window which the user then moves to front or back or tiled as required. Unless of course, your design is totally different from the Windows model. You might also like to consider using more meaningful names for your documents.
|
|
|
|
|
Try and open it with CreateFile[^], specifying 0 (no sharing) for the dwShareMode parameter. If the file is already open, CreateFile will return INVALID_HANDLE_VALUE and GetLastError will return ERROR_SHARING_VIOLATION.
The code below will fail, printing the value of ERROR_SHARING_VIOLATION if the file a.a is already open.
HANDLE f = CreateFile("a.a", GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (f == INVALID_HANDLE_VALUE)
{
std::cout << GetLastError() << std::endl;
return 0;
}
source: http://www.codeproject.com/Messages/3046449/Re-Check-file-is-open-or-not.aspx[^]
|
|
|
|
|
I forget to tell you that I will not serialize the documents ... In CMy1Doc I spread a CScrollView, in CMy2Doc I spread a CFormView, and in CMy3Doc I spread a CListView. So, in my application I want to open just once scroll view, form view, list view ... as I said, if one specific view is not open I need open it, if is already open then just bring it to front ...
(CMy1Doc, CMy2Doc and CMy3Doc is just sample names).
|
|
|
|
|
|
I don't think that your sample is written in MFC ... but is good to see the solution way.
|
|
|
|
|
That sample is C# - this forum is C++. Anyway it's the same method as mentioned above - i.e. try to open the file with share = none.
|
|
|
|
|
|
I made in follow way :
POSITION posTemplate = theApp.GetFirstDocTemplatePosition();
while(posTemplate)
{
CDocTemplate* pDocTemplate = theApp.GetNextDocTemplate(posTemplate);
POSITION posDoc = pDocTemplate->GetFirstDocPosition();
while(posDoc)
{
CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc);
if(pDoc->IsKindOf(RUNTIME_CLASS(CMy2Doc)))
{
POSITION posView = pDoc->GetFirstViewPosition();
if(posView)
{
CView* pView = pDoc->GetNextView(posView);
pView->GetParentFrame()->BringWindowToTop();
}
return;
}
}
}
POSITION pos = theApp.GetFirstDocTemplatePosition();
CMultiDocTemplate* pDocTemplate = (CMultiDocTemplate*)theApp.GetNextDocTemplate(pos);
if(pos)
{
pDocTemplate = (CMultiDocTemplate*)theApp.GetNextDocTemplate(pos);
pDocTemplate = (CMultiDocTemplate*)theApp.GetNextDocTemplate(pos);
if(pDocTemplate)pDocTemplate->OpenDocumentFile(NULL);
}
|
|
|
|
|
I finished my c++ code, and now I want to add forms to it.
So I used the VS2010 and created a Win32 Application, and it made a main window container for me. I have a menu bar, in which I want to click on a subject (Install Web Server), and have a window form created, and install the Web Server with a progress bar, status of events....
I'm sort of confused here, I remember in vb, we just made a form for each window we needed, and designed the graphics on it. If we wanted a MDI, we just used the properties to set the main window to MDI parent and MDI Child. I don't want to deal with the .net stuff for this project, by adding a windows form, and prefer to learn by writing it in c++.
I'm not sure about c++, it how it's done.
The question is, would that extra window be considered an MDI child window, or just a regular window.
If it's just a window, then I just create a window for each task I need?, or is the same window used over and over?
|
|
|
|