|
Thank you for your reply.
cmk wrote: A static library .lib file is not the same as a .lib file used to link to a dll.
I was under the impression that they are all static libraries... Could you please elaborate? How do I distinguish between one type of .lib file and another?
I haven't done much Windows C++ development (up until now only had to work on Linux). If you could point me in the direction where I can read a bit more about this, it would be great.
Thanks again,
Penkov
|
|
|
|
|
misha1983 wrote: I was under the impression that they are all static libraries... Could you please elaborate? How do I distinguish between one type of .lib file and another?
No, they are not all static libraries.
As i mentioned, you get different .lib files from building a project as a static lib vs a dll.
There is no obvious way to distinguish, you are usually told when you get the file(s).
If you know more about what to expect in these files then you can use a hex editor to look at their contents and tell from that, but explaining that is too involved.
You are usually either given a x.lib and told 'this is a static lib build of our x API', or you are given a x.lib, x.exp and x.dll and told 'here is our x API dll'.
Actually there is a 3rd option, you are given a x.lib, x.exp and x.exe and told 'here is our application, which exports our y API'.
Search MSDN for information on lib, e.g.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_running_lib.asp[^]
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Ok, thanks, that's cleared it up a bit. I've asked around work and managed to dig up the DLLs I needed. So that's taken care of. Thanks to both of you for helping.
Cheers,
Penkov
|
|
|
|
|
I have an Industrial PC with an Embedded Windows XP.
The Embedded Windows XP can only boot up and display a cmd.
I need to control its Digital I/O. I only have the I/O address and Interrupt of it.
At this moment, I am not sure that it has driver or not.
Can any one give any suggestion to me?
Please help!
|
|
|
|
|
If it can only boot up to a prompt then it sounds like the kernel has been built from a reduced sub-system set - sucks for you, sorry.
You would have to look-up any shell commands to query the device sub-system for an appropriate driver, if none exists then you'd have to write one.
I'm suprised you haven't been given an API for the device, or at least told more about the system, makes it tough to help.
The MSDN embedded site has some info on writing device drivers if i remember right:
http://www.microsoft.com/windows/embedded/default.mspx[^]
...cmk
Save the whales - collect the whole set
|
|
|
|
|
In fact that the system don't have any API.
The system is given by other company.
So I have no idea in such situation.
Please help!
|
|
|
|
|
Is it possible to define a class member variable to be read only and also being public? Thx!
|
|
|
|
|
|
That is not what i meant!
I want to know how can I declare a variable as readonly to instances outside the class. For instance:
class X {
int var;
int func( void ) {
var = 12; // Legal
}
};
int main( void )
{
X asd;
asd.var = 12; // illegal
}
To this i would also like to add the fact that this class is supposed to be a base class so, var will maintain its properties on all the derived classes. For instance:
class Y : public X {
int func2( void ) {
X = 12; // Legal!
}
}
Thx!!
hint_54
|
|
|
|
|
The standard way to do something like this in C++ is to make the variable private, add a public method to get it and a protected method to set it. In this way, the class itself and derived classes can modify the value, while it remains visible but unchangeable externally.
|
|
|
|
|
Yes, that I know. I was trying to find some other way without having to use function calls. But I think that is not possible under c++... but thx anyway!
|
|
|
|
|
Hi All,
I'm working on an SDI application that has a CEditView as one of it's views. While I can use the default printing to print the document, things like the margins, the font etc. need to be set. I would like some details about how to do this.
Thanks!
Mark
"Nothing is impossible. Remember once upon a time the world was flat."
|
|
|
|
|
Hi,
Check this[^]
Bye
Cool Ju
Vote for Cool Ju
|
|
|
|
|
No disrespect intended but the linked article does little to help me understand the document view printing process. The code has almost no comments so I don't know what I'm looking at. Looks like a lot of extra work on specialized printing classes.
Thanks anyway,
Mark
|
|
|
|
|
I am using Visual C++ 6.0 MFC Document/View. I need to convert my logical units to pixals. In my myCView's OnDraw(pDC) function I am calling a myCDocument function pDoc->DisplayMyStuff(pDC) which in turn calls the function DisplayMapSetup(pDC, WaferRect). In the DisplayMyStuff(pDC) function I define a CRect to be WaferRect. I then can get the height = myCRect.Height() in logical units but I want them in pixels. If after I define WaferRect, I call pDC->LPtoDP(WaferRect) before calling WaferRect.Height() I still get the height in logical units. I have also tried pDC->LPtoDP(&WaferRect) and several different mapping modes. Here's a little snippet.
void CWaferMapDoc::DisplayMapSetup(CDC* pDC, CRect WaferRect)
{
pDC->LPtoDP(&WaferRect);
int height = WaferRect.Height();
Is there something I am missing in order to convert the logical unitis to pixels?
Thanks,
Buck
|
|
|
|
|
Hi,
What mapping mode are you using and the settings of the origins and extents for the window and viewport? Bcoz LPToDP and DPToLP depend on these settings.
If u r using MM_TEXT mapping mode, then the logical unit is equal to device unit. 1 unit = 1 pixel.
Bye
Cool Ju
Vote for Ju
|
|
|
|
|
Thanks Ju,
I think I know what's going on now. I use a map mode of MM_ANISOTROPIC in my zoom class but otherwise I don't set it (defaulting to MM_TEXT). I'm defining my document size to be CSize(1100, 850) to represent an 8.5 inch by 11 inch page size but I don't set the map mode to MM_LOENGLISH. My brain was thinking 8.5 x 11 inches when in reality it was 1100 x 850 pixels. This would explain it.
Buck
|
|
|
|
|
Hi all,
I am looking for a small sample of code that saves bitmap after getting it from DC.
Can anyone help?
Thanks,
Max
Sincerely,
Max Pastchenko
|
|
|
|
|
Your best bet is to use GDI+ in your application, then you can save as jpg, etc.
I have a number of articles on GDI+ here on CP.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Consider the following:
class A
{
recipient;
queue;
};
class B
{
recipient;
queue;
text;
from;
};
A a;
B b;
if (some_condition)
modify a.recipient, a.queue;
else
modify b.recipient, b.queue, b.text, b.from;
...
if (some_condition)
modify a.recipient, a.queue;
else
modify b.recipient, b.queue, b.text, b.from; This code that modifies the various members is repeated dozens of times. I would like to somehow instantiate just one of either A or B so that the code that modifies the common member variables can do so without having to use a runtime condition. Something like:
modify b.recipient, b.queue;
if (some_condition)
modify b.text, b.from; I thought that I could put the common member variables into a base class and derive A and B from that, but nothing I tried would satisy the compiler. Modify the member variables through the base class and it would complain about text and from . Modify the member variables through the derived class and it would complain about recipient and queue .
One or other of the two classes will eventually be sent to another computer. That computer is expecting data of a certain size. In other words, I can't operate on B if the other computer is expecting A and vice versa.
Thanks,
DC
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
From the top of my head, what about a virtual function to do the modify operation? I know that goes against your requirement of having to use a runtime condition, but that's the best or most consistent runtime condition to rely on, I think.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Derive B from A. Try operating from the derived class. Now I think you can access all member variables of A as well as B.
Just a thought.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
If the computer that will eventually receive this data is expecting A and I send it (a larger) B, those extra bytes will cause all sorts of data loss due to everything being shifted.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: If the computer that will eventually receive this data is expecting A and I send it (a larger) B, those extra bytes will cause all sorts of data loss due to everything being shifted.
Well now you are adding contraints that weren't in your original question.
Also your comment above isn't true, it depends on how your network code is set up.
The simplest way would be to add a Serialize method to A/B to read/write the object state to a blob of memory (e.g. in XML format) and then send the blob across the network.
But this issue (sending the data across a network) is unrelated to the original problem of optimizing your code.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote: Well now you are adding contraints that weren't in your original question.
This constraint was not mentioned as it is irrelevant as far as my question goes.
cmk wrote: Also your comment above isn't true, it depends on how your network code is set up.
It's entirely true. I know how the data has to be packaged before it can be sent.
My question was nothing more than a C++ question. It has nothing to do with the network.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|