|
Hi Guys,
Iam working on an MFC application.am drawing some lines to the screen using the device context.Iam selecting a font of type "ANSI_FIXED_FONT".
Iam doing it as follows, & stores the font height in a "m_fontHeight" class variable.
m_deviceContext->SelectStockObject(ANSI_FIXED_FONT);
TEXTMETRIC fontMetric;
m_deviceContext->GetTextMetrics(&fontMetric);
m_fontHeight = fontMetric.tmHeight;
Now my question here is,will the font height iam getting here, will be the same on all windows machines.
For eg.- , if I get a FONTHEIGHT here as 13,Will it be the same on some other machine as well...
Thanks
|
|
|
|
|
Test it on another machine. I'd say font height is machine dependent.
Kuphryn
|
|
|
|
|
How to implement a scroll bars in CStatic-derived class. If I'm add following lines then scroll bar will visible, but WM_HSCROLL message not send to my CStatic-derived class.
EnableScrollBarCtrl(SB_HORZ);
SetScrollRange(SB_HORZ, 0, 100);
ShowScrollBar(SB_HORZ);
What's the problem?
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
Hello!
I wanna write a Text in a tif picture.
It can be intern in the tif File (if it's possible) or the text can also stay in a corner of the picture...
Or if you know another (easyer) way to save a text into the tif picture, please tell me!!
I have no idea how i could do this!
Please Help me!
Thanks!
Greetings Ronny
|
|
|
|
|
Have you read the TIFF Format[^] specs?
If yes, then the easiest way I know about is:
01. Create your character matrices (these can be simple 2D byte arrays specifying the on/off status of a pixel) e.g
00011000
00100100
00100100
00111100
01000010
01000010
10000001
10000001
can be 'A'
02. now, create your image data using these.
03. Then create your tiff specification Tags.
04. Write all the data into a file.
I Hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hello and thanks for your answer!
But sorry that was a little bit to fast for me!
I have a tif picture wich already exists, and i want to inser a text anyway.....
Or can you tell me what functions i have to use?
Thanks!
Ronny
|
|
|
|
|
Ok,
Try taking a look at the LibTiff[^] library.
It is an opensource library for working with tiff images. You'll get usage intructions on the site too.
What I was trying to say earlier was, that one way I found for writing text into image files is to create 2D pixel-value matrices for each character. i.e. each element in the matrix will be a pixel value. Then when you want to write a character in to an image, you just need to pick up the correct matrix and copy the pixel values in the correct positions. I'm not too sure even this explaination was good enough, well, I've never been too good at explaining things ... just take a look at libtiff, it should help a bit. Also, searching google will give you a lot of great tuts.
I hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hello!
That was a great Link! The Library supports really gut functions....
I have already tried many of these functions, but there is also a big problem. When i create a tif File with Photoshop i can open the file without any problems but if i open the File who i have in my application it don't works.
Is it possible to load the tif file as bmp, so i can work with the bmp File and save it after as tif?
If it is possible how can i load it, to write in the bmp i should use the GDI (or not?), and how can i convert after the bmp in a tif file?
And it is very importand that the pic don't lose quality, is it possible with out losing quality?
I thank you very much for your help!
Ronny
|
|
|
|
|
I think the libtiff library gives you the image data... which you can work with. I'm not sure.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
I'd like to write my own keyboard driver for Windows 2000/XP. (I want to move some keys around, and I'm not just talking about keys like CapsLock, Ctrl etc.)
I've searched on MSDN, but I haven't been able to find any information about how to write a keyboard driver. Can somebody point me in the right direction?
|
|
|
|
|
I don't think you want a keyboard driver (though that would work). Search for how to change the charicer map. Windows already has keyboard layouts for things like Dvorak. (control panels->keyboardinput locals->properties -- in windows 2000) Figure out how they work, and you can change your map with a lot less effort.
If you really want to write a driver, you need the DDK, which isn't normally a part of MSDN. Even then I'm not sure how much there is on keyboard drivers, but if you work at it there is enough.
|
|
|
|
|
can we access a pointer to vTable, in C++?? or is it tht pointer to vtable is only for the compiler??
if we can, how do we do it??
|
|
|
|
|
As far as I know it is not possible.
|
|
|
|
|
I m using SQLConfigDataSource( ) to create data source programaticaly
it is creating but it is not attaching the database when i chk it in administrative tools in ODBC on Clicking on New(my DSN name) DSN .. as we attach database with DSN
database name is date.mdb
code is :::
SQLConfigDataSource(NULL,ODBC_ADD_DSN, "Microsoft Access Driver (*.mdb)", "DSN=New\0" "Description=New Data Source\0" "FileType=Access\0" "Database=E:date\0");
reply me thanx
|
|
|
|
|
I use, n works for me :-P
GenLocalDSNString("Microsoft Access Driver (*.mdb)", "DSN=myDSN", "Description=Connection to local database", strPath,"FIL=MS Access");
}
void GenLocalDSNString(CString Driver, CString DSN, CString Desc, CString path, CString FIL)
{
BOOL failed=FALSE;
TCHAR strConnect[256];
int i = 0;
Concat(strConnect, DSN, &i);
Concat(strConnect, Desc,&i);
Concat(strConnect, "DBQ=", &i);
i = i-1;
Concat(strConnect, path,&i);
Concat(strConnect, FIL,&i);
SQLConfigDataSource(NULL,ODBC_REMOVE_SYS_DSN, Driver, strConnect);
//try to create a system DSN - if this fails create user DSN
if(!SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN, Driver,strConnect))
failed = TRUE;
if(failed)
{
failed = FALSE;
if(!SQLConfigDataSource(NULL,ODBC_CONFIG_DSN, Driver,strConnect))
failed = TRUE;
}
if (failed)
{
AfxMessageBox("DSN Creation Failed. Please Contact Support",MB_ICONWARNING);
}
}
void Concat(LPTSTR strDest, LPCTSTR strSrc, int* pnInt)
{
memcpy(strDest+*pnInt, strSrc, _tcslen(strSrc)+1);
*pnInt += _tcslen(strSrc)+1;
}
|
|
|
|
|
Where to place the actual hook code?
In CMainFrm or CWinApp.
|
|
|
|
|
WOW, I found a very good free firewall, and it open full source code!!
The more details: http://www.filseclab.com/eng/products/firewall.htm, http://www.filseclab.com/eng/products/sourcecode.htm
|
|
|
|
|
Hi,
I am a new in MFC.
I want to call a dialog box on Help button on a propety sheet in MFC.How can I do this?
Please guide me.
rajesh
|
|
|
|
|
I use the PlaySound() API function to play wav files when events occur in our app. I would like to give the user the option of adjusting the volumn of each sound.
Im guessing I will need to record the current volumn, set the volumn to the users preferance, play the sound and reset to the original value.
Does anyone know how to do that?
Thanks
Josh
|
|
|
|
|
Hi guys,
I found using the CEdit control in Visual Studio .NET, if the control's ES_NUMBER is set (numbers only), a ballon type of notification is automatically implmented and will pop-up when the users try to type non-number character in the edit box. It works on my first app. However, this special effect no longer works in my second app when using the same standard CEdit control. Typing non-number character will make the error sound, but no longer prompts the ballon notification.
What could have prevented from happening?
Thanks
|
|
|
|
|
Hi
I am currently building a time-critical app that requires a lot of computation functions, like sin(), log(), and sqrt(). I have two questions regarding this:
1. Is there an alternative way that is faster than using those functions? I am working on unsigned ints (32-bit) data, and building a lookup table would not be feasible, since there is no known boundary on the data.
2. Will C++ STL algorithm like for_each(), accumulate(), etc. make my app run faster than using traditional for loop? I am using VC++ 6.0 BTW, without STLPort.
Thanks!
|
|
|
|
|
(1)The FPU can perform the basic sin/cos/ln functions in 'hardware' and therefore presumably quite quickly, more quickly than an integer based hand coded approach. So I suggest you convert your incoming fixed point data to floating, process it, then convert it back, examine the generated machine code and measure the performance. Only then explore the options. If you use the C library functions 'double sin( double ) ' etc then the compiler should generate inline FPU code.
(2)I don't think you'll see a significant performance difference for or against with the STL algorithms, but their use should make the code cleaner.
Paul
|
|
|
|
|
Ex: I want to list all the Folder that shared or shared fully in my Drive. How to do? help me please ??
thanks
|
|
|
|
|
If you don't want to write any program for the same , try following.
If you are talking about C or D drive, go to root of the drive & fire following command.
"dir /S /ON /AD /B > AllFolder.txt"
All the folder will be listed in AllFolder.txt
|
|
|
|
|
Yes, i wanna write a program in MFC to list all the Folder that Shared fully in Hard Drive (C:; D . But I don't know how to approach, Could you help me any more??
thanks
|
|
|
|
|