|
//header file
class COpPDAFile : public CDialog<br />
{<br />
DECLARE_DYNAMIC(COpPDAFile)<br />
<br />
public:<br />
COpPDAFile(CWnd* pParent = NULL,CMySocket *pSock=NULL);<br />
virtual ~COpPDAFile();<br />
//cpp file
COpPDAFile::COpPDAFile(CWnd* pParent,CMySocket *pSock)<br />
: CDialog(COpPDAFile::IDD, pParent)<br />
, msg(NULL)<br />
, clsImage(NULL)<br />
{<br />
p_sock=pSock;<br />
}<br />
void COpPDAFile::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_PDAFILE, lsPDAFile);<br />
DDX_Control(pDX, IDC_UPBTN, btnUp);<br />
DDX_Control(pDX, IDC_PATH, edPDAPath);<br />
}<br />
BOOL COpPDAFile::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();
......<br />
|
|
|
|
|
whiteclouds wrote: CDialog::DoDataExchange(pDX);
Set a breakpoint on this statement and F10 over the next three DDX_Control() statements. The one that crashes is the one you need to focus on.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This is an access exception, meaning you're trying to read or write to a memory address you shouldn't. Generally this means you've not initialised a pointer, or you've freed memory and are still trying to access it.
If this is a debug build, run it under the debugger, and it should stop when the exception triggers. Examine your stack trace, and determine the line giving you problems.
Steve S
Developer for hire
|
|
|
|
|
Can you show your code on the OnInitDialog();
|
|
|
|
|
Pls see above.
|
|
|
|
|
Can Any one told me how to upload file in vc++ without Active X control
I want to upload file in MySQL Database using VC++ ,so can any
one told me how we accompolish this task
Regard's
Kaushik
|
|
|
|
|
I deaclare a static member in CMyDoc.h:
static CLogFile * m_pLogFile;
CLogFile is a class inherit from CFile. The class has some member functions to write some information into a txt file like some of log file.
In CMyDoc.cpp there are two static member function which use the m_pLogFile to record information in a txt file.
Then I should implement the statement:
m_pLogFile =new CLogFile;
m_pLogFile->Open(".\\log.txt",CFile::modeCreate|CFile::modeNoTruncate|
CFile::modeReadWrite|CFile::shareDenyNone);
but i have the question: where should i put these statements ?
I put them in the constructor of CMydoc class, there are the error:
error LNK2001: unresolved external symbol "public: static class CLogFile * CMyDoc::m_pLogFile" (?m_pLogFile@CMyDoc@@2PAVCLogFile@@A)
|
|
|
|
|
In your cpp file, outside the class declaration, you should put something like this:
CLogFile* CMyDoc::m_pLogFile = NULL;
Static members are initialized at startup so they need to be defined at global scope.
|
|
|
|
|
Cedric Moonen wrote: CLogFile* CMyDoc::m_pLogFile = NULL;
it works.thank you very much!
|
|
|
|
|
Work environment:WinXP+SP2 , VC6.0+Sp6
I want to write a server program to search some files in office network.
My Question Is:
when i call
/*the directory is exist*/
LPCTSTR pstrName= _T("\\\\OfficeNet\\TmpDir\\*.*");
pNextInfo = new WIN32_FIND_DATA;
lstrcpy(((WIN32_FIND_DATA*) pNextInfo)->cFileName, pstrName);
hContext = ::FindFirstFile(pstrName, (WIN32_FIND_DATA*)pNextInfo);
if these statements run in server program, then
hContext = INVALID_HANDLE_VALUE,GetLastError=183.I got these infomation by output a log file.
if i run them in my another program that isn't a server program, it can work
correcttly.
Why????????????????????
|
|
|
|
|
Some times ago I tried like you with FindFirstFile and got same problem but it seems it doesnt work on the network.
|
|
|
|
|
I think it work on network, but can't run with server program.
FindFirstFile work corretlly in nonserver program .
|
|
|
|
|
CNJXRZ wrote: pNextInfo = new WIN32_FIND_DATA;
Why a pointer?
CNJXRZ wrote: GetLastError=183
Which is ERROR_ALREADY_EXISTS . Why would you be getting that error when simply searching for files?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In addition to David's reply....
Why all the casts of a variable to its same type? Why initialize pNextInfo?
TCHAR strName[] = _T("\\\\OfficeNet\\TmpDir\\*.*");
WIN32_FIND_DATA NextInfo;
HANDLE hFind = ::FindFirstFile(strName, &NextInfo);
if (INVALID_HANDLE_VALUE != hFind)
{
... succeeded
::FindClose(hFind);
}
else
{
DWORD dwErrCode = ::GetLastError();
...
}
-- modified at 11:20 Tuesday 5th June, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
libpath can relative path or absulute path
|
|
|
|
|
|
|
Ok, so I got an example and it's working, but have no idea how it's working.
Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
I've got one question using the WebBrowserControl.
In my app a self refreshing website http://www.forexpf.ru/quote_show.php[^] is loaded in a webbrowser-control. The text content of the site is captured by QueryInterface() into a String to parse some data. This works fine, but ...
On the website there is a list box and an button at the bottom, from which you can choose the interval for automatic refreshing the site. On initial loading 1min is chosen, but I want to change this to the shortest value (30sec). All the stuff is hidden, so the input should come from code (maybe via QueryInterface?).
Are there any ideas to grab the list-control and the button and change the value?
Here are the sample code for grabbing the content:
- simple MFC-Dialog
- one Webbrowser control (m_WebBrowserCtrl)
- website is loaded and refreshed by button click
- by clicking on a button the content of the site (plain text, not the html source) is copied into a CString variable to parse the data.
<br />
void CWebbrowser_TestDlg::OnCopy() <br />
{<br />
IHTMLDocument2* m_pHTMLDocument2;<br />
LPDISPATCH lpDispatch;<br />
lpDispatch = m_WebBrowserCtrl.GetDocument();<br />
HRESULT hr;<br />
if (lpDispatch)<br />
{<br />
hr =<br />
lpDispatch->QueryInterface(IID_IHTMLDocument2,<br />
(LPVOID*)&m_pHTMLDocument2);<br />
lpDispatch->Release();<br />
ASSERT(SUCCEEDED(hr));<br />
}<br />
<br />
CString sText;<br />
IHTMLElement *iSource;<br />
BSTR bstrSource;<br />
<br />
m_pHTMLDocument2->get_body(&iSource);<br />
iSource->get_outerText(&bstrSource);<br />
sText = bstrSource;<br />
MessageBox(sText);<br />
}<br />
TIA and greets
M.
|
|
|
|
|
Hi,
I guess you need to get the element of button and select box
Give an id to the element in the web page
get the document 3 interface
m_pHTMLDocument2->QueryInterface<IHTMLDocument3>(&spHTMLDocument3);
spHTMLDocument3->getElementById(spbstrID, &spHtmlElm);
/* you can also use getElementsByName if you know the element name */
spHtmlElm->QueryInterface<IHTMLButtonElement>(&spBtnElm);
if (spBtnElm)
{
spBtnElm->put_value(spBSTRValue);
}
For list element you need to create option element to add an list item.
Best Regards
Raj
|
|
|
|
|
I just strarted like 2 days ago so Im a compltete newb. But here is my problem, when I compile it always gives me an error "Misplaced else" I just dont have a clue how it is misplaced?? could you also tell me why this happens?
here is the code::
#include <iostream.h>
int main()
{
int one = 3, two = 4;
if (one < two)
two = one;
cout << "successful change\n";
else
cout << "failed..\n";
return 0;
}
|
|
|
|
|
int main()
{
int one = 3, two = 4;
if (one < two){
two = one;
cout << "successful change\n";
}
else
cout << "failed..\n";
return 0;
}
The format for using if() else () is
if(condition)
{
// Do something
}
else
{
// Do something else
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Between if and else must be only 1 statement. You can include multiple statement inside a {//multiple statements here} block. For instance:
if (one < two)
{
two = one;
cout << "successful change\n";
}
else
cout << "failed..\n";
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.
|
|
|
|