|
Besides BS_OWNERDRAW , what other style(s) does the button have?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all,
HFONT CreateFont(
int nHeight, // height of font
int nWidth, // average character width
int nEscapement, // angle of escapement
int nOrientation, // base-line orientation angle
int fnWeight, // font weight
DWORD fdwItalic, // italic attribute option
.. .
..
)
I have an option in UI for the user to select Font Size 8 to 72 as in winword. I would like to know how to give this value to create font's height and width parameter.
Ex: suppose user selects a font size of 12, what is the corresponding nHeight and nWidth value..Is there any conversion required ??
Can somebody throw more light on this..
Thanks,
Shiva P
|
|
|
|
|
Set height as follows...
nHeight = -MulDiv(PointSize,
GetDeviceCaps(hDC, LOGPIXELSY), 72);
nWidth = 0;
- NS -
|
|
|
|
|
we r working on file transferring in vc++(without using MFC).when we send small size of file(approx 250- 350 kb).there is no problen in sending.but when we send large file through our program there is some problem to geting in server side.means that there is some additonal bytes added by server program and some time it will hang.
if we debug this program there is no problem it sends successfully big file too.
here another problem that is
we are reading /writing a structure using fread/fwrite. it convert it into binary file. so when we reading the file fread function doesnot read specified bytes or sometimes unable to read.
we have more problem to read / write Structure using fread/fwrite is there any alternate of these fun in c/C++.
plz send us solution or suggession soon.
|
|
|
|
|
Hello.
It's a possibility that your problem depends on that you are using text mode in your fopen()-calls.
Make sure you use fopen("anyFile", "rb"); and fopen("anyfile2", "wb");
The 'b' is the key here. (The default mode usually is text mode, which seens unusable in your application).
Regards
kakan
|
|
|
|
|
manishgandhi wrote:
when we send large file through our program there is some problem to geting in server side.means that there is some additonal bytes added by server program and some time it will hang.
if we debug this program there is no problem it sends successfully big file too.
How are you sending file from client to server? i.e. in Small packet or whole file at a time!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I need information on ADPCM sound format. Microsoft seems not to love it any more.
I need:
- file header format
- code samples
- links to documentation
We are trying to use it in a project written in C++ (mixed-mode, both managed and unmanaged code
Any ideas?
harrykouk
|
|
|
|
|
http://www.wotsit.org/ has specs on RIFF, which is related to ADPCM. Would that help?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Respected All
I am engaged with filereading problem since long time, i readed the file but still problems are coming.
the dat file is in the following form.
-----------------------------------------
;sfad
;sdlfgs
;sdfjsd
;X Y Index
12 12 1233
34 45 1244
66 44 2435
45 23 3455
;fgksdghkdfhgdf
;dflghfd
23 67 6788
23 45 2334
-------------------------------------
now in the above file format i has to read only the lines that's starting without SEMICOLON and all the lines starting eith SEMICOLON has to skipp.and also while reading each line of the file I has to put the X,Y and Index value in seperate Array and the same process will be repeated each time for X,Y and Index value.
my code script is following
---------------------------------------
int val1,val2,val3;
int row=0;
char str4[50];
pfile=fopen("filename.dat",r)
do
{
fgets(str4,sizeof(str4),pfile);
if(str4[0]!=';')
{
fscanf(pfile,"%d",val1)
arr1[row]=val1;
fscanf(pfile,"%d",val2)
arr2[row]=val2;
fsacnf(pfile,"%d",val3)
arr3[row]=val3;
row++
}
while(!feof(pfile))
fclose(pfile);
-----------------------------
its reads all the data correctly but when there is a SEMICOLON in the start of the line then its skipp the next one line(immediate lines) and reads after it.
in the above case it skipp the line
12 12 1233
and
23 67 6788
because before these two lines there was a SEMICOLON line and due to it skipp the immediate lines.
and except these 2 lines it reads all the lines accordingly,
I dont know why this problem is coming,, pls guide me that what is the best method in this case while i am reading the above file format.
waiting for + response.
david
|
|
|
|
|
Hi,
There shdnt be any problem with this ....
But u can use the other way ....
#include <"fstream.h">
void main(void)
{
char *str4 = new char[50];
ifstream Inputfile("filename.dat",ios::in);
Inputfile.getline(str4, '\n');
....
....
....
Inputfile.close();
delete str4;
}
i hope the problem will be solved
|
|
|
|
|
Mukhan wrote:
char *str4 = new char[50];
Why allocate memory from the heap unnecessarily?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
a_david123 wrote:
fgets(str4,sizeof(str4),pfile);
if(str4[0]!=';')
{
fscanf(pfile,"%d",val1)
You are reading a line from the file into str4, but then you don't actually use it. Instead, you keep reading from the file using fscanf... That's why your program skips lines. Use sscanf instead of fscanf, with a format like "%d %d %d".
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
This has been shown to you many times in the past.
int row=0;
char str4[50];
pfile=fopen("filename.dat", "r");
do
{
fgets(str4, sizeof(str4), pfile);
if (str4[0] != ';')
{
sscanf(str4, "%d %d %d", arr1[row], arr2[row], arr3[row]);
row++;
}
} while(! feof(pfile));
fclose(pfile);
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i am trying to find an instance of a small bitmap in a screen grab of a window.
so far i have managed to load both bitmaps into two BYTE arrays. I found some code which searches through the bitmaps and uses memcmp to see if the smaller one is present in the larger. the trouble is, i am having trouble with the memcmp function:
memcmp(ScreenBmp[i][tmpY],CardBmp[x], card_line_length )
What should ScreenBmp and CardBmp represent. I have the two bitmaps in BYTE buffer arrays, so how can i get them into the format above. The code i used to get them into these arrays is below:
HANDLE hBitMap = LoadImage(0, "img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
BITMAP bitmap;
GetObject(hBitMap,sizeof(BITMAP),&bitmap);
int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8;
/// cout << bitmap.bmHeight << endl;
BYTE *lpBits = new BYTE[ size ];
GetBitmapBits((HBITMAP)hBitMap,size,lpBits );
//delete []lpBits;
HANDLE hBitMap2 = LoadImage(0, "img2.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
BITMAP bitmap2;
GetObject(hBitMap2,sizeof(BITMAP),&bitmap2);
int size2 = bitmap2.bmHeight*bitmap2.bmWidth*bitmap2.bmBitsPixel/8;
/// cout << bitmap.bmHeight << endl;
BYTE *lpBits2 = new BYTE[ size2 ];
GetBitmapBits((HBITMAP)hBitMap2,size2,lpBits2 );
cheers!
|
|
|
|
|
cmon bitches help the guy out
|
|
|
|
|
Hello All
I am using "CXListCtrl" in my application. I want to hide and show columns depending on the user selection, with some data (5 rows of data) present in the list control.
I am using "DeleteColumn" and "InsertColumn" to remove and add column
When I do "InsertColumn" a new column is added in the Header Control, in the location what i specify. When I tried to update the data for newly inserted column, progress bar is displayed and not my data.
If I try to insert 2 new columns, Columns are getting added in Header Control but in the Column values "Progress Bar" and "Check Box" are shown.
When I debugged I see the code where I update the data to corresponding new columns are getting executed correctly. After this code the following fucntion is getting called
CXListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
inside the function "(pXLCD && (pXLCD[nSubItem].bShowProgress))" is true so the following portion of the code gets executed, so Progress control is displayed!
if (pXLCD && (pXLCD[nSubItem].bShowProgress))<br />
{<br />
DrawProgress(nItem, nSubItem, pDC, crText, crBkgnd, rect, pXLCD);<br />
*pResult = CDRF_SKIPDEFAULT;
}<br />
Any Idea what is the problem?
Thanks in advance
- Ravi
|
|
|
|
|
I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times.
main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture)
Can someone offer me advice on how to solve this?
Thanks
|
|
|
|
|
What format are the saved images in?
If they are BMP,JPEG,GIF you can use the OLE picture support to render them, and you could derive from CStatic to make your own picture box, or use something like the one from MSDN done by Paul DiLascia (spelling?)
Steve S
Developer for hire!
|
|
|
|
|
The images are .bmp,
I have a picture control, CStatic m_StillPic
I've tried using m_StillPic.SetBitmap() but without success.
Can you explain the parameter inside SetBitmap(),
where do I put the path to the file?
Thanks
|
|
|
|
|
Hi,
If m_stillPic is a StaticCtrl & your BMP path is "C:\\Pic.bmp" :
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),<br />
_T("C:\\Pic.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);<br />
<br />
if (hBitmap) m_stillPic.SetBitmap(hBitmap);<br />
m_stillPic.UpdateWindow();
|
|
|
|
|
Hi,
create a CStatic control and choose type 'rectangle'.
Use the following code to draw into that window.
void DrawBitmap(CBitmap* pBitmap, CWnd* pWindow, CPoint Offset)
{
BITMAP bmpInfo;
pBitmap->GetObject(sizeof(bmpInfo), &bmpInfo);
CSize srcSize;
srcSize.cx = bmpInfo.bmWidth;
srcSize.cy = bmpInfo.bmHeight;
CClientDC* pDC = new CClientDC(pWindow);
CDC* memDC = new CDC; memDC->CreateCompatibleDC(pDC);
CBitmap* old = memDC->SelectObject(pBitmap);
pDC->BitBlt(Offset.x, Offset.y, srcSize.cx, srcSize.cy, memDC, 0, 0, SRCCOPY);
memDC->SelectObject(old);
delete memDC; memDC = 0;
delete pDC; pDC = 0;
}
Regards
If I have seen further, it is by standing on the shoulders of giants.
Isaac Newton
|
|
|
|
|
Hi All,
I am simply adding a checkbox control in my MFC application.... after the addition of this control the application doesnt start at all... and when i remove the checkbx control, the application works perfectly.... .
Can anyone suggest the reason .... or solution to this problem ?
Thanks in advance...
mukhan
|
|
|
|
|
Mukhan wrote:
adding
Can you shortly describe how you did that ? What kind of MFC App is it ? Simply added the checkbox in the dialog editor, recompiled, and then it does not start anymore ? In Debug Mode ?
~RaGE();
|
|
|
|
|
Hi,
Its an MFC application which is getting the data from CAN bus and one thread is runnning for to get data from one PCI I/O Card.... MFC is used only for GUI. One check box is added and is been defined as CButton and BOOL in class wizard .... the same thing i did for another application which is used to get the data from xPC Target (RTOS) over TCP/IP connection... there the checkbox is working perfectly....
CButton m_check_save;
BOOL m_check_save_1;
I havent done any operation with this BOOL yet ... i just want to perform an operation if this checkbox is checked......
like
if(m_check_save_1){
// do this this .....
....
}
I am compiling it and then trying to start the application in debug mode....
Have a look now .....
|
|
|
|
|
currently, i have a large amount of data to be processed. hence, i decide to distribute the work load through several computers within LAN. i get some TCP code through code project to perform data transfer, they work well.
however, speed during the transfer is my major concern. i know TCPis slower than UDP. i plan to use UDP. i was wondering is there any code example on UDP file transfer? yup, by using winsock, not MFC. i don't want my system heavily depend on MFC.
thank you very much!
|
|
|
|
|