|
because of MapMode
modified on Wednesday, August 26, 2009 4:45 AM
|
|
|
|
|
And why do you need the following statements?
Amin.Abdi wrote: BYTE* pBitmapData = new BYTE[ BitmapImageSize ];
ZeroMemory( pBitmapData, BitmapImageSize );
Bitmap.SetBitmapBits(BitmapImageSize, pBitmapData);
Bitmap.SetBitmapBits( BitmapImageSize, pBitmapData );
The last line is because you don't trust MFC ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I change my codes :
remove that statement and add these:
CClientDC dcMem;
dcMem.SelectObject(&Bitmap);
pDC->BitBlt(1280, nYposChange-1995, 390, 230, &dcMem, 0, 0, SRCCOPY);
but it show a print screen of window and print nothing. WHY and how can i fix it?
|
|
|
|
|
You should put your drawing code inside the CView::OnDraw method.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i put it on a function and call the function in C..View::OnDraw.
|
|
|
|
|
I would do this test:
CDC memDC;
memDC.CreateCompatibleDC(pDC);
dcMem.SelectObject(&Bitmap);
pDC->BitBlt(0, 0, 390, 230, &dcMem, 0, 0, SRCCOPY);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
THANX
|
|
|
|
|
You are welcome.
As about negative height, when you should make something work, I suggest the 'stay simple' principle: start trying with 'fail-proof' parameters and then, when it works a bit, began to change..
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I have today date, how can I get the date of 15,30,45 days back?
My code is to get today date and time:
CTime newtime=CTime::GetCurrentTime();
struct tm temp;
newtime.GetLocalTm(&temp);
WCHAR szStr[20];
wsprintfW(szStr,_wasctime(&temp));
AfxMessageBox(szStr);
|
|
|
|
|
MPTP wrote: I have today date, how can I get the date of 15,30,45 days back?
You could use the COleDateTime[^] class. Just take a look at the member functions the class has to offer. Given a date, the class offers ways to find the day of the year, from which you'd have to subtract 15, 30 or whatever. Try it and if you didn't succeed, post whatever you tried (the code).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Create a CTimeSpan[^] object with the correct number of days and substract it from your CTime object.
BTW, you don't need to make such a complex conversion to print the time in a string. Do yo know that CTime has a Format[^] function which is probably far easier to use than to convert to a tm structure first ?
Another point: is there a particular reason why you are using wide-char strings instead of unicode independant strings (TCHAR) ? You might want to read this article[^].
|
|
|
|
|
Hi everybody,
I don't know is this the right forum to ask this question. Guide me if I am wrong.
Right now I am working on some network related file systems.
My difficulty is to determine the desired access level of a file in its shared mode.
For example, I have a file opened with some dwDesiredAccess level flags set using CreateFile API.
Some other process is asking for the same file with a different dwDesiredAccess level flags which may or may not succeed when I call the CreateFile API.
Is there a way I can determine the result of the second CreateFile API without calling it?
ie, is there a way I can validate the second dwDesiredAccess by checking with the first dwDesiredAccess and return ERROR_SHARING_VIOLATION to the client without making a call to CreateFile API?
Please let me know if some good articles or other useful information available anywhere.
Thanks in advance
cheers
Varghese Paul
|
|
|
|
|
Just check GetAclInformation([^] and ACL.
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi Paul,
In a nutshell, you just want to know the available access level of a file and you do not want to call CreateFile if the desired access level is not available for that file? If I have understood your query correctly, then you could try this:
int nCheck = 0;
int nReturn = _taccess(_T("C:\\Users\\Rajesh\\Downloads\\7z465-x64.msi"), nCheck);
if(nReturn == 0)
{
}
if(nReturn == -1)
{
}
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Varghese Paul M wrote: Is there a way I can determine the result of the second CreateFile API without calling it?
ie, is there a way I can validate the second dwDesiredAccess by checking with the first dwDesiredAccess and return ERROR_SHARING_VIOLATION to the client without making a call to CreateFile API?
I don't believe so...and anyway, even if you could, the results could be invalid (by someone opening another handle on the file) before you could use them. Just open the file and be done with it. If it fails, it fails! But Win32 will tell you, through a combination of return code and GetLastError.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi everybody
I am writing a dll in C++.Net. I had a .h and .cpp file in visual C6.0 and I want to use it here,but there is no lib. First, I set the paths in project properties, but because there is no lib file, I only set the .h file path there. But while compiling there were two LNK errors: LNK2028 and LNK2019. I add it manually in the "Header files" section and "Source Files" section. But there is an error like this while compiling:
LNK1107: Invalid or corrupt file, cannot read at 0x306
I also include it in my code. What's wrong? Would you please help me?
Thanks in advance
|
|
|
|
|
Did you add the cpp file to the project? I don't mean the paths to folders where the cpp or header is sitting, i mean the file itself? If not, could it be that the unresolved symbols are defined in that cpp?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
of course I did. I added both the .h and the .cpp file in the solution explorer.
|
|
|
|
|
Sounds to me like you're linking against something that claims to be a .lib or .obj file, but isn't - could that be the header file?
I think you actually want to be adding the .h and .cpp files to your project and building them into it.\, from your question.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I did it. I added the .h and .cpp file in the solution explorer and build the project. but it doesn't work.
|
|
|
|
|
MozhdehQeraati wrote: doesn't work
'Doesn't work' encapsulates sooo many ba things...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
A question is such:overload a function OnSize(). I want, that buttons at the stretch of basic window either upwards or to the right saved the positions in relations to the overhead and right edges of main window.
Code:
void CMobileTISDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(Flag)
{
int nCount = ResData.size();
for(int i=0;i<nCount;i++)
{
GetDlgItem(ResData[i].nID)->SetWindowPos(&wndTop, cx - ResData[i].aPoint.x, cy - ResData[i].aPoint.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
}
}
ResData is a vector, containing structures
Код:
struct ResizeStruct
{
CPoint aPoint;
UINT nID;
};
Filling of structure:
void CMobileTISDlg::SetResData(UINT nID)
{
ResizeStruct Res;
CRect rc, rcForm;
GetDlgItem(nID)->GetClientRect(&rc);
GetClientRect(&rcForm);
Res.aPoint.x = rcForm.right - rc.left; Res.aPoint.y = rcForm.bottom - rc.top;
Res.nID = nID;
ResData.push_back(Res);
}
A problem is such: at testing of the program the buttons appear in one place in the left corner of the program.
Started a debugger? top and right of Rect rc in function SetResData() are always equal to the zero. What is my error in?
modified on Wednesday, August 26, 2009 1:56 AM
|
|
|
|
|
Instead of this:
zhenek91 wrote: GetDlgItem(nID)->GetClientRect(&rc);
try this:
GetDlgItem(nID)->GetWindowRect(&rc);
ScreenToClient(&rc);
Also, read this[^] and pay attention what the remarks section says.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
It's not an answer to your question, but you might be interested in this section[^] in the articles. Why redoing something that has probably already be done ?
|
|
|
|
|
Thank you, first variant helped me to solve problem
modified on Wednesday, August 26, 2009 2:45 AM
|
|
|
|