|
see if u have initialized it first. like khan said
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Hello,
You should beware of the UNICODE problems that your code have when you compile with UNICODE defined. See the following where your problems are:
const char* FileName
= _T("C:\\1.bmp");
To solve this problem, use TCHAR* instead of char* where you want to use the _T macro.
[EDIT]
You should also use the macros from tchar.h[^] so that you use UNICODE functions when you build with UNICODE defined.
[/EDIT]
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
-- modified at 9:43 Tuesday 20th December, 2005
|
|
|
|
|
Hey. If m_FileName happens to be a CString, then just do this instead:
mFileName = FileName
instead of using anything like strcpy.
You are LUCKY you got the access violation now and not 10 months from now with 10 million copies of your app in the field
No shirt, no shoes, no brains, no service.
|
|
|
|
|
|
Show me EXACTLY here the m_FileName is defined or declared in his original post?
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Since you are using mfc why not use CString and let all this memory allocation for strings automatically be handled for you??
John
|
|
|
|
|
vikas amin wrote: strcpy(m_FileName,FileName);
Why are you not using CString ?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
vikas amin wrote: strcpy(m_FileName,FileName);
Hai Vikas,
what type of variable is m_FileName
"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 have a class in which there is a structe
i want to initialize the structre through the constructer .
class xyz{
struct tagBITMAPFILEHEADER
{
WORD bfType; // must be 'BM'
DWORD bfSize; // size of the whole .bmp file
WORD bfReserved1; // must be 0
WORD bfReserved2; // must be 0
DWORD bfOffBits;
}m_BITMAPFILEHEADER ;
xyz()
{
BITMAPFILEHEADER ={0,0,0,0,0};
}
}
I am getting an error
error C2059: syntax error : '{'
error C2143: syntax error : missing ';' before '{'
am i wrong someware
}
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
If the code that you post is the real code there is a little error:
vikas amin wrote: xyz()
{
BITMAPFILEHEADER ={0,0,0,0,0};
}
xyz()
{
m_BITMAPFILEHEADER ={0,0,0,0,0};
}
Have a nice code day
|
|
|
|
|
|
Sorry that was not the real code it is not copy pasted
i typed it again .
The real problem is how to initialise the structure .
Can anyone tell me
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
Why don't use
xyz()
{
m_BITMAPFILEHEADER.bfType=0;
m_BITMAPFILEHEADER.bfSize=0;
m_BITMAPFILEHEADER.bfReserved1=0;
m_BITMAPFILEHEADER.bfReserved2=0;
m_BITMAPFILEHEADER.bfOffBits=0;
}
Because, I don't remember if you could use ={0,0,0,0,0} in that point
Have a nice code day
|
|
|
|
|
My favorite,
ZeroMemory(m_BITMAPFILEHEADER, sizeof(m_BITMAPFILEHEADER));
if you want to set everything to 0.
Does not work if a class with complex objects is embedded wihtin the structure, such as a CString, however.
I can't believe how many times I have seen code setting data structure's fields to all zeroes, when there are several dozen fields, instead of block setting the entire element. If I only had a dollar...
No shirt, no shoes, no brains, no service.
|
|
|
|
|
I understand you!!!
This happens, really, too many times.
Have a nice code day
|
|
|
|
|
Hi everybody,
I need to implement Doc/View/Frame in an ActiveX control. I have tried to copy the code from a standart MFC Wizard generated SDI application in a standart Wizard generated ActiveX control, but it didnt work - all I could get was a bunch of crashes (for the document, I derived my class from COleDocument). Can anybody point me in the right direction. Any information is appreciated.
Thanks in advance,
Dennis.
|
|
|
|
|
hello,
i changed the background color of my dialogs in a dialog based MFC app by adding the following code:
SetDialogBkColor(RGB(150, 150, 150), RGB(0, 0, 0));
in my dialog based applications "Initinstance". However though the dialogs have all changed color, the background color of MessageBox() has not, and also the menu Button (Like File, Edit, Help) bar still follows the windows theme color. The menu options however show in white which is fine. I just want to change the background color of my messagebox and the color of my top menu.
Any pointers on how to do this?
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
Hi,
can anyone tell me how to use a bitmap as a background for my title bar? I have used a bitmap background for the dialogs and the title bar looks very out of place.
thankx
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
|
the content of a.txt as follows:
1121234 aaaaaa
2223 asdf
222fs adfa
....
how to write the data from a.txt into b.xls?
|
|
|
|
|
I don't know if this will solve your problem because I am not familiar with the .XLS format, but Excel also likes .CSV files. These are files with text values separated by commas:
1,3,5 = will appear in three columns in Excel.
You could insert commas between the values on the same line like:
1121234,aaaaaa<br />
2223,asdf<br />
222fs,adfa
etc and name it "something.csv".
this is this.
|
|
|
|
|
I insert commas between the values on the same line like:
1121234,aaaaaa
2223,asdf
222fs,adfa
and name it "a.csv"
the data separated by the commas are inserted into different cell in the "a.csv"
but I name it a.xls,the data of each line in the "1.txt" file are inserted into a cell.
How should I do?
Thank you.
|
|
|
|
|
Hi all,
I'm using MSXML to load and parse serveral xml files (quite obvious ). All works fine while the encoding of the file is utf-8 but when i load a file that has the following header
?xml version="1.0" encoding="UTF-16"?
i get an error telling that the encoding is not supported.
How can I load files encoded in utf-16?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Hello
I have in my application a dialog with CHtmlView Object contained in it.This object allows me to open a html page within my dialog,this html page allows me to upload certain file(using some upload component).
the problem that i m facing is that as the upload is in progress if i close the dialog(which in turn kills the ChtmlView object)the upload is still in progress n still acesses the files(files to be uploaded),coz of which i cannot access these files later(sharing violation error).
ne solutions can let me know at shailesh@email.philnet
thanks
|
|
|
|