|
|
it's a good idea,but mfc si the best!
|
|
|
|
|
HI Alok,
Problem is existing application in non mfc. for displaying a small dialog do i need to make that existing application also Mfc one. please guide.
Thanks,
Rajeev
|
|
|
|
|
Rajeev.Goutham wrote: Problem is existing application in non mfc. for displaying a small dialog do i need to make that existing application also Mfc one. please guide.
No not necessary, you can create dialog box in non-mfc environment also. MFC is just wrapper around win32 based apis
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
yes! mfc can use api and win32
so you can do anything without mfc
but it's not easy
|
|
|
|
|
wangafei wrote: yes! mfc can use api and win32
so you can do anything without mfc
but it's not easy
Agreed, however it's the project choice to utilize services of MFC or not. if the project is targeted to basic win32, then let it be.. anybody who can program in MFC can program in win32 too.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks Alok, will check that.
Thanks,
Rajeev
|
|
|
|
|
I am trying to draw image using bitblt method. When I try to
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
it works and image is getting drawn but when I use
Bitmap *bitmap = Bitmap::FromFile(L"d:\\Projects\\res\\state.bmp");
It does not draw any image...
Pleas help to sort out the problem. I need to draw image directly from path, not from resource and using bitblt only..
|
|
|
|
|
I coded like this for my application.
CString bmpFilePath;
HBITMAP hBmp;
hBmp = (HBITMAP)::LoadImage(NULL,bmpFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp;
bmp.Attach(hBmp);
CDC dcImage;
if(!dcImage.CreateCompatibleDC(pDC))
return;
BITMAP bm;
CBitmap* pOldBitmap;
bmp.GetBitmap(&bm);
pOldBitmap = dcImage.SelectObject(&bmp);
pDC->BitBlt(350,100, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
dcImage.SelectObject(pOldBitmap);
Anu
|
|
|
|
|
|
Check bmp file is avaialble in folder.Otherwise it returns NULL.
Anu
|
|
|
|
|
Thanks its working...but what I need to change in code If I load a png/jpg image...
|
|
|
|
|
I use this code
HBITMAP mLoadImg(WCHAR *szFilename)
{
HBITMAP result=NULL;
Gdiplus::Bitmap* bitmap = new Gdiplus::Bitmap(szFilename,false);
bitmap->GetHBITMAP(NULL, &result);
delete bitmap;
return result;
}
Note: You have to startup and shutdown the GDI+ system. I usually do this in apps initialization and destruction (winmain or main if not mfc apps)
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
hInst = hInstance;
InitCommonControls();
DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
Gdiplus::GdiplusShutdown(gdiplusToken);
}
|
|
|
|
|
MFC by default support only BMP file, however you can take services of different library that suits your need, one of them is gdiplus, search Google for more information
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You've not shown the code that actually draws the image, but I'll take a guess at the problem. In your first code snippet, it is a CBitmap instance that will be used for drawing. In your second snippet, it is a pointer to a Bitmap instance that is used. Your drawing code will need to be adjusted accordingly.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
, basically my motive is to draw image (png/jpg) using bitblt...I will adjust code accordingly.
|
|
|
|
|
|
Thank you for help...I am able to draw image.
I need your help in one more problem as described below:
I need to draw image on the screen using XOR so that diff of 2 images can be draw as a complete image. How to solve this?
|
|
|
|
|
first you can get the path,then set ID and path link!
so,your first method can do it
|
|
|
|
|
Hi, I want 3 split windows in my application,in that left for Tree control and Right window act as a main window and bottom window have list control to show some log of my application. For that i made this code..
in Mainframe.cpp(), in OnCreateClient()
if(!m_SplitterWnd.CreateStatic(this, 2, 1))
return FALSE;
CRect rect;
GetClientRect(&rect);
if(!m_SplitterWnd.CreateView(1, 0, RUNTIME_CLASS(CBottomView), CSize(rect.Width(), 50), pContext))
return FALSE;
m_SplitterWnd.SetRowInfo(0, 800, 50);
m_SplitterWnd.SetRowInfo(1, 330, 50);
if (!m_SplitterWnd1.CreateStatic(&m_SplitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER |AFX_IDW_PANE_FIRST, m_SplitterWnd.IdFromRowCol(0,0)))
return FALSE;
if(!m_SplitterWnd1.CreateView(0, 0, RUNTIME_CLASS(CTreeMenuView), CSize(rect.Width()/5,rect.Height()-50), pContext))
return FALSE;
if(!m_SplitterWnd1.CreateView(0, 1, RUNTIME_CLASS(CMainWindowView), CSize(rect.Width()-rect.Width()/5,rect.Height()-50), pContext))
return FALSE;
int nWidth=rect.Width();
m_SplitterWnd1.SetColumnInfo(0, nWidth*0.25, 50);
m_SplitterWnd1.SetColumnInfo(1, nWidth*0.75, 50);
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
And i have to attach all my child window in right side window( CMainWindowView)..
In my app class,
pDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CABBHarmonyDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMainWindowView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
pGraphViewTemplate = new CMultiDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CABBHarmonyDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CGraphview));
AddDocTemplate(pGraphViewTemplate);
So when i press F5,this GraphView should display in MainwindowView.
But it does not appear.Whats the mistake i did? Pls help me..
in Mianframe.cpp
void CMainFrame::OnGraphview()
{
if( pGraphDisplayFrame == NULL )
{
CDocTemplate *pTemplate = theApp.pGraphViewTemplate;
CABBHarmonyDoc* pDoc = new CABBHarmonyDoc;
pGraphDisplayFrame = (CMDIChildWnd *)pTemplate->CreateNewFrame( pDoc ,NULL );
if( pGraphDisplayFrame == NULL )
{
AfxMessageBox( "Unable to Create Graph Display" );
return;
}
pTemplate->InitialUpdateFrame( pGraphDisplayFrame,NULL );
}
else
MDIActivate( pGraphDisplayFrame );
}
When i debug, i found in winfrm.cpp,
void CFrameWnd::InitialUpdateFrame(CDocument* pDoc, BOOL bMakeVisible)
{
CView* pView = NULL;
if (GetActiveView() == NULL)
{
CWnd* pWnd = GetDescendantWindow(AFX_IDW_PANE_FIRST, TRUE); if (pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CView)))
{
pView = (CView*)pWnd;
SetActiveView(pView, FALSE);
}
}
Here pWnd returns NULL. Whats the mistake pls help me out.
Anu
|
|
|
|
|
You are allocating a new uninitialized instance of your document in OnGraphView() and use it for creation of the new frame. You should replace the pDoc parameter by your existing document.
You may also move the OnGraphView() handler from the main frame class to your document class (passing then this for the document pointer). Because the graph can be only shown when a document has been loaded.
|
|
|
|
|
I have a bit of strange behavior with a MFC application that I haven't seen before.
The application is a simple MFC Dialog running unders Windows XP SP3 and using Visual Studio 2008. It builds fine under Debug and Release configurations. The Debug executable runs fine under the debugger and also within Visual Studio using the Start Without Debugging button. The Release executable runs fine directly from Windows.
However, the Debug executable does NOT run fine directly from Windows. When double clicked from Windows Explorer, there is a brief hourglass and then what appears to be a quick exit. No messages, no nothing. Adding a few AfxMessageBox calls to the app's CWinAppEx class, it appears that not only does the app's InitInstance method not get called, but even the CWinAppEx constructor does not get called. Obviously, this makes debugging the problem somewhat difficult.
Anyone seen similar behavior before? Seems like it might be a manifest problem of some sort, but I don't see why it would only affect the Debug executable and only directly from Windows.
Additional Info: With a little more testing, I found that this behavior occurs even in a simple test application as soon as I add any code that requires an internally developed DLL. Note that if I rename this DLL, I get the usual can't find the DLL message. So the app is finding the DLL, but for some reason, in Debug configuration, there's a problem only when running directly from Windows.
modified 8-May-12 14:47pm.
|
|
|
|
|
Does the "internally developed DLL" have any resources that are being used by the EXE or is it just exported functions that are being used?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 9-May-12 9:17am.
|
|
|
|
|
Do you have the sources/project for this "internally developped DLL"? If yes, try the following: load the project for the DLL, build it and hit F5, VS should ask you to specify the executable you want to test your DLL with (if it doesn't, you can specify that somewhere in the project settings, can't recall where now), browse for your exe, select it and let it run (make it so it will load the DLL you just built, like, placing the executable right next to the DLL) and see if there are any exceptions thrown, check the debugger's output window too for any hints, maybe you will see something useful.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hello Experts,
I need to transfer image via Socket, somtimes image may be same or may somewhat similar.
I am trying to get diffrenece of images so that I can be sent faster via socket.
Image type is jpeg...Please suggest how to send min data of image?
|
|
|
|
|