|
Thanx anyway Prasad ... this bug is starting to p^ss me off ... but oh well .. I'll figure it out ..
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Hi all,
How could I clear / erase the contents of s :
class CIniFile
{
public:
struct Record
{
string Comments;
char Commented;
string Section;
string Key;
string Value;
};
vector<CIniFile::Record> s = CIniFile::GetSection("Client Files",IniFileName);
I tried the following:
s.erase(s.begin(),s.end());
Bit receive the following:
Windows has triggered a breakpoint in CompClientApp.exe.
This may be due to a corruption of the heap, and indicates a bug in CompClientApp.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
Many thanx
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Its object, not pointer, isn't it ?
|
|
|
|
|
|
Programm3r wrote: lpzFiles[i].szFileName = "";
How is lpzFiles is declared like ?
|
|
|
|
|
#define FILE_NAMES 10
struct
{
char* szFileName;
}lpzFiles[FILE_NAMES];
It's as if the stack of that specific portion of code gets corrupted (that is the function call)
-- modified at 9:52 Monday 5th March, 2007
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Dear all
I write one small DLL that I need to load it only one time.
How can I protect my dll from loading twice or more at load time.
I use LoadLibrary function to load my dll in dynamic manner.
How can I load this DLL in static manner.
Thanks in advance
Mahdi
|
|
|
|
|
m_monhi wrote: How can I load this DLL in static manner.
You mean implicit linking [^] ?
-- modified at 4:01 Monday 5th March, 2007
Refer[^].
|
|
|
|
|
|
If you have a DLL (Dynamic linking Library) then you must link it dynamically. The options available are implicit or explicit dynamic linking.
To make sure the library is loaded only one time you can either use the implicit (load time) linking (reference the proper *.lib as LINKER input library) or, using explicit linking, store the returned handle and check its values before trying to load (again) the library.
hope that helps
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.
|
|
|
|
|
Hi, I'm having a link error problem and I don't know how to fix it.
Please help me out.
error LNK2019: unresolved external symbol _Validate@1068 referenced in
function...........
I use VS2005
I have a static library with the following C++ settings:
/Od /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_UNICODE" /D "UNICODE" /Gm /
EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\Licensor.pch" /Fo"Debug\\" /
Fd"Debug\vc80.pdb" /W3 /nologo /c /Wp64 /ZI /TP /errorReport:prompt
It uses __cdecl (/Gd) calling convention.
In the header file, I have
#if __cplusplus
extern "C" {
#endif
__declspec(dllexport) int WINAPI Validate(CHAR szNewKey[], int length, LICENSEDATA licData, LICENSEDATA* extLicData);
#if __cplusplus
}
#endif
I have a win32 project that links to the static library above in order to
call the Validate function. It has the following C++ settings:
/Od /I "..\..\Licensor" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D
"VERBOSE" /D "_VC80_UPGRADE=0x0600" /D "_MBCS" /FD /EHsc /MTd /Fp".
\Debug/Temp.pch" /Fo".\Debug/" /Fd".\Debug/" /W4 /nologo /c /ZI /TP /
errorReport:prompt
It too uses __cdecl (/Gd) calling convention.
I'm not sure what to change. Should I be using __stdcall (/Gz) calling
convention for the project? I tried that but no luck either.
Any suggestion? Thanks much.
|
|
|
|
|
jipai wrote: In the header file, I have
#if __cplusplus
extern "C" {
#endif
__declspec(dllexport) int WINAPI Validate(CHAR szNewKey[], int length, LICENSEDATA licData, LICENSEDATA* extLicData);
#if __cplusplus
}
Where this function is defined ?
|
|
|
|
|
It's defined in a .cpp file of the static library, something like
extern "C" __declspec(dllexport) int WINAPI Validate(char szKey[], int length, LICENSEDATA licData, LICENSEDATA* extLicData)
{
.
.
// code here
.
.
}
Do I need extern "C" here in the cpp file?
|
|
|
|
|
jipai wrote: I have a win32 project that links to the static library above in order to
call the Validate function.
Did you explicitely change your project settings in order to link to this library ? If no, that's your problem.
Open your project properties, go into "Linker" category -> "Input" and add your library to the "Additional Dependencies" list.
Your library must be in one of the library directory (to add it, open the "Linker" category -> "General" and add the folder in "Additional Library Directory").
|
|
|
|
|
Yes, I did add the static library Licensor.lib to the win32 project Linker -> Input -> Additional Dependencies setting, and the folder to the library path. It didn't complain about library not found. This is the command line:
/OUT:".\Debug\MyApp.exe" /INCREMENTAL /NOLOGO /LIBPATH:"..\chapp\Debug" /MANIFEST /MANIFESTFILE:".\Debug\MyApp.exe.intermediate.manifest" /DEBUG /PDB:"c:\Developer\Projects\MyApp.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 /ERRORREPORT:PROMPT odbc32.lib odbccp32.lib Winmm.lib Licensor.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
|
|
|
|
|
I just read your first post again. You said that you made a static library ? So why do you export your functions (this is used only for dll's AFAIK) ?
|
|
|
|
|
Yes indeed it's a static library. I ran out of idea so I decided to try that, but even without the export it was no use. Apparently, the static library is C++ based, and the win32 app is a C based. So when I tried to add this around the include header in the win32 app, the link error remained.
#ifdef __cplusplus
extern "C" {
#endif
#include "MyHeader.h"
#ifdef __cplusplus
}
#endif
|
|
|
|
|
Dear all.
for one application I want to see which DMA and IRQ is assigned to parallel port.
Does any one know how to extract these data.
Regards
Mahdi
|
|
|
|
|
hi i downloaded code to add html help from the link
http://www.codeproject.com/useritems/HTMLHelp.asp[^]
and when i run it, its giving an error with respect to the line "HtmlHelp(this->m_hWnd, "scan_help.chm::/getting_.htm", HH_DISPLAY_TOPIC, NULL);"
error is "error C2660: 'CWnd::HtmlHelpA' : function does not take 4 arguments"
any idea on what to be done to run the program so that i can follow that program to link html help to my application
harsha
|
|
|
|
|
Can you show code
Declare of CWnd::HtmlHelp on the MSDN is
virtual void HtmlHelp(
DWORD_PTR dwData,
UINT nCmd = 0x000F
);
|
|
|
|
|
void CTestHelpDlg::OnHelp()
{
// TODO: Add your control notification handler code here
HtmlHelp(this->m_hWnd, "scan_help.chm::/getting_.htm", HH_DISPLAY_TOPIC, NULL);
}
and my ".h" file is
// TestHelpDlg.h : header file
//
#if !defined(AFX_TESTHELPDLG_H__4C88ADC9_77D8_4344_ACF6_92E5910070E8__INCLUDED_)
#define AFX_TESTHELPDLG_H__4C88ADC9_77D8_4344_ACF6_92E5910070E8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CTestHelpDlg dialog
class CTestHelpDlg : public CDialog
{
// Construction
public:
CTestHelpDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CTestHelpDlg)
enum { IDD = IDD_TESTHELP_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTestHelpDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CTestHelpDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnHelp();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TESTHELPDLG_H__4C88ADC9_77D8_4344_ACF6_92E5910070E8__INCLUDED_)
please see the link in my ques for total code..
harsha
|
|
|
|
|
What happens if you use of ::HtmlHelp instead HtmlHelp
|
|
|
|
|
error is gone when i put it.. but on clicking Help button in dialog html help page is not opening.. ? any clue on what to do ?
harsha
|
|
|
|
|
|
Creating and Using HTML Help in MFC applications
[^]
i am using this onl.. its not happening ..the error i asked intially is coming even when i download this code and run it directly with out any changes in my comp..not able to figure out whats the problem
harsha
|
|
|
|