|
It is similar to Matlab I think... normally you have to open GAMS and you have to have a text file with all the information needed (in this case it´s a optimization problem...so you have a few equations and matrixes), and you tell GAMS "Solve it!" and the output data is put into another text file.
So I guess it´s a GUI, but my problem is that I don´t know whether it has an automation interface...boohoo...
|
|
|
|
|
try dropping the text file onto the icon for GAMS. If it opens up and runs, that means it will accept the name of the text file as a command-line argument. If this is the case, you could use ShellExecute() and just send it the path to the text file as an argument.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Joel Holdsworth wrote:
We need to know a little more about this GAMS...
Just a guess:
Guide to Available Mathematical Software
GPS Azimuth Measurement System
Genome Annotation Management System
General Algebraic Modeling System
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
See here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm doing the excercise after the chapter about copy-constructor, Here's how it goes:
Create a very simple class, and a function that returns an
object of that class by value. Create a second function that
takes a reference to an object of your class. Call the first
function as the argument of the second function, and
demonstrate that the second function must use a const
reference as its argument.
And here's my implementation:
extern class A;
A fun1()
{
return A();
}
void fun2(A& a)
{
}
int main()
{
fun2(fun1());
}
I believe I've done exactly what the author has described, but It seems fun2(...) doesn't have to take a argument of const reference and compiler doesn't complain too!In addition what's the effect of calling A() inside fun1(...) instead of
A a
return a;
|
|
|
|
|
I think the question (from your book) is somewhat unintuitive. I think what it wants is for you to modify a member of A inside fun2(). You'll lose that change/value because your passing a temporary variable, but passing a temporary variable is fair game because it has an lvalue.
A a;
return a;
is the same as
return a();
The latter combines the two lines into one by using a temporary variable. I believe most compilers will produce the same code. They both go on the stack temporarily.
|
|
|
|
|
extern class A;
A fun1()
{
return A();
}
void fun2(A& a)
{}
int main()
{
fun2(fun1());
}
I think specify fun2(...) argument as a const reference make sense. Because when the call to fun2(...) is made the compiler has to generate a temporary object in order to hold the object returned by fun1(...), and this temporary object default to const!But somehow compiler doesn't complain!
Mark Petrik Sosa wrote:
A a;
return a;
is the same as
return A();
is "return A();" just a call to the constructor?
|
|
|
|
|
Hi guys hopefuly someone will be able to help.
I need to open a file for reading but this file is already open by another application for writing.
I have tried playing around with the flags in CreateFile but have still not succeeded.
Does anyone know how to do this?
|
|
|
|
|
If the other app hasn't specified sharing, then you can't do this. The CreateFile call has a sharing parameter which can be any one of (or combination |'d together of)
FILE_SHARE_DELETE
FILE_SHARE_READ
FILE_SHARE_WRITE
or you can specify 0, which means no sharing. This applies when you open a file, and means that you are happy to let subsequent calls to CreateFile open the file if they specify only the access you're willing to allow.
If the other app has specified zero, you can't open it anyhow, but if it's specified FILE_SHARE_READ then you *could* open it for reading, but not for read/write or just write.
Does that help?
Steve S
Developer for hire!
|
|
|
|
|
Thanks for the help Steve.
I just used File Monitor to check how it is being opened by the other application (I do not have source code for it)
It says: Options: Openlf Access: All
I doubt it is allowing share read... I guess I cannot use CreateFile to open this file...
Jeremy.
|
|
|
|
|
Hello...
Arturdt wrote:
I need to open a file for reading but this file is already open by another application for writing.
Which Application lock the File ???
Can you specify the file share permission from both applications ???
When yes, you must only speciefy the correct file share permission when you create or open the file (FILE_SHARE_READ|FILE_SHARE_WRITE).
|
|
|
|
|
The application locking the file is Edonkey (I am reading the .part files)
However I need to do this whilst edonkey is running.
Jeremy.
|
|
|
|
|
You could make a temp copy of the file for your own program, then delete the temp file when finished. That wouldn't require direct access to the target file.
u6ik
|
|
|
|
|
Yes, I am currently making a temp copy however I am dealing with multiple files of 9,500KB many times reaching to gigabytes of data... so I would like to avoid this extra copy!
|
|
|
|
|
Hello...
I want to get the Font width from a font handle and the ::GetObject(...) function to retrieve the font data (in a LOGFONT structure)... But often the lfWidth member is zero or very small...
How to get the correct font width ???
|
|
|
|
|
//You can get it like this:
double width;
RECT Rect;
width=Rect.right;//This is the width of your window.
|
|
|
|
|
which has to do with fonts how, exactly ?
Steve S
Developer for hire!
|
|
|
|
|
That will give you the average width (if available) of a character (in logical units). That may not be what you want, unless it's a fixed pitch font. Better (but slower) is to select the font into a device context, and use the GetTextExtentPoint32 functions for specific strings. Alternatively, if you really want the average width, you can do this using GetCharABCWidths and a bit of math.
Steve S
Developer for hire!
|
|
|
|
|
I believe what you want is something like GetTextMetrics(), which will return an average width in units based on the DC your using. A LOGFONT's lfWidth returns an average width in logical units. Also you can use DrawText() with DT_CALCRECT to get accurate dimensions on a given peice of text on a given DC.
|
|
|
|
|
Thanx for your very fast reply...
I hoped that i mustn't select it to dc and can calculate the max font width or better max letter width from the LOGFONT structure or other else...
But also big thanx...
|
|
|
|
|
Yes and No...
TEXTMETRIC struct defines the right member that i need (tmAveCharWidth), but i need always a dc to get them... So i hoped it exists any other way to calculate them from LOGFONT structure or other else...
But always big THX for your reply...
|
|
|
|
|
Without a DC a real width doesn't exist until it's associated with a DC. If your printing it to a high dpi printer your width will be different then on a low dpi monitor. If you want something more "logical" use the font size which is calculated from LOGFONT's height.
|
|
|
|
|
Hello...
Mhhh...
Mark Petrik Sosa wrote:
Without a DC a real width doesn't exist until it's associated with a DC.
I don't understand ?
I think the LOGFONT height it's the height of the font. The size is fixed and independent from the dc...
What's the different about the width...
When i create a font with a height of 20 pixels then is height from the font on a screen dc different as from the printer dc, but i think it's difference about the resolution and the count of pixel per inch...
Can you explain your idea?
Best regards...
|
|
|
|
|
Good question.
From the MSDN on LOGFONT:
If lfWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference.
The height of a font is in logical units. Which is why a font at size 8 can look huge on a computer with large fonts set.
The Windows GDI was designed to make as little assumptions as possible about what it's drawing on. On a printer 20 pixels is very tiny because it's DPI is so high. There are even monitors that aren't at the normal 96 dpi, so these would not look right if it was embedded with a nonlogical number. Some devices don't even use pixels but other measurements, like twips, so until the DC is set with this information you can't get the width on some fonts.
Why can't you get the font's average width logical units? I'm not sure, perhaps it has to do mostly with the font, whether an accurate font to that size has been selected or not, or whether a font author must set this information in the header. Maybe windows is just reluctant to provide such an inaccurate approximation, I don't know.
In my opinion it doesn't seem like a big deal (apart from being interesting) since it's a logical value anyways. If you were to use it, you'd have to make all the calculations that GetTextMetrics makes for it to work across all DCs. I can't see where you'd use it without a DC.
I hope this makes things somewhat clearer.
|
|
|
|
|
Hello Mark...
Thx for your comments... It helps me a lot to understand the difference about logical untits and the real size on dc'S...
Mark Petrik Sosa wrote:
I can't see where you'd use it without a DC
I need the width of the font in some calculations of my new app...
But before the window is drawing...
At this point the explicit creation of a dc handle to retrieve only the width of the font looks very involved...
Best regards...
|
|
|
|