|
|
|
A UINT is absolutely not the same as a long. They're the same size, 4 bytes, but UINT is unsigned, whereas long is signed.
Also, the sizes may change in future versions of the compiler.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
His question was whether or not they (a UINT and a long) were the same size.
Yes, they are the same size (in our 32-bit world of VC6).
They were not the same size as a long in 16-bit, but who does 16-bit any more?
|
|
|
|
|
UINT is defined as unsigned int. The int type is different on different machine types. On Windows 32 bit it is 32 bits wide. long is well defined as a 32-Bit signed value on all machines. So int is not long! and UINT equals a unsigned long on a 32-Bit architecture. So on such a machine long equals UINT in that way, that both uses 32 bit (4 bytes). But long uses the highest bit for the +/- sign instead of UINT that has no sign.
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
Thanks for your reply ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
I like to know how can I use the function:
OpenDocumentFile(FileName) in my CView class.
I have a bunch of files, and I like to use this function to open the files.
and each file has to be in a new document.
Thanks
Ehsan Behboudi
|
|
|
|
|
You can use AfxGetApp()->OpenDocumentFile( "filename.ext" );
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Thanks for you reply,,
the filePathName that I pass to the OpenDocumentFile( FilePathName)
is a Bitmap,
it opens an epmty document,, Can you have a look at my code Please..
Thanks
//My application is MDI, and I store a bunch of bitmap pathNames in the
// first docuemnt, pFirstDoc is a pointer to that document.
pApp->OpenDocumentFile(pFirstDoc->m_filePathArray.GetAt(0));
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
CTurboMechView *pView = (CTurboMechView *) pChild->GetActiveView();
pView->LoadBitmap(pFirstDoc->m_filePathArray.GetAt(0));
pView->OnPaint();
Any ideas???
Thanks
Ehsan Behboudi
|
|
|
|
|
What is the problem that you are experiencing?
BTW: Just curious;
> pApp->OpenDocumentFile(pFirstDoc->m_filePathArray.GetAt(0));
[snip]
> pView->LoadBitmap(pFirstDoc->m_filePathArray.GetAt(0));
Why load the bitmap twice? Maybe I dont understand what your doing, but when you call OpenDocumentFile does this not load the bitmap in your document?
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
When I call OpenDocumentFile, it only opens a blank document.
It doesn't display the bitmap.
but when I load it with my pointer to CView, it still won't display the bitmap.
any ideas?
Ehsan Behboudi
|
|
|
|
|
Hmmm... I think I'd have to take a look at what your view is doing. When you call LoadBitmap, I'm guessing the information is stored in the view, what does your painting(WM_PAINT) look like?
It sounds to me like your using the same doc/view pair the first one, and all the rest. Is this correct? If thats the way your doing it, you might consider just attaching a new view to the original document and loading the bitmap from there.
Sorry if I'm rambling... I'm not realy sure what it is your tring to do.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Thanks for replying
this is the whole deal,,
void CTurboMechView::OnToolsNewDocuemnt()
{
// TODO: Add your command handler code here
CWinApp* pApp = AfxGetApp();
CTurboMechDoc *pFirstDoc= GetFirstDocument();
pApp->OpenDocumentFile(pFirstDoc->m_filePathArray.GetAt(0));
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
//CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
CTurboMechView *pView = (CTurboMechView *) pChild->GetActiveView();
pView->LoadBitmap(pFirstDoc->m_filePathArray.GetAt(0));
pView->OnPaint();
// so up there, I loaded the bitmap in the new View, but it still doesn't show it... weird !!!
}
This my OnPaint()
void CTurboMechView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect lrec;
CTurboMechDoc* pDoc=GetDocument();
if(pDoc->m_sBitmap !="" /*&& showstate==TRUE*/)
{
ShowBitmap(&dc,lrec);
}
OnDraw(&dc);
// Do not call CScrollView::OnPaint() for painting messages
}
void CTurboMechView::LoadBitmap(CString file)
{
CTurboMechDoc* pDoc = GetDocument();
if(file!="")
{
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if (hBitmap)
{
// Delete the current bitmap
if (m_bmpBitmap.DeleteObject())
{
m_bmpBitmap.Detach();
}
// Attach the currently loaded bitmap to the bitmap object
m_bmpBitmap.Attach(hBitmap);
}
Invalidate(FALSE); // you may change this to False
//NOTE:IMPORTANT I moved this showstate inside the if
}
}
void CTurboMechView::ShowBitmap(CDC *pdc, CRect trect)
{
BITMAP bm;
CDC dcMem;
CRect lRect=trect;
// Get the loaded bitmap
m_bmpBitmap.GetBitmap(&bm);
// Create a device context to load the bitmap into
dcMem.CreateCompatibleDC(pdc);
// Select the bitmap into the compatible device context
CBitmap* pOldBitmap = (CBitmap*)dcMem.SelectObject(m_bmpBitmap);
lRect.NormalizeRect();
width=bm.bmWidth;
height=bm.bmHeight;
pdc->StretchBlt(0, 0, width*2.28, height*2.28, &dcMem, 0, 0, 255, 255, SRCCOPY);
}
Ehsan Behboudi
|
|
|
|
|
hello
I have a trouble with Sending WM_VSCROLL/WM_HSCROLL message to a ListView
I send WM_XSCROLL to a control for scrolling the control
when i use
::SendMessage(hWnd, WM_HSCROLL, SB_LINELEFT, NULL);
it worked if hWnd is a CEdit handle or CListView handle.
this is send to a CEdit ctrl to scroll the window it works(picture)
this is send to a CListView to scroll the listview it works(picture)
BUT
when i send the drag scroll message to a listview ,it doesn't work
I use :
::SendMessage(hWnd, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nPos) , NULL);
when the windows is a CEdit it works
it works(picture)
BUT when the windows is a CListView
it doesn't work(picture)
I use SPY++ finding the window have received the messages I sended
what's wrong??
HELP HELP
Leadream
I am Bruce
|
|
|
|
|
hello
I have a trouble with Sending WM_VSCROLL/WM_HSCROLL message to a ListView
I send WM_XSCROLL to a control for scrolling the control
when i use
::SendMessage(hWnd, WM_HSCROLL, SB_LINELEFT, NULL);
it worked if hWnd is a CEdit handle or CListView handle.
this is send to a CEdit ctrl to scroll the window it works(picture)
this is send to a CListView to scroll the listview it works(picture)
BUT
when i send the drag scroll message to a listview ,it doesn't work
I use :
::SendMessage(hWnd, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nPos) , NULL);
when the windows is a CEdit it works
it works(picture)
BUT when the windows is a CListView
it doesn't work(picture)
I use SPY++ finding the window have received the messages I sended
what's wrong??
HELP HELP
Leadream
I am Bruce
|
|
|
|
|
hey, does anyone know how to delete a cookie in the temporary internet files folder? because they dont seem to act as files, i couldn't remove one with DeleteFile()
Thanks
Ku
|
|
|
|
|
Does anybody have any adice about learning MFC... I seem to have a hit a bit of a dead end lateley. Im using it lots but sometimes make stupid mistakes and cant realise how to do something. I understand the principles of most things, and quite a bit about messages etc but when I want to actually do something in code I always have so many problems working out the documentation etc an getting it to work. Ive been using the debugger more but 9 times out of 10 it drops us into the guts of MFC where its difficult to have a clue whats going on.... any advice appreciated!
|
|
|
|
|
Make sure you know a good amount of C++ first, so you can figure what the MFC source is doing ( I bury myself in it when I am extending a control, there's no other way ). Buy a good book - every MFC programmer should have the MFC Answer book by Eugene Kain, and download example code from here and play with it. No better way to learn than start with something that works and see what happens when you change/add stuff.
And don't be scared to ask if you get stuck.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi,
Does anyone know how i can change the selection color in a rich edit control.
Cheers
Rich
|
|
|
|
|
Hi,
I have a function which returns a HRESULT. Not quite sure how they work, i know there is loads of constants and stuff for them. But I want to define a constant return value of my own. How do i go about this?
Cheers
Rich
|
|
|
|
|
An HRESULT is the only return permitted by COM, excepting a sleight of hand that I believe does not occur under C++, but VB and other languages for people easily confused. It is a complex structure, but in the first instance you can check using two macros, SUCCEDED() and FAILED, as in
HRESULT hr = pISomeINterface->SomeMethod();
if (FAILED(hr))
{
AfxMessageBox("You've stuffed it again !!!!");
return false;
}
Where did the function come from, and why do you want to change the return value ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
A completely useless anwser! It has nothing to do with the question asked.
|
|
|
|
|
This may be true, to the illiterate or truly stupid.
I'm still at a loss as to why we have pussies here who refuse to put their names to their posts, but I guess if you're going to insult people that would give you a reason to run and hide....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Your wit is to much for me, I leave in shame and disgrace.
|
|
|
|
|
If you want to make your own HRESULT you can use the MAKE_HRESULT macro.
Before you go playing with making your own you need to read some documentation on HRESULTS.
|
|
|
|