|
I don't think there is a universal standard for this. I don't really care what conventions you use inside the code. If I were buying it, I would mainly like to see consistency.
If the library is an improvement/replacement for an existing library, make the API as compatible as possible.
I don't think you can build a single .dll. Even if you manually constructed a file with 4 entry points for each function, there would be no way to resolve which entry point to use, since the call gives no indication of the mode it was built in.
P.S. What sort of library are you building? Is it for public consumption or internal use. Will it be fore sale?
Good luck,
Bill
|
|
|
|
|
This is probably going to make some of you laugh but here goes
I have a dialog base MFC app with a list control in report view. How can i copy the data in the list view class to another list view class in a child window? I have the child window pop up mapped to a button event. Would i have to create a loop to copy the data? or is there a faster way. Please help, Thanks!
|
|
|
|
|
|
If you use the item data field of each list control entry, you could quickly copy just the item data instead of all the column text. In general, this is a better design pattern (Model-View) than stuffing text in a list control. In other words, a list control should know how to render itself based on the data model.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Well, I am using the LV_ITEM datatype for the list. So I guess I should make it into a member variable and access it through scoping?? But wouldn't I still have to get the number of items and loop through inserting each one? I'm not quite understanding your suggestion ravi Can you please be a little more specific, like including a declaration example and how I should initialize my child diag class and/or duplicate list view class. Thanks for the replies!!
|
|
|
|
|
Ravi Bhavnani wrote:
If you use the item data field of each list control entry, you could quickly copy just the item data instead of all the column text
But this is assuming that he has only one column of data. What if he has 2 or more cols?
Nish
My most recent CP article :-
A newbie's elementary guide to spawning processes
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
But this is assuming that he has only one column of data.
Actually, no. The item data is just a pointer to a blob of data that can be rendered in any manner in the list control. For example, the item data could point to a CMumble object that has multiple members, each rendered in a column. This is how Java's Table UI widget works. It's nice and clean because it separates the data model from the rendering.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
so how exactly should I declare this item data type?? I looked around MSDN and it seems like my LV_ITEM datatype is not quite the same as what you are talking about ravi. How should I declare that kind of datatype and some example of how to use it would be awesome! Thanks for all the comments!
|
|
|
|
|
You can associate application specific data with items in a list control by calling CListCtrl::SetItemData() . Typically, the item data (a DWORD ) is a pointer to an object whose information will be rendered by the list control for that row.
Aside:
The object represents the "model" and the list control (whose only job is to render items and be responsive to mouse and keyclicks) represents the "view" and "controller" in the MVC (model-view-controller) design pattern.
Your (owner drawn) list control will display the appropriate information in each column based on the item's data. When you want to copy chunks of one list control to another (or even within the same list control), all you need to do is to update the target list control's item data for the appropriate rows and invalidate the list control (to force a redraw). You don't need to copy the actual column data of the rows being copied.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
That's a really cool solution! I seemed to have missed that member function looking through MSDN . That should solve my problem, thanks for everyone's help!
|
|
|
|
|
|
Does anyone have any idea how to get an HICON to a SPECIFIC RESOLUTION icon... I want something similar to ::LoadIcon(...) but it won't let me specify the res that i want. The only thing i found that will even do this is ExtractIconEx but that only works on a file and it would be pretty stupid to extract icons from the running exe... This is very annoying.. anyone got any ideas?
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
LoadImage()
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
how to draw a XOR line use GDI+
thanks to all the programmers who have helped me.
|
|
|
|
|
How should implement clipping?
I'm currently using ExcludeClipRect() and it works, but i'm curious to know if theres any other way..??
Thanx Again!!!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Well... What do you need to clip?
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
I want the the reverse effect of the fore-mentioned function. I want to specify rect and have only drawing operations visible ONLY inside that rect.
using the current functions i'd have to call it 4 times to form a border around a clipping rectangle...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Call CreateRectRgn on the region that you want to clip to, then call SelectClipRgn with the region.
|
|
|
|
|
Try IntersectClipRect().
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
How do I call a public member function in a CView derived class when using the doc/view arch...???
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
If I'm understanding you correctly, shouldn't it be done this way?
CMainFrame *pFWnd = (CMainFrame *)AfxGetMainWnd();
CMyCView *pView = (CMyCView *) pFWnd->GetActiveView();
pView->SomeFunction(strEatData);
Hope that helped.
|
|
|
|
|
I wanted to be able to call the function from the menu handler in CWinApp, but this should work as well.
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
It should as long as your frame has been created and the view is attached to it before you call the function.
|
|
|
|
|
Check this
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I am trying to write some scripts in VB for use in VC6 and have run into two problems (what only TWO ? )
Config
--------------------------------
XP Home, MSVC6, Windows Script Debugger, Windows Script 5.5
Service Pack 5 for VC6 (before that it would even crash the IDE when you tried accessing files. Bah !)
Problems
--------------------------------
1. Object Required: 'WScript'
This code, run as a VC macro gives the above error:
MsgBox WScript.ScriptFullName
Saved in a text.vbs and double clicked on the same computer, same code works fine (so I know I have the right libs/registry settings for scripting)
What is wrong with the VC VB runtime environment ? Why can't I access WScript ? I read somewhere else that "for security purposes" some aspects of the VB runtime were disabled in VC and this could be registry hacked.
Well if necessary, I'll do that. Does anyone have ideas ? Does code containing WScript calls work in your VCVB macros ?
2. The object model is half-baked
I don't know who designed the object model for the add ins but they must have stopped right in the middle of it ! You can't iterate over the files in a project ? Or set attributes per file ?
Is there a workaround for this half-assed job ? Has someone built a C++ addin that exposes this extra functionality to the scripting engine somehow ? Or do I really have to parse through dsp files (please no)
Your help is much appreciated - I just found this site tonight after googling for answers to the above - it is awesome !
Thanks in advance
Robert
|
|
|
|