|
Hi everyone!
I'm desperly trying to make application, in Borland C++ 5.0, with my TTF fonts inside it.(I think its called Font embedding)
Is there anyone who could help?
I'd be gratefull
tanx
dArK cHAriSmA
|
|
|
|
|
I did this for an MFC application recently. I guess it’ll be similar with Borland.
I created a custom resource, gave it a name, and associated it with the .TTF file. Then when I built the .exe file, I found the byte sequence for the .TTF file inside. So that’s the first step – getting the .TTF file into the .exe file.
The second step is to get the byte sequence at run time. Call ::FindResource() , then ::LoadResource() , then ::LockResource() , then ::SizeofResource() .
The third step is to tell Windows to use the byte sequence as a TrueType font. I haven’t found a good way of doing this. I don’t know if there is a good way. The method I use uses two indirections. Having found the byte sequence, write it out to a temporary file, then read in the file using ::AddFontResource() . Then call ::CreateFontIndirect(&lf) , having set lf.lfFaceName to the name of your font, and hope that Windows chooses to use your font.
Then call ::FreeResource() (I’m not sure if this is necessary, but some of the MSDN samples do it). And before your program ends, call ::RemoveFontResource() , otherwise your font will probably be in the system for ever more.
HTH,
Chris.
|
|
|
|
|
Hi
On Windows 2000/XP, when you right-click on a file in Explorer and click on properties, you can see the file's comments/author/title from the summary tab.
Anyway, my question is how do you extract this info from files. Is it contained in the registry, or is it within a special file (like desktop.ini or thumbs.db), or is it the NTFS filesystem?
|
|
|
|
|
I don't know how but they are written into the file its self.
wWw.KruncherInc.cOm
|
|
|
|
|
kusanagi2000 wrote:
Anyway, my question is how do you extract this info from files. Is it contained in the registry, or is it within a special file (like desktop.ini or thumbs.db), or is it the NTFS filesystem?
The only file type that contains this information is OLE compound files. The information is written to the properties stream in the file. Lookup MSDN on OLE compound files for information on how to read it. I haven't looked for a while, but I believe they have an example on how to do exactly this.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
My problem is that I want to read the pixel values of different bitmap formats (monochrome, 16,256 & 24 bits) accurately so that for a 16 Color bitmap the pixel values should only range from 0 to 15.
I know that I can do that by opening them as regular files and reading them pixel by pixel by taking the value of 4 bits at a time. But I was wondering if there was a built in way in API that can save me this trouble.Please help urgently
e6ad
|
|
|
|
|
do you want 16 and 32 bit as well ?
As far as I am aware there's no quicker way than reading in the file and iterating over the data.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
There is no built in way even for the 24 bits image???
|
|
|
|
|
For any non paletised image it's easy, if you really want to. Just define a struct and read those structs from your byte array. The built in way is get/set pixel, but it's plainly obvious that any built in way would suffer from the problems this method suffer from. As soon as you add a wrapper to the underlying code, which must turn the image into a byte array, read the bytes and figure out the values from there, you slow things down.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
hello,
i want to make program ras api completely,
i mean, i'll make the dial up(DUN) and the response for the dial up
for the the dial up is not my problem.
the problem is how to handle incoming connection using ras api?
i want to call incoming connection dialog in the windows programmatically with visual C++ and i don't know.
i am using window 2000
please help me, if anyone knows to handle this.....
|
|
|
|
|
I am also facing the same problem. If you could help me in creating an incoming connection to recieve the messages, it would very nice of you.
Thanks let me know if you find any solution.
|
|
|
|
|
Writing Plug In For MS Outlook
Using C/C++ VisStu 6.0
I am looking for any references, books, code, examples, tutorials for writing a Plug In for MS Outlook.
My Plug In will be an encrytpion module for Outlook email.
Many thanks,
Robert
|
|
|
|
|
<br />
void CEffectsDlg::OnCustomdrawSlider2(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
if(delayOn)<br />
{<br />
m_sl2Val.Format("Val: %d%%", (sl2Max - m_sl2Ctrl.GetPos()));<br />
<br />
UpdateData(FALSE);<br />
}<br />
<br />
*pResult = 0;<br />
}<br />
My problem is that the above code appears to be called before I get a chance to assign delayOn a value (its called immediately when the program is launched). I verified this by sticking a MessageBox in with the above.
A setup() function in OnInitDialog() should stop this from happening by declaring delayOn to be FALSE, but this is obviously being called after OnCustomdrawSlider2.
Is there any way round this?
Cheers.
|
|
|
|
|
Set delayOn to FALSE in the dialog's constructor.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Just as a side comment:
I doubt calling UpdateData() is a good idea in a custom draw routine. If the UpdateData() call changes the value associated with the control and causes the control to be redrawn, you could end up infinitely recursing.
Software Zen: delete this;
|
|
|
|
|
I am interested if someone knows a method to PAUSE a process to freeze it. Not freezing all of it's threads . . . but the process
Thank you!!!
gabby
|
|
|
|
|
It sounds like you're thinking there is a separate 'process thread of execution' that is somehow different or separate from other threads. That is not the case. A Windows process is a collection of one or more threads, executing within a context. In order to 'pause' a process, you would have to suspend all of its threads. This would essentially stop the process from consuming CPU time resources.
What problem are you trying to solve by 'pausing' a process?
Software Zen: delete this;
|
|
|
|
|
Gary R. Wheeler wrote:
What problem are you trying to solve by 'pausing' a process?
Or create.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
That thought did occur to me.
Software Zen: delete this;
|
|
|
|
|
I just wanted toi know if there is any possible way of pausing a process other than pausing all it's threads.
Thank you.
|
|
|
|
|
I need to access / operate on selected document/view. I iterate thru the template / document / view using the well documented process (code snippet follows).
I do not understand why the debug shows returned pointers to the derived class when the API variables are assigned to "base" class as follows:
CDocTemplate *pDocTemplate;
CDocument *pDocument;
CView *pView;
The debug shows derived class name but only the base class functions and variables.
My question is - how do I get to the derived class?
"Standard " iteration:
POSITION positionTemplate = GetFirstDocTemplatePosition();
while(positionTemplate)
{
pDocTemplate = GetNextDocTemplate(positionTemplate);
POSITION positionDoc = pDocTemplate->GetFirstDocPosition();
while(positionDoc)
{
pDocument = pDocTemplate->GetNextDoc(positionDoc);
POSITION positionView = pDocument->GetFirstViewPosition();
while (positionView)
{
pView = pDocument->GetNextView(positionView);
etc.
Thanks for your help.
Vaclav
|
|
|
|
|
Your document class is derived from CDocument, so you can do a direct comparison of the pDocument pointer and the address of your document.
if (pDocument == &MyDocument) You can do the same with the pView and your view.
If you do not have the address of your document and view, and just want to check if the returned pDocument or pView are of the same type as yours, then you can do a dynamic_cast of the pointer. The cast will return NULL if the pointer does not point to an object of your type
CMyView *pMyView = dynamic_cast<CMyView *>(pView);
if (pMyView == NULL)
else
[edit]fixed the < and > characters[/edit]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you, your suggestion basically works.
However if used directy, per MSDN, in the syntax you suggested
CCCImageView *imageView = dynamic_cast <cccimageview*> (pView);
I get "Unhandled Exception....
When I use DYNAMIC_DOWNCAST macro in the following syntax
CCCImageView *imageView = DYNAMIC_DOWNCAST(CCCImageView, pView);
it does exactly what I need to accomplish.
What is really strange - the "dynamic_cast" in MSDN ( January 2001) has reasonable explanation what it does, but the macro is documented rather poorly.
Thanks again
Vaclav
|
|
|
|
|
MSDN[^] does state that the dynamic_cast operator can throw exceptions in two instances:<lu>You are trying to cast a reference (not a pointer) and the cast failed.The typeid of the pointer or reference can not be determined.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Does anyone know the easiest way to ensure that a string of a folder path does indeed refer to a real folder in C++/MFC?
Joel Holdsworth
|
|
|
|