|
I tried it it did not work
the struct that iam using is part of the C++ libraries
here it is
typedef struct _SHARE_INFO_502 {
LPTSTR shi502_netname;
DWORD shi502_type;
LPTSTR shi502_remark;
DWORD shi502_permissions;
DWORD shi502_max_uses;
DWORD shi502_current_uses;
LPTSTR shi502_path;
LPTSTR shi502_passwd;
DWORD shi502_reserved;
PSECURITY_DESCRIPTOR shi502_security_descriptor;
} SHARE_INFO_502, *PSHARE_INFO_502, *LPSHARE_INFO_502;
And i have to use *PSHARE_INFO_502 as the name of the struct
Kelvin Chikomo
|
|
|
|
|
|
I get wrong out puts if i try this.
let me just give you part of my code
PSHARE_INFO_502 BufPtr,p;<br />
NET_API_STATUS res;<br />
LPTSTR lpszServer = NULL;<br />
DWORD er=0,tr=0,resume=0, i;<br />
<br />
lpszServer = lpszArgv[1];<br />
cout<<lpszServer<<endl;<br />
<br />
<br />
<br />
do
{<br />
res = NetShareEnum (lpszServer, 502, (LPBYTE *) &BufPtr, -1, &er, &tr, &resume);<br />
<br />
<br />
if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA)<br />
{<br />
p=BufPtr;<br />
<br />
<br />
for(i=1;i<=er;i++)<br />
{<br />
TCHAR* strPath =p->shi502_netname;<br />
<br />
cout<<strPath<<endl;<br />
CACLInfo objAclInfo(strPath);<br />
<br />
objAclInfo.Query();<br />
<br />
p++;<br />
}<br />
NetApiBufferFree(BufPtr);<br />
<br />
}<br />
else <br />
printf("Error: %ld\n",res);<br />
}<br />
while (res==ERROR_MORE_DATA);
|
|
|
|
|
as i can see from here, your real problem is probably not cout<<strPath<<endl; . I guess that cout statement is a debug output statement.
if you want to fix that part, you have to use wcout and it will print properly.
Is there any other problem in your code beside printing?
-Prakash
|
|
|
|
|
This maybe is a stupid question but I have to ask:
Are your program using UNICODE?
In that case, it's perfectly understandable:
The console doesn't want UNICODE, so when your 't' is written to the consol, the console sees a 't', followed by a \0.
And since \0 is a string terminator, the output is terminated.
Could this be the case here?
|
|
|
|
|
Yes i am programing in unicode.
So what shld i do
Kelvin Chikomo
|
|
|
|
|
Make sure your console output is in plain ANSI
|
|
|
|
|
I am not printing any thing to the console as yet.
You can look at the above threads to see my code.
Kelvin Chikomo
|
|
|
|
|
kelprinc wrote:
I am not printing any thing to the console as yet.
Sure you are. What do you think cout is for?
"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
|
|
|
|
|
I am now trying to use the W2A conversion but im realy doubting it
Kelvin Chikomo
|
|
|
|
|
You need to use wcout instead of cout .
"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
|
|
|
|
|
if you are using unicode build then you should use unicode set of apis to work on them.
If you really need to work on multibyte string then you may have to use WideCharToMultiByte api to do the convertion.
-Prakash
|
|
|
|
|
I have done one coding in doc/view,i have started the coding in base class as CView...can i change it to CEditView after finished my coding??
|
|
|
|
|
|
|
I did that..But error is occured.
|
|
|
|
|
|
Ya...I got solution...Thanx..
|
|
|
|
|
|
please give me a link for learn hooking,and any body have tutorial related to hook so please send me ASAP
Bankey Khandelwal
Software Engineer
Solversa TechnologiesPvt.Ltd.
15,Yeshwant Nagar
Range Hill Road
Ganeshkhind,Pune-03
bankey.khandelwal@solversa.com
Mobile: +91-9850432990
Office : +91-20-25521888
|
|
|
|
|
Bankey Khandelwal wrote: please give me a link for learn hooking
did you even searched CodeProject[^] ?
Bankey Khandelwal wrote: ASAP
you are not alone
Bankey Khandelwal wrote: Solversa TechnologiesPvt.Ltd.
15,Yeshwant Nagar
Range Hill Road
Ganeshkhind,Pune-03
bankey.khandelwal@solversa.com
Mobile: +91-9850432990
Office : +91-20-25521888
remove this ASAP...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
If there is a console application that returns some output to std out stream (that is via printf()) Can we launch such console application from MFC app and retrieve its output?
MFC:
1. run console app
2. run is blocked until console app returns
3. get console output
9ine
|
|
|
|
|
|
great thanks, will try this thing
9ine
|
|
|
|
|
I come to think about two solutions.
1.
Execute the console application and redirect it's output to a file (someprogram >outfile). When the console app exits, then read the file outfile.
2.
Use popen(), or _popen(). popen handles the pipes for you.
Kakan
|
|
|
|