|
Thank you for replies.
I want to try method of replies.
Thank you!!
|
|
|
|
|
I use regsvr32 to register my dll,but it only register for the user that I register in its account,not gor all user. Any idea?
Mazy
No sig. available now.
|
|
|
|
|
Mazdak wrote:
...but it only register for the user that I register in its account,not gor all user.
How are you verifying this?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i have a problems to remote controling of IIS server (i mean creating FTP, Web sites and managing it). If some one tell me where i can read about it or see some codes on C++ or C# i will be very happy... TNX
|
|
|
|
|
Could anyone spot the problems with the codes below? Just have a look on the DIB section, assuming functions in CBCLass and CAClass are prefectly working except this one. This section of codes run okay by calling it one or twice but will crash when call it more often. I am wrapping this code below with managed C++.
Any potential problem?
<br />
CBClass::function(unsigned int uiDegree)<br />
{<br />
HBITMAP hBmp = this->getCxImage()->MakeBitmap(GetDC(0));<br />
ASSERT(hBmp!= NULL);<br />
CAClass oTempImage(GetDC(0), hBmp);
bool bRet = oTempImage.Rotate(uiDegree);<br />
HBITMAP hRotatedBmp = oTempImage.GetDIB();<br />
ASSERT(hRotatedBmp!= NULL);<br />
this->getCxImage()->CreateFromHBITMAP(hRotatedBmp);<br />
::DeleteObject(hRotatedBmp);<br />
<br />
return bRet;<br />
}<br />
thank you.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
How to insert Button to titleBar of window?
(where minimize, restore, close buttons is placed)
or how to get pointer to TitleBar window ?
Thanks.
|
|
|
|
|
Look up WM_NCPAINT , WM_NCLBUTTONDOWN , etc.
|
|
|
|
|
|
Hi guys
I'm trying to do something similar to a sports results tray info, and I was thinking to get the results from a web page to later show them in the tray.
There is an easy way to get part of text from an html page programatically?
Best Regards
Dr.pi
|
|
|
|
|
Yes, you can use IE automation. Search MSDN for IHTMLDocument .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Another idea..
In the past I have used the following function to pull HTML code from a url.. I then parse the HTML code and pull out the info I want.. Not sure if this is what your looking for but here's some code..
CString strUrl,
strBuff,
strError;
CInternetSession mysession;
CStdioFile* remotefile;
char httpbuff[4096];
int numbytes;
strUrl = _T("HTTP://www.someurl.com/index.htm");
strError = _T("SUCCESS");
TRY
{
remotefile = mysession.OpenURL(strUrl,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
while (numbytes = remotefile->Read(httpbuff, sizeof(httpbuff)-1))
{
httpbuff[NULL];
strBuff += (CString)httpbuff;
}
mysession.Close();
remotefile->Close();
delete remotefile;
}
CATCH_ALL(error)
{
TCHAR szCause[4096];
error->GetErrorMessage(szCause,4096,NULL);
strError.Format("%s",szCause);
}
END_CATCH_ALL;
if(!strError.CompareNoCase(_T("SUCCESS")))
{
}
else
{
}
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Please if there is someone who knows how to pass an input parameter to a query for selecting data from a view with parameter.
I have a "MS Access" View called "Income" and this view has a parameter pDate.
The SQL used to create the View is something like this:
SELECT AVG(TROL) AS MROL, AVG(TEURO) AS MEURO, AVG(TUSD) AS MUSD
FROM Total
WHERE date > pDate;
pDate is a parameter.
I have a class CDBIncome : public CRecordset
and a recordset
CDBIncome rsIncome;
I don't know how to pass the pDate parameter to rsIncome;
If somebody knows how to do this, please write the code to do this.
Code for DoFieldExchange(CFieldExchange* pFX)
and code for query. And anything I should know.
Thank you.
|
|
|
|
|
|
I have tried to add this code to
DoFieldExchange(CFieldExchange* pFX)
{
..............................
pFX->SetFieldType( CFieldExchange::inputParam );
RFX_Text( pFX, _T("[pDate]"), m_dateDate );
}
I have declared
CString m_dateDate;
CDBIncome::CDBIncome(CDatabase* pdb)
: CRecordset(pdb)
{
//{{AFX_FIELD_INIT(CDBMedie)
m_MROL = 0.0;
m_MEURO = 0.0;
m_MUSD = 0.0;
m_nFields = 3;
m_nParams= 1;
//}}AFX_FIELD_INIT
m_nDefaultType = snapshot;
}
and
{
CDBIncome rsIncome(&theApp.m_DB);
rsIncome.m_dateDate = ...(my date to pass as parameter)
rsIncome.Open();
}
But i get this error to few parameters and everything i try i receive errors
|
|
|
|
|
Here's one way:
CString CDBIncome::GetDefaultSQL()
{
CString strQuery;
strQuery.Format("SELECT AVG(TROL) AS MROL, AVG(TEURO) AS MEURO, AVG(TUSD) AS MUSD FROM Total WHERE date > '%s'", m_strSomeDateValue);
return strQuery;
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks, it does the work, but this isn't a parametrized query.
I want to know how to pass parameters to a view.
|
|
|
|
|
Ahh, that's a different request! You'll want to read this article.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
For a technical drafting program, i need to draw truetype fonts with total control on their height : for example i want a text of exactly 10mm high.
The problem is in interpretation of height; for truetype fonts, this height is made of 3 arts : Descent (part under the baseline), Ascent (part over the baseline), InternalLeading (some space above the character). All these values are returned by pDC->GetTextMetrics() when you have selected a font in the pDC.
In my case, when i say i want a font 10 mm high, it means a font whose characters above the baseline (such as digits) will be 10 mm high. This convention is used by programs such as Autocad, MicroStation, ...
For creating a CFont object, you have to fill a LOGFONT struct with the properties of the font, such as font name, height, weight, ... But as said before, the height specified here include descent + ascent + leading. Here is how i try to get what i want :
CFont *pOldFont, newfont;
TEXTMETRIC Metrics;
LOGFONT lf;
double HcarFromFont, HcarWanted;
memset(&lf, 0, sizeof(LOGFONT));
strcpy(lf.lfFaceName, "Arial");
// HcarWanted is the required height (say 10 mm) converted in pixels;
// the height must be specified in logical units, which are pixels because the the current mapMode is MM_TEXT.
HcarWanted = 10 /* mm */ * ConversionFactor; // ConversionFactor translates mm in pixels
// set the height - this is just a first try :
lf.lfHeight = - (long)HcarWanted; // note the minus sign, this is normal (see doc. for LOGFONT)
... // set others font properties
newfont.CreateFontIndirect(&lf);
pOldFont = pDC->SelectObject(&newfont);
pDC->GetTextMetrics(&Metrics); // get metrics (in pixels) for the font just created
// read the current height for ascent part :
HcarFromFont = Metrics.tmAscent - Metrics.tmInternalLeading;
// here is the trick : the height of the ascent part is of course smaller than the required height;
// so i correct the total height (lf.lfHeight) so that the ascent part grows up to the required height :
lf.lfHeight = (long) (lf.lfHeight * (HcarWanted / HcarFromFont));
// example : let's say that HcarWanted is 100 pixels and that GetTextMetrics()
// returned HcarFromFont = Metrics.tmAscent - Metrics.tmInternalLeading = 60;
// so the new lf.lfHeight is multiplied by * 100/60 = 1.66
newfont.Detach();
newfont.DeleteObject();
newfont.CreateFontIndirect(&lf); // recreate the font with the corrected height
pDC->SelectObject(&newfont);
// the following lines just check that the new height of the ascent part is very near of the required height :
pDC->GetTextMetrics(&Metrics);
HcarFromFont = Metrics.tmHeight - Metrics.tmInternalLeading;
Problem : the resulting height on screen is near the required height but there is still an error up to 20 %; for a same specified height, some fonts are smaller, some are bigger.
JPG
|
|
|
|
|
Have you considered working in a different mapping mode, for example, MM_LOMETRIC ?
If you want to implement printing, using such a device-independent mapping mode will seriously simplify your code.
One thing that will bite you is that MM_LOMETRIC has the y axis increasing from the bottom of the screen to the top, unlike MM_TEXT which is the other way round. By default, the (0, 0) position is still in the top left of the window.
You can implement zooms and pans simply by modifying the window and viewport extents.
For more information, see Mapping Modes and Translations[^].
|
|
|
|
|
I have made tests with 2 mapping modes :
on screen : mapmode = MM_TEXT : 1 logical unit = 1 pixel
when printing : mapmode = MM_LOMETRIC : 1 logical unit = .1 mm
The problem stays independently of the map mode; i don't think it's a problem
of map mode, since for a same mapmode and a same lfHeight (in the LOGFONT struct),
the effective height of the text will vary with the font.
And my problem is not only that the height changes with the font : for a given font i want that the height of the 'ascent' part of the font is precisely 10 mm, and i can't get that. For example i want digits (these characters have no descent part) of exactly 10 mm.
(Of course i don't set lfHeight = 10, but i apply a factor converting mm to pixels; i know this factor is correct, i use it for drawing lines).
|
|
|
|
|
Hi,
I far as I can remember there is something like a negative height. When the height in the logfont structure is positive it is the height with the leading, when the height is negative it the cell height. But I do not know if it's just the ascending or the ascending+descending.
I vaguely remember that the TEXTMETRICS structure has members for ascent descent and so on.
So for your code the line
HcarFromFont = Metrics.tmAscent should do what you need;
Regards
G. Steudtel
|
|
|
|
|
yes indeed I use a negative lfHeight, it means that height is the character height (ascent + descent, including an internal leading); a positive lfHeight would mean the cell height (= character height + external leading).
G. Steudtel wrote:
HcarFromFont = Metrics.tmAscent should do what you need
so I presume I write :
lf.lfHeight = -HcarWanted; // first try : HcarWanted = 10 mm (in pixels)
font.CreateFontIndirect(&lf);
pDC->SelectObject(&font);
pDC->GetTextMetrics(&Metrics);
HcarFromFont = Metrics.tmAscent;
lf.lfHeight = -HcarFromFont;
font.CreateFontIndirect(&lf);
But don't forget that CreateFontIndirect(&lf) will consider lf.lfHeight as the total character height, how can it known it's meant to be the ascent height ?
Or is there something i didn't grasp ?
Nevertheless I did test the above code : it does not work : the font is now much too small; suppose the initial height was 10 mm : say 6 mm for ascent and 4 mm for descent; so with the 2nd assignment of lfHeight, i will ask a font whose total height is 4 mm.
|
|
|
|
|
Hi,
Sorry that I made it too short. Off course if you take a smaller value you get a smaller font. The fault is by me for not thinking any further.
Two approaches:
1) In a loop increase the height of the font until tmAscent becomes 10.
2) HcarFormFont = INeededHeight*Metrics.tmHeight/Metrics.tmAscent; with iNeededHeight being a constant of 10 ( or what ever height you need).
I'm not so sure about the calculation but the ratio of height to ascent should be the factor to increase the height of the font. Also you should do some casting to double and back to integer to minimize rounding errors. But basically the second method seems reasonable.
Regards
G. Steudtel
|
|
|
|
|
In my first code, i did a similar interpolation that the one you suggest.
HcarFormFont = INeededHeight*Metrics.tmHeight/Metrics.tmAscent.
Nevertheless, using your formula or mine, the results are very near, and on screen the font looks either too small, either too big (it depends of the font).
Note that, curiuously, after having set the height with the interpolation formula, if i request again the metrics with GetTextMetrics(), i see that the height of ascent part is now equal (or very near) to the initial height i requested. So the formula seems to work, and yet on screen that's not OK...
Thanks,
JPG
|
|
|
|
|
For any office document and many other documents as well, you can edit the document's set of properties by right clicking the document's icon, and selecting the summary prop-page. There are for instance etries like "Document title", "Comments" and "Keywords".
In my code, I would like to access this information. That is, given a filename, I want to check if the correspondning file has an entry "Comments" and reads its value.
Can anyone with this knowledge share some hints or, even better an example?
Regards // Jonas Pettersson
|
|
|
|