|
akafazov wrote: the problem is that the InternetFindNextFile(..) function always returns FALSE and the last error that I gen with GetLastError() is ERROR_IO_PENDING.
Which indicates that the request has been made asynchronously, and your application will be called back with INTERNET_STATUS_REQUEST_COMPLETE when the function has completed.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
However, the callback function is never called with INTERNET_STATUS_REQUEST_COMPLETE or any other flag. The situation also indicates that there is an outstanding operation in progress but there isn't. It's all very weird and I don't understand why.
A. Kafazov
|
|
|
|
|
I am using NetShareGetInfo and i am getting a NERR_NetNameNotFound.I am using the folder path as the share name e.g "C:\\WINNT\\profiles\\chikomok\\My Documents\\Open_Shares" and the sever is the remote P.C were the program is running
Can some please tell me what the problem could be.
Kelvin Chikomo
|
|
|
|
|
If the share name does not exist, then system will return NERR_NetNameNotFound error message. So please check your share name exactly with the shared device in the server.
And also server name should begins with \\. If this parameter is NULL, the local computer is used.
best of luck
regards
Vallikumar A
|
|
|
|
|
When i try to use \\. i get an error 53 which i do not know what it means.
Any help
Here is my code
<br />
#include "stdafx.h"<br />
#include "test2.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
CWinApp theApp;<br />
<br />
using namespace std;<br />
<br />
<br />
void wmain( int argc, TCHAR *lpszArgv[ ])<br />
{<br />
PSHARE_INFO_502 BufPtr;<br />
NET_API_STATUS res;<br />
LPTSTR lpszServer = NULL, lpszShare;<br />
switch(argc)<br />
{<br />
case 3:<br />
lpszServer = lpszArgv[2];<br />
case 2:<br />
lpszShare = lpszArgv[1];<br />
break;<br />
default:<br />
printf("Usage: NetShareGetInfo sharename <servername>\n");<br />
return;<br />
}<br />
cout<<lpszServer<<" "<<lpszShare<<endl;<br />
if((res = NetShareGetInfo ("\\.","guest" ,502,(LPBYTE *) &BufPtr)) == ERROR_SUCCESS)<br />
{<br />
printf("%S\t%S\t%u\n",BufPtr->shi502_netname, BufPtr->shi502_path, BufPtr->shi502_current_uses);<br />
if (IsValidSecurityDescriptor(BufPtr->shi502_security_descriptor))<br />
printf("It has a valid Security Descriptor.\n");<br />
else<br />
printf("It does not have a valid Security Descriptor.\n");<br />
NetApiBufferFree(BufPtr); <br />
}<br />
else <br />
{<br />
<br />
if(res == NERR_NetNameNotFound)<br />
cout<<"Netnamenotfound"<<endl;<br />
else if(res==ERROR_ACCESS_DENIED)<br />
cout<<"Access denied"<<endl;<br />
else if(res==ERROR_INVALID_LEVEL)<br />
cout<<"invalid level"<<endl;<br />
else if(res==ERROR_INVALID_PARAMETER)<br />
cout<<"invalid parameter"<<endl;<br />
else if(res==ERROR_MORE_DATA)<br />
cout<<"More data"<<endl;<br />
else if(res==ERROR_NOT_ENOUGH_MEMORY)<br />
cout<<"not enough memory"<<endl;<br />
else if(res==NERR_BufTooSmall)<br />
cout<<"buffer too small"<<endl;<br />
else<br />
cout<<"Error "<<res<<endl;<br />
}<br />
return;<br />
}
|
|
|
|
|
You didn't specify that to which machine have you connected to, so it is throwing that error.
Use NetResource structure and WNetAddConnection to open the connection so that you can have access to the shared folders on the remote machine . You can also try and check other return values.
Remember WNetAddConnection returns a DWORD value
eg ERROR_ACCESS_DENIED etc.
Does this solve your problem
Wishes
Anshuman
|
|
|
|
|
I thought all i had to do was to call the netsharegetinfo method. i am just trying to get information from my computer thats all. The method description says put //. to access shares on the remote machine.
I really need to get this going
Help please
Kelvin Chikomo
|
|
|
|
|
If you want to access the information from your machine then no need to give the share name(Server) with \\.
Instead this give NULL.
This will get the information from your local machine.
regards
Vallikumar A
|
|
|
|
|
I have tried that, thats when i get the NERR_NetNameNotFound error. should i give the full path of my shared folder or just the share name. It seems logical to use the share name.
|
|
|
|
|
The NetShareGetInfo function retrieves information about a particular shared resource on a server.??To what extent do you want to have the control??.
SO if you need the control of the files/folders/printers that are residing on the other machine use NETRESOURCE structure and pass it to WNetAddConnection2 function. This opens the connection and you can get the control to the shared folders.
Can you tell me what exactly do you want to do because there are a lot of roads that lead to somewhere from here but that would be useless mentioning here if they are of no use to you
Wishes
Anshuman
|
|
|
|
|
I am creating a tool to check the attributes of all the shares on my computer. just my computer. So basically i need to get all the information about the shares on my PC using NetShareGetInfo.
So far i have been trying to get info for one specific share but it keeps saying the the shre does not exist(NERR_NetNameNotFound)
Thanks for the help hey.
Kelvin Chikomo
|
|
|
|
|
kelprinc wrote: So basically i need to get all the information about the shares on my PC using NetShareGetInfo.
Use NetShareEnum(NULL, ...) instead. If you need information about a particular share, use NetShareGetInfo(NULL, _T("NameOfShare"), ...) .
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hi
I have an Windows Explorer type MFC SDI Application.
In my application i am doing heavy processing using worker threads so that the main thread donot hangs(during a heavy process) & keeps processing user requests.
Now at the time the heavy process(finding files/folders in logical drive) is executing, the GUI is also being updated via ::SendMessage() function from worker thread to the primary thread.
Following are updated:
--> In tree view folders are added.
--> In List View files are added in Report view.
--> Progress bar status bar pane 0 is updated.
--> Status bar pane 1 is also updated with total of files & folders.
Now my question is:
Q1--> Is the above strategy fine?.
Also while the heavy process is running & the user presses the <stop> toolbar button, the control goes to CMainFrm::OnStop(). From this function a message box is prompted to the user asking whether he wants to stop or not.
Is this display of msg box by the main thread fine while the worker thread is running?.If the user says <yes>, the worker thread is made to return.
I have also read that worker threads must not try to launch any GUI window(message box, dialogs.). But here in my case the msg box is thrown by the main primary thread.
Waiting for suggestions
Best Regards
|
|
|
|
|
dp_76 wrote: Q1--> Is the above strategy fine?
This is the same thing as manipulating GUI objects from a worker thread since a ::SendMessage is issued in both cases. When using ::SendMessage the call will wait for the message to be handled before returning. If the receiving thread does not handle the message you will have a deadlock situation.
Even if you are fortunate and able to avoid a deadlock situation, your worker thread is waiting for the main thread to handle the message and your worker thread is "paused" until the main thread has handled the message. Usually this is not desired.
The use of ::PostMessage is recommended instead which will prevent a deadlock situation and also makes the worker thread continue while the main thread is handling the messages you've posted to it.
Regarding the message box issue the same thing as above is applicable.
If you are using ::SendMessage, the worker thread would be waiting for the call to return and here you may have a deadlock situation if you like to wait for the worker thread to finish by waiting on the thread handle.
The thing is do have a worker thread execute asynchronously as long as it does not use data that is shared between thread. If either thread is using shared data you would need some kind of synchronization object to prevent data corruption, e.g. critical section.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
|
Sounds fine. It is fine to display a message box in the worker thread - Although it is better if the UI thread does this as the worker can keep processing until the user makes his choice. Roger has a point when he makes his case for replacing SendMessage with PostMessage .
Steve
|
|
|
|
|
I want to show the thumbnails of html files to the user. As the thml file is of 600*400 I need to show the thumbnails in a list. So how do I convert the HTMl files output(the one which we see when we open the file in browser) into a image like bmp ot JPG
Regards,
Hemant Kulkarni
|
|
|
|
|
I dont really understand your question but from what i understand i suggest you open the Html file then press Print screen on your keyboard. Then open any image editor like MS paint then click paste and save your html file in any format you wish.
Hope this helps
Kelvin Chikomo
|
|
|
|
|
Thanks for reply
But I want to do this convertion programatically. So I need the code or the method to achive this.
Once gain thanks for your reply
Regards,
Hemant kulkarni
|
|
|
|
|
I haven't personally tried any of this but here goes:
1. Use IViewObject::Draw to draw into a HDC that has bitmap selected into it.
2. Didn't Windows used to generate thumbnails of HTML pages? Win98 was it? I believe this functionality still exists.
Steve
|
|
|
|
|
Code project article on it here.
Steve
|
|
|
|
|
|
Another CodeProject article on it here. This was the option 2 I was talking about.
Steve
-- modified at 5:11 Tuesday 17th January, 2006
Link in article is wrong, try this instead.
|
|
|
|
|
Hi Steve,
Thanks a lot for reply. Your code and method seems to be very helpful to me.
Thanks again for rugent reply !.
Regards,
Hemant Kulkarni.
|
|
|
|
|
Sir ,
As i m having the VS c++ 6.0 version where there is not the prototype for the IHtmlElementRender interface in the Mshtml.h file so is there any other way out of this.
Regards
Shikha
|
|
|
|