|
mesajflaviu wrote: After all , I need a pdf library to read words in .pdf file ... I was thinking that MFC knows something tricky ...
Why would MFC need to bother about PDF files?! MFC is just a wrapper around Windows API. On the other hand, PDF is one of the several hundred proprietary file formats which is not related in any way with Windows or Microsoft. I wouldn't ever expect MFC to make it easier for me to read PDF files.
By the way, if you do a Google search as suggested by two of us, you'll find a whole lot of libraries/code/exmaples which deals with the subject of manipulating PDF files.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
You are right ... I try http://www.pdflib.com/[^] but I didn't find what I need : to read every string from an .pdf file ... and I was thinking that I could read a .pdf file like an binary file or something ...
|
|
|
|
|
|
I'd recommend Haru[^]. Just do a Google search and CodeProject search as well - there are several articles with examples on that topic.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
|
How to use a gif animation in a listctrl as an item image?(MFC)
Thank you.
|
|
|
|
|
To my knowledge, which does not reach very far on this particular subject, I do not think that CImageList allows GIF images.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
You have to manually extract each frame from the gif, place the images in an image list and then change the displayed image based on a timer. Sounds like a good opportunity to create a custom control and write an article here on CodeProject
|
|
|
|
|
Thank you all.It's hard for me. I would post it here if I solved it.
|
|
|
|
|
Trying to subclass a combobox i order to have the entries have a tab stop. When I perform the subclass I get an assert. This code use to work in the early days of MFC but with 2010 it fails. I did not try it with any VS version in between.
Is it something very simple I'm missing?
Thanks
class CTabCBox : public CComboBox
{
public:
CTabCBox() {icTab=0; lpiTab=NULL;}
~CTabCBox() {if (lpiTab) free(lpiTab);}
BOOL SubclassCBox(UINT nID,CWnd* pParent,int icTabs,LPINT lpiTabs);
protected:
int icTab;
LPINT lpiTab;
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMis);
virtual void DrawItem(LPDRAWITEMSTRUCT lpDis);
};
class CtestDlg : public CDialogEx
{
public:
CtestDlg(CWnd* pParent = NULL);
enum { IDD = IDD_TEST_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CTabCBox m_ctrlFontsX;
CComboBox m_ctrlFonts;
};
TEXTMETRIC tm;
int iTab;
if (m_ctrlFonts.GetDC()->GetTextMetrics(&tm))
iTab = (33+8) * tm.tmAveCharWidth;
m_ctrlFontsX.SubclassCBox(IDC_COMBO1,this,1,&iTab);
CString csS("Font title string\tnnnnnnnn");
m_ctrlFontsX.AddString(csS);
BOOL CTabCBox::SubclassCBox(UINT nID, CWnd* pParent, int icTabs, LPINT lpiTabs)
{
DWORD dwcb;
int iRc = 0;
if (lpiTab)
free(lpiTab);
lpiTab = NULL;
icTab = 0;
if (icTabs>0)
{
dwcb = icTabs*sizeof(int);
if (!(lpiTab = (LPINT)malloc(dwcb)))
return(FALSE);
memcpy(lpiTab,lpiTabs,(size_t)dwcb);
icTab = icTabs;
}
iRc = SubclassDlgItem(nID, pParent);
return(iRc);
}
It always fails on the second assert (FromHandle....) from wincore.cpp
BOOL CWnd::Attach(HWND hWndNew)
{
ASSERT(m_hWnd == NULL);
ASSERT(FromHandlePermanent(hWndNew) == NULL);
Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
Hi Tony,
My guess would be that your CtestDlg::DoDataExchange function has a DDX_Control[^] entry for the m_ctrlFontsX member. If I am correct then you should comment it out or remove it. This happens when you right click a control in the VS dialog editor and choose 'Add Variable'. Visual Studio will add a member variable along with a DDX entry in the DoDataExchange function. Essentially what is happening is that MFC has already subclassed the control and added the handle into the internal permanent handle map.
Here is an excellent document explaining MFC handles and temporary CWnd* objects:
Inside MFC: Handle Maps and Temporary Objects[^]
Let me know if I was correct.
Best Wishes,
-David Delaune
|
|
|
|
|
Using Visual C++ 6 on Windows XP and automation to send data to Excel 2007. With my software there are occasions in which I repeatedly open an Excel file, write to a specified sheet, then close without saving. However, if the user clicks on a different sheet, when my code gets to SetValue(), it throws a COleDispatchException. The description of the error is a blank string. Why doesn't Excel just keep writing to the original sheet? How can I make that happen? A less desirable workaround would be to somehow disable Excel while my code is writing to Excel. Making Excel invisible while writing is not acceptable. Incidentally, there was no problem with Excel 2000.
CXLWorksheet worksheet;
CXLRange range;
CString strRange;
VARIANT v, vRet, vNotPassed, vBOOL;
VariantInit(&v);
VariantInit(&vRet);
VariantInit(&vNotPassed);
VariantInit(&vBOOL);
V_VT(&vNotPassed) = VT_ERROR;
V_ERROR(&vNotPassed) = DISP_E_PARAMNOTFOUND;
V_VT(&vBOOL) = VT_BOOL;
LPDISPATCH pXLAppDispatch = NULL;
LPUNKNOWN lpUnk; CLSID clsid;
if( S_OK == ::CLSIDFromProgID(L"Excel.Application", &clsid) )
{
if( S_OK == ::GetActiveObject(clsid, NULL, &lpUnk) )
{
VERIFY(lpUnk->QueryInterface(IID_IDispatch, (void**)&pXLAppDispatch) == S_OK);
m_XLApp.AttachDispatch( pXLAppDispatch );
lpUnk->Release();
}
}
V_BOOL(&vBOOL) = TRUE;
m_XLApp.SetVisible(vBOOL);
VARIANT vFilename;
V_VT(&vFilename) = VT_BSTR;
int Len = strFileName.GetLength();
V_BSTR(&vFilename) = SysAllocString(
T2COLE(strFileName.GetBuffer(Len+1)) );
if( !m_workbooks.m_lpDispatch )
{
m_workbooks.AttachDispatch( m_XLApp.GetWorkbooks() );
TRY
{
vRet = m_workbooks.Open(vFilename,
vNotPassed,vNotPassed,vNotPassed,vNotPassed,
vNotPassed,vNotPassed,vNotPassed,vNotPassed,
vNotPassed,vNotPassed,vNotPassed );
}
CATCH_ALL(e)
{
vRet = m_workbooks.Add(vNotPassed);
}
END_CATCH_ALL
if( V_VT(&vRet) == VT_DISPATCH )
m_workbook.AttachDispatch( V_DISPATCH(&vRet) );
}
LPDISPATCH lpDisp;
lpDisp = m_workbook.GetWorksheets(nXLWorksheetNo);
worksheet.AttachDispatch(lpDisp);
for( int nCol=0; nCol<nCols; nCol++ )
{
strRange = pTable->m_strXLTopLeftCell;
XLAdjustCol(strRange, nCol);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(
T2COLE(strRange.GetBuffer(0)) );
LPDISPATCH pDisp = worksheet.Range1(v);
VariantClear(&v);
range.AttachDispatch(pDisp);
VariantInit(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = strHeader.AllocSysString();
if( V_VT(&v) != VT_EMPTY )
{
try
{
range.SetValue(v);
}
catch(COleDispatchException *pEx)
{
TRACE("nCol = %d\n",nCol);
pEx->Delete();
}
VariantClear(&v);
}
}
LPDISPATCH CXLWorksheet::Range1(const VARIANT& Cell1)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_VARIANT;
InvokeHelper(0xc5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
&Cell1);
return result;
}
LPDISPATCH CXLWorkbook::GetWorksheets(short nXLWorksheetNo)
{
VARIANT vWorkSheetNo;
VariantInit(&vWorkSheetNo);
V_VT(&vWorkSheetNo) = VT_I2;
V_I2(&vWorkSheetNo) = nXLWorksheetNo;
static BYTE parms[] =
VTS_VARIANT;
LPDISPATCH result;
InvokeHelper(0x1ee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms, &vWorkSheetNo );
return result;
}
|
|
|
|
|
hllo guys...I tried to write my own DLL with simple functions which so far im successful. It lookd like this
MyDll.h
-------
namespace MyDll
{
class MyOwnDll
{
static _declspec(dllexport) void PrintMsg();
};
}
MyDll.cpp
---------
namespace MyDll
{
void MyOwnDll::PrintMsg()
{
::MessageBox(0,"","",0);
}
}
Now I added this DLL to my dialog based application (MyDll.h in "stdafx.h" of MyProj) and build the solution. Everything is fine and it builds. But when I try to use this, it show errors stating Undeclared Identifier. Here is how I use it
MyProjDlg.cpp
-------------
{
...............
...............
void MyProjDlg::MyMsg()
{
MyOwnDll mod;
mod.PrintMsg();
}
}
All the paths and libraries are included, everything looks fine. But why it is not able to find this?? thnx
modified on Thursday, December 2, 2010 2:47 PM
|
|
|
|
|
You haven't qualified the class name with the namespace it's in, eg:
MyDll::MyOwnDll mod;
No idea if that's the source of your problem but it's a good place to start.
Another thing to watch out for is the way you export the function from the DLL. Ideally you want to export the name in the DLL and import it in the EXE file. It might be worth having a look at some sample code to see how you're supposed to do that.
Cheers,
Ash
|
|
|
|
|
On your header file you have declared your export as __declspec(dllexport) : this is right as it instruct the compiler that the method MyOwnDll::PrintMsg() is implemented in your code and should be exported from the library.
On the other hand, when you use the dll, you should include the header file, but you need the MyOwnDll::PrintMsg() method to be imported, then it should be declared as __declspec(dllimport) .
A typical approach, is to add a pre-processor definition in your dll project, for example MYOWNDLLPRJ , and modify the header file as follow:
#ifdef MYOWNDLLPRJ
#define MYOWNDLLAPI __declspec(dllexport)
#else
#define MYOWNDLLAPI __declspec(dllimport)
#endif
namespace MyDll
{
class MyOwnDll
{
static MYOWNDLLAPI void PrintMsg();
};
}
|
|
|
|
|
Since im new to DLLs so plz dont mind. After this, how do I call this function in MyProjDlg.cpp? Like this?
void MyProjDlg::MyMsg()
{
MyDll::MyOwnDll mod;
mod.PrintMsg();
}
|
|
|
|
|
That will work, but is not the right way: as the MyDll::MyOwnDll.PrintMsg() method is static , you don't need to instantiate an object of your class to call it. The right way is the following:
void MyProjDlg::MyMsg()
{
MyDll::MyOwnDll::PrintMsg();
}
|
|
|
|
|
Hi All,
I have to develop a parser/compiler for First Order Logic (FOL) clauses in C/C++ language. I have made a lot of search on the web but I have found only a source codes written in ML, PROLOG, Haskell, Phyton, etc. I'm studying Flex and Bison to understand how I can generate a parser. I think it's a big work for me. Do you know if exist an open source implementation (C/C++) from which I can start?
Thank you
|
|
|
|
|
Hi,
Download Boost Spirit[^] and see the mini-c sample in <Boost>\boost_1_44_0\libs\spirit\example\qi\mini_c.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
my CHtmlView program uses window.external to communicate with between
js and c++.
then,
by window.external, c++ function code can be called from the
javascript in CHtmlView.
i thought, it would be better to define window.ui.flashwindow,
window.ui.util.parse,... etc like java package.
can it be possible to define them, and to connect my LPDISPATCH in C++
like a window.external?
|
|
|
|
|
Hi all,
i want to disable alt + space in my program. How can i do it?
Thanks in advance.
|
|
|
|
|
Add a handler for that key combination and do nothing there.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
Handle the WM_SYSKEYDOWN message and simply return 0 for wParam==VK_SPACE . WM_SYSKEYDOWN is received instead of WM_KEYDOWN always when the alt is held down, (or when the F10 is pressed). If the alt+Space handling is in your accelerator table then you have to put special handling code to your message loop that drops this WM_SYSKEYDOWN msg before calling TranslateMessage() or DispatchMessage() or something else.
|
|
|
|
|
Is the problem just alt-space or does it relate to the entire system menu (even when accessed by the mouse?)
In the first case, just discard the WM_SYSKYDOWN for "space", (but the sysmenu can be invocate by other keywords or by the mouse)
In the second case, make your window without the WS_SYSMENU style.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|