|
thank you very much mark you helped and didnt even know it and you missed where i was messing up
UNIT <--- mine
UINT <--- yours
btw i go it working first try after learning to spell lol
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This remind me a maths exam some years ago... 1*1 = 2 ;P;)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
Following code is written in Visual Studio 2005 C++ for PDA(MC3000).
PDA is Motorola/Symbol's MC3000 and it has Windows CE 5.0 Operating System.
FTP Error Code 12029 meaning "Internet can not connect" as per Microsoft Documentation.
I am using following code to do FTP Send file to FTP Server:
int JSCFTPSendFile(TCHAR *tszLocalFileName, TCHAR *tszRemoteFileName)
{
HANDLE hInternetHandle = 0;
HANDLE hFTPHandle = 0;
TCHAR tszFTPServerName[256];
TCHAR tszFTPUserId[51];
TCHAR tszFTPPassword[51];
INTERNET_PORT ipFTPPortNo = 21;
_tcscpy(tszFTPServerName, _T("ftp.myftpserver.com");
_tcscpy(tszFTPUserId, _T("MyUserid");
_tcscpy(tszFTPPassword, _T("MyPassword");
hInternetHandle = InternetOpen(_T("Microsoft Internet Explorer"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_INVALID_PORT_NUMBER);
if ( hInternetHandle == 0 )
{
return FALSE;
}
hFTPHandle = InternetConnect(hInternetHandle, tszFTPServerName, ipFTPPortNo, tszFTPUserId, tszFTPPassword, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if ( hFTPHandle == 0 )
{
InternetCloseHandle(hInternetHandle);
return FALSE;
}
// upto here code works fine but when it executes FtpPutFile() I get Error code 12029
iRetStatus = FtpPutFile(hFTPHandle, tszSendFileName, tszRemoteFileName, FTP_TRANSFER_TYPE_BINARY, 0);
if ( iRetStatus )
{
bFileSent = true;
}
InternetCloseHandle(hFTPHandle);
InternetCloseHandle(hInternetHandle);
return TRUE;
}
In the above function upto "InternetConnect()" code works fine but when it executes "FtpPutFile()" I get Error code 12029.
This code works fine to conect to any standard FTP Server.
I am first connecting to PC using ActiveSync(Version 4.1) and once ActiveSync Connection established I can connect to any FTP Server(Local Network or Remote thru the gateway ) and transmit file. But if I try to send file from PDA(MC3000) to ActiveSync Connected PC(FTP Server Name is V4000) then it does not work.
I tried server name as "ppp_peer", "localhost", "V4000"(which is actual FTP Server Name for the local PC ). and it did not work.
Your help will be greatly appreciated.
Regards,
Dev
|
|
|
|
|
I have view class derived from CScrollView
I set scroll size to ( 0 1999) means total size 2000
When I click on the right or left arrowhead of horizontal scrollbar, it moves to some predetermind number left or right.
What I want is, when I will click any of the arrow head it should move only 4 point left or right. It tried to implement in OnHScroll by using SetScrollPos method. It works for sometime when per click move is higher than some unknown number, when I set perclick move to 4 point, it just ignore it and move to predetermind number per click.
Is there any limitation that it should move atleast to some minimum number per click and if the number set below the minimum number, it just ignore.
Do you any idea how I can set per click move to 4 point.
==============================
int nTemp1, nTemp2;
//int nMax = 1999; just assume it is there
//int nMin = 0;
nTemp1 = GetScrollPos(SB_HORZ);
switch(nSBCode) {
case SB_THUMBPOSITION:
SetScrollPos(SB_HORZ,nPos);
break;
case SB_LINELEFT: // left arrow button
nTemp2 = (nMax - nMin) / 500; //when I set 50, 75, 100, i see the difference
// when I set 500, it don't work, and used default one
if ((nTemp1 - nTemp2) > nMin) {
nTemp1 -= nTemp2;
}
else {
nTemp1 = nMin;
}
SetScrollPos(SB_HORZ,nTemp1);
break;
case SB_LINERIGHT: // right arrow button
nTemp2 = (nMax - nMin) / 500; // same as above comment
if ((nTemp1 + nTemp2) < nMax) {
nTemp1 += nTemp2;
}
else {
nTemp1 = nMax;
}
SetScrollPos(SB_HORZ,nTemp1);
break;
}
============================
msc
|
|
|
|
|
You shouldn't need to handle the scroll messages yourself.
You may as well write your own scrollview class if you're going to
do that.
Maybe use CScrollView::SetScrollSizes() to set page/line scroll amounts instead.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Dear all,
I am a newbie in Visual C++ programming and now I am trying to convert a HTML page into a XHTML page. Is there any built-in library for doing this? If not, is there any simple way to do this?
Thanks a lot
Best regards,
Peishan, Wu
|
|
|
|
|
|
hello,
I have a class derived from CStatic.
I have added scroll bars to this CStatic, but not getting OnHScroll() and OnVScroll() messages in that class...
Can any one tell me, how to get these messages...
|
|
|
|
|
can you just explain a bit clearer?
|
|
|
|
|
okay,
I have created a class "myCStatic" derived from CStatic, i have created the window like
myCStatic myStatic;
myStatic.Create(NULL, WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|SS_NOTIFY, m_u_originalRect, this, IDC_IMAGERECT_DEFINE);
myStatic.ShowWindow(SW_SHOW);
Now , i can see Vertical and Horizantal Scrollbars on this CStatic window.
But i am not getting OnHScroll and OnVScroll messages in "myStatic" class.
Hi this is SHivraj
|
|
|
|
|
Do you need to these messages?
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
ON_WM_HSCROLL()
ON_WM_VSCROLL()
END_MESSAGE_MAP()
void CMyStatic::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CStatic::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CMyStatic::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CStatic::OnVScroll(nSBCode, nPos, pScrollBar);
}
public:
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
public:
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
|
|
|
|
I have added these messages to the class, but the event is not coming ..
Hi this is SHivraj
|
|
|
|
|
Do you have these scrolls on the control and can you see them when run your program?
|
|
|
|
|
Hi
From the main thread of my NFC based SDi application, i am creating a UI thread. Now from within the UI thread, i am creating a worker thread that does a very crucial job.
This worker thread has the tendancy to hang in certain situations.
To handle this hang sitaution, i wait on this worker thread from my UI thread for a max of 60 seconds using WaitForSingleObject(pThread->m_hTread, 60000).
Please have a look at the code snippet:
//This is a function in my UI thread.
BOOL CDocRecover::QuickRepair()
{
---
--- //some code goes here.
---
//Now here i am creating a worker thread.
CWinThread* pThread = AfxBeginThread(Worker_ThreadSample, wordDocs);
DWORD dwReturnValue = WaitForSingleObject(pThread->m_hThread, 60000);
if(dwReturnValue ==WAIT_TIMEOUT)
{
DWORD lpExitCode = 0;
GetExitCodeThread(pThread->m_hThread, &lpExitCode);
while(TerminateInstance(TRUE)==TRUE);
if(wordApp1.m_lpDispatch)
{
wordApp1.ReleaseDispatch();
wordApp1.Quit(covFalse, covTrue, covFalse);
DeleteFile(pApp->strTargetPath);
}
if(lpExitCode==STILL_ACTIVE)
AfxEndThread((UINT)lpExitCode);
}
int dp=0;
}
Now assuming that the worker thread has hanged, after waiting for 60 seconds the control will come inside the if(dwReturnValue ==WAIT_TIMEOUT) block & worker thread will be terminated after releasing some dispatch.
Now the problem is that after the call to AfxEndThread(), the control never reaches the line int dp=0;
I DONOT KNOW WHY?
The Application has not hanged but the control never returns to the UI thread.
Please suggest
|
|
|
|
|
is this "Worker_ThreadSample" function that you are using in afxbeginthread, a global function or a part of the class CDocRecover.
if it is a global function, then no problem.
have you tried to debug the application,
or have you tried by putting some messageboxes
|
|
|
|
|
Hi
Worker_ThreadSample(0 is a controlling function of the worker thread defined globally.
Waiting for suggestions
Regards
|
|
|
|
|
have you tried to debug the application,
or have you tried by putting some messageboxes
|
|
|
|
|
This is a poor design. If you start a worker thread, then immediately wait for
it to complete on the creating thread, then you've essentially gone out of your
way to create a single thread.
Regardless. does execution ever get to AfxEndThread()?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How to identify , in which angle image is rotated or skewed?
|
|
|
|
|
Do you need to this method Image::RotateFlip ?
|
|
|
|
|
jay_p_patel wrote: ...but it fails .
Which is all but totally meaningless without any contextual information.
"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
|
|
|
|
|
what could be done to get rid of link error 1181 cannot open input file d:\project.obj
|
|
|
|
|
to get your post clarified, you have to narrate the foreground and background of your problem and error.
you should also specify the platform in which you are getting this error.
|
|
|
|
|
You've instructed the linker to process the d:\project.obj file, which apparently does not exist. I suspect the d:\ path is invalid as most .obj files reside in a project's Debug or Release folder.
LNK1181
"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
|
|
|
|