|
VanHlebar wrote:
If I have to include the .lib file for each dll won't I have to recompile the project each time I add a new dll?
yes. since you're linking to the static lib, your app will have the DLL name encoded into it somewhere.
it sounds like you're doing a plug-in system. (click here to learn more! )
if that's the case, what you need to do (IMO) is to write an interface layer between the DLLs and the code that calls the DLL. this layer will act as a proxy between your DLLs and the caller. in addition to allowing a way to call the DLL functions, it will handle DLL loading and unloading. your app can just scan a folder (or whatever) and get a list of DLLs that support your interface (just GetProcAddr for all your calls; if they're all there, the DLL is good, add it to the list).
make that proxy layer a class and instantiate one per DLL. put them all in an array and you're all set
-c
I'm not the droid you're looking for.
|
|
|
|
|
Chris Losinger wrote:
it sounds like you're doing a plug-in system. (click here to learn more! )
Chris,
I clicked but didn't go anywhere Yes it is sort of a plug-in system. The user will be able to get the extra dlls and choose which ones they want to use and which ones not to use.
I like the idea of being able to instantiate one class per dll and having an array, but I guess I would need more information on how to do just that.
Thanks for the help,
-Eric
|
|
|
|
|
somethign like this:
class CMyProxy
{
public:
CMyProxy();
~CMyProxy();
bool Load(const char *pDLLName);
RetType MyFunc1(...) {return (m_pFunc1)(...);}
RetType MyFunc2(...) {return (m_pFunc2)(...);}
protected:
FuncType1 m_pFunc1;
FuncType2 m_pFunc2;
};
CMyProxy proxy;
if (proxy.Load(pDLLFileName))
{
RetType ret = proxy.MyFunc1(whatever, whatever);
}
so, the CMyProxy class loads the DLL, gets function pointers and lets you call DLL functions through its own function wrappers.
-c
I'm not the droid you're looking for.
|
|
|
|
|
This article Plug-In Architecture.asp[^] of mine does what Chris is suggesting. Its probably overkill for your current situation, but you should be able to cut out the bits you needs and modify them to what you require.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Does anybody know a way to programmatically lock the computer's desktop or the user interface? Maybe system modal dialogs? Is there any way to use them in windows nt/9x?
/regards/
|
|
|
|
|
|
This isn't suitable. I need to lock the interface and unlock it programmatically, I don't want to let user to unlock the station by standard system means.
I think it could be possible by using system modal dialogs, but I'm not sure whether they are supported in Win32 or not and how to implement them.
/regards/
|
|
|
|
|
Hi,
I transferred a project from VC++ 6 to 7. This is a static library.
The library produced by VC++ 7 is twice bigger than with VC++ 6 (either in release or debug mode).
Is there something to tune there or is it normal ?
Thanks for your help. I really need to know the how and why because I release these libraries in a setup package and I don't want it to grow so much.
Nicolas
|
|
|
|
|
|
I have
double Total = 0;
Total += GetSubTotal(m_edit1);
Total += GetSubTotal(m_edit2);
...
sprintf(buf, "%.2f", Total); CString str = buf;
Lets say the total is a million. Then str
is 1.00e+006 which is bad. How can I get it
to display normal numbers and not this exponential?
Please, any response any one can give me will
be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
try "%10.2f". with no width spec, its acting like g instaed of f.
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
You could format CString before as:
double Total;
str.Format(_T("%12.2f"), Total);
|
|
|
|
|
This might be an easy question for someone out there. I put together some code so that a user can go out and select a custom program (like WinAmp, WMP, solitaire, freecell, anything that is an .exe file) and it puts the icon for that program on a toolbar and when pressed, it calls the .exe file. What I would like to do is put the program name, up to 8 chars anyway, under the icon. I was wondering if anyone knew how to get the program name from the properties of the .exe file. Right now, I use the filename but in cases like solitaire, it just puts SOL. Does anyone know how to retrieve the properties so I can determine what the application name is?
If possible, I need help in 2 areas. This will go into 2 apps, one is written in C and the other in C++/MFC. Can you help???
|
|
|
|
|
I would like to embed a video clip into a MFC dialog -- basically, I would like to embed or wrap the "functionality" of Windows Media Player into my dialog. Can you help with this?
I have looked through the numerous pages/articles here at CP and have even used the example in CAnimateCtrl before, but I haven't found what I want.
My video clip may come in the form of:
1) AVI uncompressed
2) AVI compressed
3) MPEG file (mpeg4 ? for video???)
What I want is the effect of a "picture-in-picture". I want a few controls that work with the video clip (start/stop, pause). I would also like for the controls of the clip to work with the dialog itself. If I press "pause" on the Video's control, I want my dialog to recognize that "pause" command was issued -- this is for synchronizing activity from either the video clip to dialog or vice-versa.
Thank you for helping and pointing me in the right direction.
Johnny
|
|
|
|
|
DirectShow is what you want. It's part of DirectX. You can basically embedd an instance of Media Player in your app.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
What's the message when a CSliderControl ?
For Buttons, there's BN_SETFOCUS, for edit box, EN_SETFOCUS, so what's the one for the slider control ?
I need to handle when a slider control gets the focus.
Do I need to have a WM_NOTIFY for it if it doesn't exist ?
Thanks.
Max.
|
|
|
|
|
|
|
I'm trying to implement a dynamic menu system to my program. Currently, i can add and remove the items from the menu, and make the menu items run code that i've premade.
for example i can add "section 1" to a section menu, while associating ID_SECTION_1 to the command in the menu. This will call my OnSection1() code when this command is executed.
I want this to be boundless (i.e. i dont want to have to make code for OnSection2, OnSection3, OnSection4... , or the strings in the string table, and so on.) I can currently bind each new menu item to the same id, for example section 1, section 2, and section 3 all run the OnSection() command which is bound to ID_SECTION. What i cannot do, is figure out how to determine which of the 3 i called. I would like to basically get the location of the last menu choice i picked, so if section 2 is in the second spot on the menu, i want to know this when i call OnSection().
Any ideas?
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
why dont u store the currently displayed option on the menu as a numeric index somewhere and use a switch staement in the code to determine what to do?
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
How can i get the currently displayed option?
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
well ur setting the menu text right?
so save a value somewhere else when u change the menu text that lets u know which option is showing
?
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
Many options will be showing, and i basically need to record the actual text that shows up in the menu. I cannot save the index value when i set the menu text, because i do not know which item will be chosen. I want the menu text simply to help me figure out which one i actually chose.
For example
File Edit Sections
->Section 1
I do something and create 3 more sections at runtime modifying the menu.
Now the menu looks like this
Sections
->Section 1
->Section 2
->Section 3
->Section 4
Each Menu choice is bound to ID_SECTION.
ID_SECTION corresponds to OnSection()
In my code:
void OnSection()
{
int section;
// I need to fill the section variable with
// the index of the item i picked from the menu
// since all of them have the same ID.
If(section==1)
handle section 1
If(section==2)
handle section 2
If(section==3)
handle section 3
If(section==4)
handle section 4
}
Hopefully this helps.
Thanks.
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
You should be able to use GetCurrentMessage() and interrogate the wParam/lParam values to get the actual command ID of the menu option selecetd.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Hello,
I need to be able to get the Serial Nº of my hard disk in order to be able to make my programs to run only in the hard disk that I want them to.
I'm using this code:
DWORD dwNumSerie = 0;
UpdateData();
GetVolumeInformation((LPCTSTR)this->m_vedPath,NULL,0,&dwNumSerie,NULL,NULL,NULL,0);
this->m_vedNumSerie.Format("%d",dwNumSerie);
UpdateData(FALSE); How do I can be sure that the code works?
As a parameter I've written down a "\" (backslash only) in an editcontrol (m_vedPath variable is a CString linked to that EditCtrl).
Is that parameter right in order to get info. of the local HDD?
Thank you in advance.
NOTE:
I've received a - number in my laptop and a positive one in other PC.
|
|
|
|