|
are you talking about shellexecute win32 api verb?
"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,you can use win32 and api!
but it's best to use mfc
like:
you check a button,the dlg can show the "ppt" files
|
|
|
|
|
wangafei wrote: but it's best to use mfc
MFC has no such mechanism for what you are after. Use ShellExecute() as has been suggested.
"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
|
|
|
|
|
|
HI,
I have an application in which is not using mfc.But i got a requirement that i need to create and display a dialog box. Existing application is a Regular DLL.
Thanks & Regards,
Rajeev
|
|
|
|
|
|
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
|
|
|
|
|