|
I am searchinf for information about NFS protocol. Do you know any useful link or samle ? Thanks. Satucha
|
|
|
|
|
Start here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi all,
anyone konws the win32 api for knowing that who is the current logged in user? I need it for only windows nt based OSes i.e. nt, 2000, xp
thanks in advance
|
|
|
|
|
Check out the MSDN documentation for the
NetQueryDisplayInformation() API
|
|
|
|
|
thanks.
Can you tell me also any win32 API to copy a file from a folder to another folder?
thanks again.
|
|
|
|
|
Try CopyFile() , MoveFile() , SHFileOperation() , or the CFile class.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
sorry, i found the api to be CopyFile()
|
|
|
|
|
You'll want to use NetWkstaUserGetInfo() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can I make this (test_26_tt1) variable global;
typedef struct <br />
{<br />
unsigned short data; <br />
unsigned 4 : count<br />
unsigned 1 : fault<br />
unsigned 2 : err <br />
}TEST_26_TT1
union<br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
}test_26_tt1;
If it was a float then I could do
// Globally declare the variable in just before the Main section of the code
float flt1;
extern float flt1; // This would allow global use in another unit of the program.
Or should type type of data be wrapped up in a class; as they are many.
|
|
|
|
|
what problem did you have when you used the same way as float?
Jaime
|
|
|
|
|
No problem with the float;
Just do
extern float flt1;
in any units you want to use it.
My problem is with the union, how do I reference it in another unit?
extern <type=????> test_26_tt1;
I have lots of bit fields which I form into a buffer via the union (same memory, but two names).
|
|
|
|
|
the question I did was not for the float, but for the test_26_tt1. What problem did you have with it? Variable isn'r recognize? did you receive a compilation error?
Jaime
|
|
|
|
|
When you form a union you can now use the data. i.e. two variables have been declared.
union<br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
}test_26_tt1;
in the code you can do the following:-
test_26_tt1.buffer[3] = 0xFF;
My question was how do you refer to this data in another unit using the extern
If I use the statement
extern test_26_tt1;
and refer to it as
unsigned short x = test_26_tt1.buffer[2]; in another unit I get the error:-
c:\Example\Database.cpp(101): error C2228: left of '.buffer' must have class/struct/union type.
Its a question of type, as I said with float
extern float flt1;
extern ???? test_26_tt1;
|
|
|
|
|
You haven't created a variable yet, just a type
extern TEST_26_tt1 my_global_variable;
The extern is sometimes optional, but the same rules apply as for float.
|
|
|
|
|
When you form a union you have declared a variable; i.e.
// Form a union between the message structure and a buffer
union<br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
}test_26_tt1; in the code you can do the following:-
test_26_tt1.buffer[3] = 0xFF;
But how do you use the variable test_26_tt1 in another unit.
With a float you can use:
extern float flt;
But how do you do the same with test_26_tt1.
<br />
extern ???? test_26_tt1;
What type do you use.
grahamfff
|
|
|
|
|
I had to look up union again...
I think
extern union
{
TEST_26_TT1 message_data;
unsigned short buffer[32];
} test_26_tt1;
will work. Or make your union a full type like this:
union test_26_union
{
TEST_26_TT1 message_data;
unsigned short buffer[32];
}
extern test_26_union test_26_tt1;
Depending on if you want to use this union elsewhere.
Let me know what works, I've never used unions in C++, but I can think of a few times where it might be useful.
|
|
|
|
|
Its Monday morning here in the UK, just tried out your suggestion:-
extern union <br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
} test_26_tt1;
It worked OK.
I did try the other method you suggested:-
union test_26_union <br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
};<br />
<br />
extern test_26_union test_26_tt1;
But I kept getting the following error:-
My_Example error LNK2005: "union test_26_union test_26_tt1" (?test_26_tt1@@test_26_union@@A) already defined in Database2.obj
But thanks for your post.
|
|
|
|
|
Hey
In MSDN there is one function called "NetShareEnum", They have also provided example for it. I want to write same exapmle usign main() instead of wmain(). Plz any one can help...? I am also writing whole code here. Plz you also write whole code changin it to mian()...Thanking you....
--------------------------------------------------------------
#define UNICODE
#include <windows.h>
#include <stdio.h>
#include <lm.h>
void wmain( int argc, TCHAR *lpszArgv[ ])
{
PSHARE_INFO_502 BufPtr,p;
NET_API_STATUS res;
LPTSTR lpszServer = NULL;
DWORD er=0,tr=0,resume=0, i;
switch(argc)
{
case 2:
lpszServer = lpszArgv[1];
break;
default:
printf("Usage: NetShareEnum <servername>\n");
return;
}
//
// Print a report header.
//
printf("Share: Local Path: Uses: Descriptor:\n");
printf("---------------------------------------------------------------------\n");
//
// Call the NetShareEnum function; specify level 502.
//
do // begin do
{
res = NetShareEnum (lpszServer, 502, (LPBYTE *) &BufPtr, -1, &er, &tr, &resume);
//
// If the call succeeds,
//
if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
{
p=BufPtr;
//
// Loop through the entries;
// print retrieved data.
//
for(i=1;i<=er;i++)
{
printf("%-20S%-30S%-8u",p->shi502_netname, p->shi502_path, p->shi502_current_uses);
//
// Validate the value of the
// shi502_security_descriptor member.
//
if (IsValidSecurityDescriptor(p->shi502_security_descriptor))
printf("Yes\n");
else
printf("No\n");
p++;
}
//
// Free the allocated buffer.
//
NetApiBufferFree(BufPtr);
}
else
printf("Error: %ld\n",res);
}
// Continue to call NetShareEnum while
// there are more entries.
//
while (res==ERROR_MORE_DATA); // end do
return;
}
----------------------------------------------------------------
Thank You
Mahesh
|
|
|
|
|
Did you even try renaming wmain to main ? At least that would have shown you put forth some effort.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The following error appeared when I was adding a new function to one of my dialogs.
c:\SSIC_Example\GenericGuiDlg.h(18): error C2065: 'IDD_GENERIC_GUI' : undeclared identifier
I have checked and the 'IDD_GENERIC_GUI' is present in the reource.h file and used correctly in the .rc file.
I have seen this before and usually abandoned the project.
But this project is too big for that.
Any suggestions
|
|
|
|
|
Make sure you include resource.h in GenericGuiDlg.h.
|
|
|
|
|
Do you have IntelliSense? Does it recognize the identifier? (if the IntelliSense works, 'cause that's not always the case)
if it doesn't, try rebuilding the complete solution...?
Did you add the resource manually? (in that case did you set up the counter by 1 and did you give a unique id?)
If all else fails maybe you can create your resource dynamically in code?
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
sweep123 wrote:
c:\SSIC_Example\GenericGuiDlg.h(18): error C2065: 'IDD_GENERIC_GUI' : undeclared identifier
Right above this line should be the .cpp file that the compiler was operating on. I'll assume it was GenericGuiDlg.cpp. At the top of that .cpp file, right below the #include <stdafx.h> statement, should be the inclusion of the app's .h file. Inside of that file is where resource.h file gets included.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Hello, does anyone know how the CVS algorithm on comparing directory structure. For file comparing, I think it is using checksum. But how about the directory structure?
thanks.
Sonork 100.41263:Anthony_Yio
|
|
|
|