|
Roger Garrett wrote:
FILE* theFile;
theFile = fopen("\\123.21.105.6\SharedFolder\Test.txt", "r");
But that doesn't work.
Can you imagine the security implications if it did work?
If you have access to both the server and the client, you need to implement a socket-based program where the server listens for requests from the client on some specific port (you could also see if the server is already handling FTP requests on a port such as 21). Once the server "hears" the request, it would then start the process of sending the file back to the client.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I do understand the security issues.
And I understand about implementing a file retrieval mechanism by having a specific server program running on the target computer and a client program running on my computer. I've written such a program. But I ran into a problem in which the computer running the server isn't "allowed" to receive such incoming requests, per restrictions by the ISP of that computer (in particular, a computer connected to the Internet through Earthlink as their ISP cannot sucessfully run such a server because Earthlink doesn't allow it).
So I thought that perhaps using a shared folder on the target computer might work. I can successfully set up the shared folder on that other computer (with a password if necesary), and then I thought I should be able to access that folder, somehow. But I haven't figured out how. Or at least in all my attempts I haven't succeeded in openning the file.
Suggestions?
|
|
|
|
|
Roger Garrett wrote:
But I ran into a problem in which the computer running the server isn't "allowed" to receive such incoming requests, per restrictions by the ISP of that computer (in particular, a computer connected to the Internet through Earthlink as their ISP cannot sucessfully run such a server because Earthlink doesn't allow it).
I doubt you would be able to share a folder over the internet, from memory the required protocol/access mechanism for shared folders etc relies on Netbios and I dont think this CAN traverse the internet - I dont think its routable for example, although I'd have to collar one of our comms team to double-check, and its the Saturday of a long weekend down here (Australia)
Now, if it was company internal for example, you could do the same as a
net use x: \\abc.def.hij\d$ password /USER:\domain\user /PERSISTENT:NO
and yep, there are NET Api's for doing such - so you could connect to the share on startup for example and read the file from the 'X:' drive - I just dont think this is going to help you, sorry Roger.
'G'
|
|
|
|
|
Has anyone else seen asserts getting thrown when the condition blatantly evaluates to true when viewed in the debugger?
I think the application I've inherited just wants to cause me grief :-S
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!
File: z:\sdk\microsoft\vc71\atlmfc\include\afxtempl.h
Line: 321
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
afxtempl.h line 321 is
ASSERT(nIndex >= 0 && nIndex < m_nSize);
and
nIndex = 180
m_nSize = 181
arrgh!!!!!
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
That sure looks pretty weird.
Maybe try adding some parentheses:
ASSERT((nIndex >= 0) && (nIndex < m_nSize));
or...
BOOL bItIsTrue = ((nIndex >= 0) && (nIndex < m_nSize));
ASSERT(bItIsTrue);
and see how it behaves,
|
|
|
|
|
That was my thought as well, until I realised that the misbehaving code is part of MFC, so not something I can tinker with
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
Are you certain that you're looking at the correct ASSERT, i.e. the correct position within the correct afxtempl.h file? Did the debugger take you directly to the offending line of code, or did you just look for the afxtempl.h file and go to the specified line? I took a look at afxtempl.h on my machine and that line number doesn't have an ASSERT. There's lots of references to m_nSize but noone contained within an ASSERT. So maybe you're looking at a wrong afxtempl.h file.
|
|
|
|
|
Ususally it's the other way around it should assert when an index is outside the size of the container. Where is it located? If it is a bug in MFC, you might be able to avoid it by using a another overloaded operator/function to steer it away from that code.
|
|
|
|
|
I had this problem once. I don't know if this is the same with you, but I actually had the project in RELEASE mode instead of DEBUG while stepping through it. that made the values show up incorrectly.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Hi!
I'm wondering how to Disable and Enable a button.
For example I'm trying to create a small program where you mark a checkbox, doing
this Enables the button to continue. If it's unchecked the button is disabled.
To make it disabled is easy, cause I make it as default as disabled.
My problem is how do I do to Enable it when the checkbox is checked?
I'm writing it in Win32 API...no MFC
Please help!
|
|
|
|
|
|
Hachaso wrote:
I'm writing it in Win32 API...no MFC
Your code snippet is MFC code, Hachaso is using the Win32 API's...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hello,
Does the following code help?
::EnableWindow(::GetDlgItem(hYourDlgHandle, IDC_YOURBTNCTRLID), bEnable);
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I have to port 32-bit driver on 64 bit application.
Could anybody tell me the INF file & makefile Differences between X86 (32-bit) and X86-64/AMD64.
|
|
|
|
|
|
hiho@ll
i'm using the simplebrowser from this site (http://www.codeproject.com/miscctrl/simplebrowserformfc.asp)
and i have the following problem:
i'm loading a website from a local file which has anchors defined to jump e.g. to the bottom of the file
using the simplebrowser i can navigate through web using google and the anchors are working!
using my local file i get "blank#anchoridentifaction" in the IWebBrowser window
??
anybody knows what could be the problem?
if i open the local file using IE the anchors are working!! but with simplebrowser they don't
is it a problem of simplebrowser itself or of the IWebBrowser interface?
may i have to set some options?
thx@ll
|
|
|
|
|
Hi all,
I am developing dialog based application with RichEditControl. In my application, the requirement is send the richedit control data to the printer.
if any one have the snippet for the same, please let me know.
In mircrosoft site "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/aboutricheditcontrols.asp" i found that using EM_FORMATRANGE and EM_DISPLAYBAND messages we can attain the print functionality. But i don't know how to implement it. If any one know please let me know.
Regards,
Gnanaprakash Ponnusamy
A Journey of thousand miles must begin with a single step.
|
|
|
|
|
Hello
I am working with MultiThreading in MFC. I have written following piece in my code. But there is an error. Can anyone tell me why this error is comming.
Code is...
void CMyThreadrDlg::OnCreateThread()
{
if (m_check) // if check box is checked
{
int *i = new int(10000);
CWinThread *pThread = AfxBeginThread(getTime, i);
}
}
UINT CMyThreadDlg::getTime(LPVOID param)
{
DWORD result =0 ;
MessageBox("Thread created", "Success");
AfxEndThread(0);
return result;
}
Error is there where I have wrote,
CWinThread *pThread = AfxBeginThread(getTime, i);
Error Message is...
none of the 3 overloads can convert parameter 1 from type 'unsigned int (void *)'
Please help me
Thanks
Aqueel A. Mirza
We Believe in Excellence
|
|
|
|
|
The problem is that you pass to AfxBeginThread a member function of a class. This won't work because a member function does't not have the same calling convention as a standard function (the this pointer is passed implicitely).
Thus you need to use a global function. If your thread needs to access some member variables of the class that started the thread, you can pass the pointer to the class in the parameter:
UINT getTime(LPVOID param)<br />
{<br />
CMyThreadDlg* pDlg = (CMyThreadDlg*)param;<br />
<br />
<br />
return 0;<br />
}<br />
And to spawn the thread:
void CMyThreadrDlg::OnCreateThread() <br />
{<br />
if (m_check)
{<br />
CWinThread *pThread = AfxBeginThread(getTime, this);
}<br />
}<br />
Also, you don't need to call AfxEndThread before leaving the thread function because the thread will automatically finishes when this function exits.
|
|
|
|
|
But if you want absolutely that the thread procedure be a member of the class, there is a simple solution: declare the thread procedure as static function member and pass this pointer as parameter to the thread, so that you are able to call a non-static member function of the class as true thread procedure.
class A<br />
{<br />
public:<br />
VOID StartThread();<br />
<br />
private:<br />
static LRESULT ThreadProc(LPVOID pParam);<br />
VOID DoThread();<br />
}<br />
<br />
VOID A::StartThread()<br />
{<br />
AfxBeginThread(ThreadProc, this);<br />
}<br />
<br />
LRESULT A::ThreadProc (LPVOID pParam)<br />
{<br />
A *This = (A*)pParam;<br />
This->DoThread();<br />
return 0L;<br />
}<br />
<br />
VOID A::DoThread()<br />
{<br />
}
|
|
|
|
|
Yes of course...
But the only advantage I see in this method is to avoid having a global function. Is there any other advantage ?
|
|
|
|
|
It's perhaps only a matter of design but I assume that the worker thread is part of the object and is related to its internal working. So for me, it makes sense that the thread procedure be physically a function member of the class so that it can access to other private data (which the global function can't) Anyway I don't like too much global functions in C++.
|
|
|
|
|
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I need to construct a parser.My application is in MFC.
How to build a parser with simple construction procedure.
It also has to applicable for the project objects.
please avoid the concept of Activex scripting...
|
|
|
|
|
Not sure to understand what you mean. If you need to parse a string containing items separated by known constant characters, it may be sufficient to use CString::Tokenize ; then you need to build a structure representing the logical content of the string, so that it will be easier then to manipulate the data. It's actually a very vast subject.
|
|
|
|