|
I also think on occasion these types of files are given the extension .RLL so that they are not summarily loaded by other programs.
Just a thought if you have any say in the matter.
|
|
|
|
|
Hi,
I am going through same issue. I have used /noentry link option but still issue is there.
Platform:
eVC++ 4.2
SDK: pocket pc 2003
Any idea?
Thanks in advance
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
Hello,
I once again have problems with the file iostreams from the STL provided with visual studio (2005).
I use the std::ofstream to write data to a file. I verified all the data and everything here works like a charm. The problem here is when I try to read the data back from the file using the std::ifstream class. It reads more bytes than I say it should read. Take a look at my code:
void ReadData(std::ifstream& InFile, char* pData, size_t nCount)
{
assert( pData );
assert( nCount > 0 );
int nPos = InFile.tellg();
try
{
for( size_t i = 0; i < nCount; i++ )
(*(pData + i)) = InFile.get();
}
catch( std::exception& ex )
{
InFile.seekg(nPos);
}
}
I removed all the debug code and output statements. My scenario is as follows:
- I have a binary file,
- I read (nCount = 410 ) bytes
- The stream reads 499 bytes
I really don't know what might be wrong here.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Well, urm...
I opened the stream in text mode (default) and it should be opened in binary mode. I guess I got confused with MFC's CFile class, which always doesn't care about text and binary mode. It just doesn't manipulate data.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I have finally managed to get a rebar working on a MDI window, my problem now is that when the window resizes horizontally the rebar does not so it leaves a blank area next to the bar.
What do I need to do to make it size properly with the parent window?
Thanks in advance!
|
|
|
|
|
Please let me know which interfaces of directshow will get me information of all types of media files(audio,video,dvd etc) such as duration, type, album, genre,playlist etc. I want to match these info with that available in windows media player.
|
|
|
|
|
hello all,
currently, I am trying to have fixed size in my parent mdi.
1. in my PreCreateWindow of my parent mdi, i try to use
cs.x = A_FIXED_X_SIZE
cs.y = A_FIXED_Y_SIZE
however, when my app startup, i didnt get the size i want for parent mdi. i have to double click the title bar of the parent mdi to get my desired size. how i can get my desired size immediately once the app startup?
2. although i disable the maximize, restore button, user still can size the parent mdi by moving the mouse cursor to the border of the window. how can i prevent user from re-sizing my mdi?
thank you very much
cheok
|
|
|
|
|
I also need to fix the size of my child window.How did u proceed in setting size?Can you elaborate more on the two statements you have written.You have used CPoint class?
please reply urgently
|
|
|
|
|
yccheok wrote:
1. in my PreCreateWindow of my parent mdi, i try to use
cs.x = A_FIXED_X_SIZE
cs.y = A_FIXED_Y_SIZE
cs.x and cs.y are for the left and top sides respectively. You also need to assign values to cs.cx and cs.cy .
yccheok wrote:
2. although i disable the maximize, restore button, user still can size the parent mdi by moving the mouse cursor to the border of the window. how can i prevent user from re-sizing my mdi?
Remove the WS_THICKFRAME style. See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hello,
thanks for replying.But since i am a novice programmer I would appreciate if you would elaborate more on this code.Like how your using the code? Are you using CREATESTRUCT and CPOINT class? and are you making changes only in the PreCreateWindow()of each view window?
Please expalin in detail
thanks once again
|
|
|
|
|
sayup wrote:
I would appreciate if you would elaborate more on this code.Like how your using the code?
Was it not explained well enough?
sayup wrote:
Are you using CREATESTRUCT and CPOINT class?
The PreCreateWindow() method uses the CREATESTRUCT structure. Did you not notice that in your code snippet?
sayup wrote:
are you making changes only in the PreCreateWindow()of each view window?
No, this only happens in the frame (i.e., the "parent").
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
can anybody tell me how to access to a serial device from two threads simultaneously? The problem: I open a serial device in a function (with 'CreateFile(...)') and then I start one thread for writing to this device and one for reading. Reading and writing must be independent, because I can receive unexpected data or have to send some unexpectedly.
Passing the device's handle to the threads just lets one thread (the one which tries to access later) crash. In the writing thread I call 'WriteFile(hdlSerDev,...)', in the reading thread I call 'WaitCommEvent( hdlSerDev,...)'.
Juergen Kordes
|
|
|
|
|
Juergen Kordes wrote:
I start one thread for writing to this device and one for reading. Reading and writing must be independent, because I can receive unexpected data or have to send some unexpectedly.
Passing the device's handle to the threads just lets one thread (the one which tries to access later) crash.
I believe, only one thread can open port at a time. if not, you have to apply concept of thread syncronization i.e. crtical section
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi,
I have these video files which i can select to be played. I got this play button in a dialog in MFC. However I have no idea how to call the windows media player to play the file i have selected. Any advise on how to call the media player to play my selected file eg. " soccer.avi"
tks.
Aaron
|
|
|
|
|
Anonymous wrote:
I got this play button in a dialog in MFC. Any advise on how to call the media player to play my selected file eg. " soccer.avi"
Do you need to embed media player in your dialog or just invoke it as a separate application? If the latter, try opening the file by calling ShellExecute or ShellExecuteEx ; it'll launch the application associated to the media type. Or you may explicitly call the media player and pass the media file as a parameter.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
hi
i m trying to get the ip adress of my computer through code.i had used this code for that purpose.
char name[256];
HOSTENT *obj;
gethostname(name,sizeof(name));
MessageBox("The name is",name);
obj=gethostbyname(name);
if(obj==NULL)
MessageBox("The ERROR name is");
// adress of computer is saved in obj->h_addr_list field which is 2d array of strings.i had used this method to get the ip
// but it does not work.
else
{
for(int i=0;i<obj->h_length;i++)
MessageBox("ip adres is",obj->h_addr_list[i]);
}
then if i directaly use that code but it give the error that cannot convert char** to const char.
MessageBox("ip adres is",obj->h_addr_list);
then i had used another method whic is but it does not work also.
char **temp;
temp=obj->h_addr_list;
for(int i=0;i<obj->h_length;i++)
MessageBox("ip adres is",temp[i]);
can anybody help me how to do that or get the values form that field.
ddd
|
|
|
|
|
tasleem143 wrote:
m trying to get the ip adress of my computer through code.i had used this code for that purpose.
Try This Code:-
hostent *p;
p=::gethostbyname(HostName);
char *ip=inet_ntoa(*(struct in_addr*)*(p->h_addr_list));
ip contain the ipaddress of computer
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi all,
Iam using Keith Rule's CMemDc class & I have changed it according to my requirement.Iam posting that class also here.
Now Iam zooming my View using "SetWorldTransform" call.
My problem now is when I change the zoom factor to below or above 100,the Fonts are not smooth.
The following are my codes:
//Creating Font like this in "MyView" constructor.Don't want to use FixedFonts.
m_oFont.CreatePointFont(120, _T("Courier New"));
LOGFONT oLogfont;
m_oFont.GetLogFont(&oLogfont);
//OnPrepareDc looks like this.
void MyView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
pDC->SetMapMode(MM_TEXT);
SetGraphicsMode(pDC->GetSafeHdc(), GM_ADVANCED);
pDC->SelectObject(&m_oFont);
pDC->GetTextMetrics(&m_TextMetrics);
XFORM xForm;
xForm.eM11 = 0.01 * m_iZoomFactor;
xForm.eM21 = 0;
xForm.eDx = 0;
xForm.eM12 = 0;
xForm.eM22 = 0.01 * m_iZoomFactor;
xForm.eDy = 0;
pDC->GetTextMetrics(&m_textMetrics);
SetWorldTransform(pDC->GetSafeHdc(), &xForm);
CScrollView::OnPrepareDC(pDC, pInfo);
}
//My "OnDraw" looks like this.
void MyView::OnDraw(CDC* pDC)
{
CpagesDoc* pDoc = GetDocument();
CSize sizeTotal;
//default scrollsizes to 80 chars X 80 lines.
sizeTotal.cx = 80;
sizeTotal.cy = 80;
//Client Rectangle Size.
CRect rect;
GetClientRect(&rect);
//Creating a temporary Dc.
C_TempDc tempDC(pDC,m_oFont,&rect);
int pageWidth = 800;
int pageHeight = 800;
//int pageGap = 5;
int pageNumber =3;
SIZE size;
size.cx = 1000;
size.cy = (pageHeight*3)+100;
//First Page
tempDC->Rectangle(CRect(0,0,pageWidth,pageHeight));
tempDC->TextOut(5,10,"This is the first line on the FirstPage");
sizeTotal.cx *= MulDiv(m_textMetrics.tmAveCharWidth, m_iZoomFactor, 100);
sizeTotal.cy *= MulDiv(m_textMetrics.tmHeight, m_iZoomFactor, 100);
SetScrollSizes(MM_TEXT, sizeTotal);
}
//Keith Rule's Memory Buffer
#ifndef C_TEMPDC_H
#define C_TEMPDC_H
class C_TempDc : public CDC
{
public:
C_TempDc(CDC* pDC,CFont & font,const CRect* pRect = NULL): CDC()
{
ASSERT(pDC != NULL);
//Initialising.
m_pDC = pDC;
m_oldBitmap = NULL;
m_oldFont= NULL;
//Getting ClipBox Rectangle.
pDC->GetClipBox(&m_clipRect);
//Client Rectangle.
m_clientRect = *pRect;
pDC->DPtoLP(&m_clientRect);
// Create a Memory DC
CreateCompatibleDC(pDC);
//pDC->LPtoDP(&m_rect);
m_bitmap.CreateCompatibleBitmap(pDC,m_clientRect.Width(),m_clientRect.Height());
pDC->LPtoDP(&m_clientRect);
m_oldBitmap = SelectObject(&m_bitmap);
///Selecting the Font.
m_oldFont = SelectObject(&font);
SetMapMode(pDC->GetMapMode());
pDC->DPtoLP(&m_clientRect);
SetWindowOrg(m_clientRect.left,m_clientRect.top);
// Fill background
FillSolidRect(m_clientRect, pDC->GetBkColor());
}
~C_TempDc()
{
// Copy the offscreen bitmap onto the screen.
m_pDC->BitBlt(m_clipRect.left,m_clipRect.top,m_clipRect.Width(), m_clipRect.Height(),
this, m_clipRect.left,m_clipRect.top, SRCCOPY);
//Swap back the original bitmap & font.
SelectObject(m_oldBitmap);
SelectObject(m_oldFont);
}
C_TempDc* operator->()
{
return this;
}
operator C_TempDc*()
{
return this;
}
private:
CBitmap m_bitmap;
CBitmap* m_oldBitmap;
CFont* m_oldFont;
CDC* m_pDC;
CRect m_clientRect;
CRect m_clipRect;
};
#endif//C_TEMPDC_H
Hope someone can Help....
|
|
|
|
|
Is there any method found in the IDE of Visual C++ 2003 to remove functions seen in "Class View"? (other than manually delete text in .cpp and .h.)
Thanks!
Maxwell Chen
|
|
|
|
|
hello,
I need some help on how to open a MDI mainframe window in the maximized form at the startup.Also i want to remove the minimize and maximize buttons from toolbar.
thanks
|
|
|
|
|
THello
Override PreCreateWindow in your main frame class and then add the following lines
cs.style |= WS_MAXIMIZE;
cs.style &= ~(WS_MINIMIZEBOX |WS_MAXIMIZEBOX);
Thanks
--Antony
|
|
|
|
|
I have the following .h file to hold all my enums
#pragma once
enum WordDirection
{
Right = 0,
Down,
Diag_Down,
Diag_Up
};
my code in the class is
...
WordDirection wDir = (WordDirection)(int)(rand()%4);
...
switch( wDir )
{
case (int)WordDirection.RIGHT:
x_add = 1;
y_add = 0;
if( x <= this->Width() - length )
isPlaced = true;
break;
}
...
any ideas whits not recognized in a switch? I get a c226 error. "unexpected type"
please help me.
This is VC 2003
Thanks,
Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Instead of this:-
Ista wrote:
switch( wDir )
{
case (int)WordDirection.RIGHT:
x_add = 1;
y_add = 0;
if( x <= this->Width() - length )
isPlaced = true;
break;
}
write
case RIGHT , because WordDirection is not structure or class variable
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello,
You have several problems in your code! They may not seem to be a problem at first sight, but eventually they will lead to trouble. Some of your errors are in your programming style, others are in your code that causes the compiler to shout error messages at you. Here are the errors that caught at a first look:
enum WordDirection
{
Right = 0,
Down,
Diag_Down,
Diag_Up
};
This is not a syntax error, but a more problem in large projects. The reason for this is that in large projects, a lot of names are made up. If you don't put everything in their own namespace or class, name clashes are the inevitable result! A better solutions would be:
namespace WordDirection {
enum Direction { Right = 0,
Down,
Diag_Down,
Diag_Up
};
}
class WordDirection
{
public:
enum Direction { Right = 0,
Down,
Diag_Down,
Diag_Up
};
};
Your other problems are with your switch statement:
case (int)WordDirection.RIGHT:
Three problems here:
<list>1: The typecast. You don't need to typecast integral constants to int. Especially not in constant expressions. The type of constants is int by default.
2: WordDirection.RIGHT WordDirection is not an instance of a class. Therefore the 'operator .' won't work!
An other thing, if you use enums, all the constants declared in the enum are made publicly available to the namespace in which the enum is declared! Therefore you can just use RIGHT, DOWN, etc..
3: "RIGHT" is in capital letters, while your declaration is not completely in capital letters! The C++ compiler is case sensitive and therefore it will issue an error. You should use "Right" instead.
A solution to your problem would be:
case Right:
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Nice explantion , soon it will become part of 45 day series
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|