|
use runas command .. u can shellexecute runas from your program.
if u want more help type just runas in command prompt window.
If u can Dream... U can do it
|
|
|
|
|
if use "runas", i must input password when system prompt.
But all is transparent to operator , because operator just use my programme to modify files in one computer of domain and he dose`t konw where the file is!
So i must embed the username and password of the domain account created in server in my code!!!
-- modified at 4:39 Monday 4th June, 2007
|
|
|
|
|
if you know the user name and password, you can use the CreateProcessWithLogonW() function.
|
|
|
|
|
You might also want to look into LogonUser() and ImpersonateUser() .
"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
|
|
|
|
|
MSDN: "You cannot use LogonUser to log on to a remote computer."
The file i want to modify is in a Server!!!
|
|
|
|
|
zhongwenjia wrote: MSDN: "You cannot use LogonUser to log on to a remote computer."
The file i want to modify is in a Server!!!
It would have helped to state that requirement in your initial post.
"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
|
|
|
|
|
i want the reference for the charecter input system function code which is simmilar to windows operating system.
Please give me the reference.
Help Ever Hurt Never
|
|
|
|
|
Care to rephrase?
"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
|
|
|
|
|
hi guys i want some info,
i have CListCtrl. i want to know whicj column has been clicked by user, if user clicked on a particular column header how to know which column it is,
|
|
|
|
|
swarup wrote: if user clicked on a particular column header how to know which column it is
When a user clickes on the header, it will get the LVN_COLUMNCLICK notication. the lparam is a NMLISTVIEW pointer. The iSubItem member of that struct will have the column number
void MyDlg::OnColumnclickList1(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;<br />
int nColumn = pNMListView->iSubItem;
}
|
|
|
|
|
Hi,
for the header... I'm not sure, but for normal places... you can check which item (row) is, and compare the subitems (columns).
In any case I recommend you to take a look in the CListCtrl articles that are in the site. They would explain you a lot and maybe give you some idea or direct solution.
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?
|
|
|
|
|
Hi all. I'm working on a project to a subject in university and i'm going through a hard time trying in everyway i know and looking out in the net for solutions but i cant figure it out.
So the objective is to mix Visual Basic with a DLL made from C++. with simple functions it works, but now im calling from VB a function in the DLL sending one number and the function should go to the .txt and find the number of the line that number is. as it wasnt working i tryied in a simple c++ project with a main to do a "manual debugging" with returns and printfs. lol so here is the code. (don't mind the includes here, they're just there because they came with the copy-past from the DLL.) btw the most part of this code was copied from the internet and "moulded" to my problem.
#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<fstream>
#include <string>
int escolha_cod(double saldo,int escolha)
{
FILE *codigo;
int i=0,linha=0,j=0,aux=0;
char vec[2];
using namespace std;
string line;
ifstream myfile ("codigo.txt");
if (myfile.is_open())
{
for(i=0;i<10;i++)
{
getline(myfile,line);
const char *c_line;
strncpy(vec,line.c_str(),3);
aux=atoi(&vec[0]);
if(aux==escolha)
{linha=i;
i=10;}
}
myfile.close();
}return 47;
}
int main()
{int var;
var=escolha_cod(10,12);
printf("%d",var);
getchar();
return 0;}
If i put the "return 47;" right after "if (myfile.is_open()){" the printf says: 4403792
any idea? i would really appreciate a quick answer =) thks in advance guys!
|
|
|
|
|
Review your post; we can't see any of the "<" or ">" charcters or what's between them! The variable codigo seems unused.
Steve
|
|
|
|
|
why do i need an "<"or">" in my code?? i believe i didnt understand what you're trying to say..
yes codigo shouldn't be there lol its trash from others experiments lol
|
|
|
|
|
Have a look at your post. What does #include do without any file name after it?!?!?
Steve
|
|
|
|
|
right.. so i added this:
#include codigo.txt (with the rectangular brackets)
but it gives me this error: "dll.cpp:8:22: codigo.txt: No such file or directory"
i put the file in the possible directories (im using MinGW) I:\Programas\MinGWStudio\Templates\dll\Debug and I:\Programas\MinGWStudio\Templates\dll (because i dont know where its suppose to be..
-- modified at 3:20 Monday 4th June, 2007
|
|
|
|
|
GatoFedorento47 wrote: right.. so i added this:
#include codigo.txt
He meant to modify your post so that the angle brackets did not get "eaten." Modifying your code is obviously going to cause problems.
Notice the two angle brackets that are above the smileys.
"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
|
|
|
|
|
#include<windows.h>
#include<<stdio.h>
#include<<stdlib.h>
#include<<stdio.h>
#include<<time.h>
#include<<fstream>
#include<string>
#include <codigo.txt>
int="" escolha_cod(double="" saldo,int="" escolha)
{
="" file="" *codigo;
int="" i="0,linha=0,j=0,aux=0;
char" vec[2];
using="" namespace="" std;
string="" line;
="" ifstream="" myfile="" ("codigo.txt");
if="" (myfile.is_open())
{return="" 47;
="" for(i="0;i<10;i++)
" {=""
="" getline(myfile,line);
=""
="" const="" char="" *c_line;
="" strncpy(vec,line.c_str(),3);
="" aux="atoi(&vec[0]);
" if(aux="=escolha)
" {linha="i;
" }
myfile.close();
}
return="" 47;
}
int="" main()
{int="" var;
var="escolha_cod(10,12);
printf("%d",var);
getchar();
return" 0;}
apparently="" the="" problem="" is="" with="" <code="">if (myfile.is_open()), so i just wanted to know how do you open files.. :s
|
|
|
|
|
Is this supposed to be an improvement? Paste your code into a reply, highlight the code, and click the "pre" formatting button (above the smileys). Now for the important part: click the Preview button. If anything is askew, fix it. If any angle brackets are missing, delete the left angle bracket and then click the '<' above the smileys.
"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
|
|
|
|
|
#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<fstream>
#include<string>
#include<codigo.txt>
int escolha_cod(double saldo,int escolha)
{
int i=0,linha=0,j=0,aux=0;
char vec[2];
using namespace std;
string line;
ifstream myfile ("codigo.txt");
if (myfile.is_open())
{
for(i=0;i<10;i++)
{
getline(myfile,line);
const char *c_line;
strncpy(vec,line.c_str(),3);
aux=atoi(&vec[0]);
if(aux==escolha)
{linha=i;
i=10;}
}
myfile.close();
}return 47;
}
int main()
{int var;
var=escolha_cod(10,12);
printf("%d",var);
getchar();
return 0;}
sorry! its the first time im writing here.. i think now is just the way u asked..
|
|
|
|
|
GatoFedorento47 wrote: sorry! its the first time im writing here..
No problem. Everyone's got to start somewhere.
GatoFedorento47 wrote: i think now is just the way u asked..
Yep. All you got to do now is fix the problem.
"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
|
|
|
|
|
that's why im posting here.. so anyone can give me ideias on how to put this right.
|
|
|
|
|
GatoFedorento47 wrote: so anyone can give me ideias on how to put this right.
I already gave you the solution here.
"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
|
|
|
|
|
GatoFedorento47 wrote: strncpy(vec,line.c_str(),3);
This is guaranteed to fail. The variable vec can only hold only character plus the '\0' terminator.
GatoFedorento47 wrote: aux=atoi(&vec[0]);
Is the same as:
aux = atoi(vec); escolha_cod() returns nothing but 47. Is this intentional?
GatoFedorento47 wrote: ifstream myfile ("codigo.txt");
Shouldn't you be specifiying a path with this?
"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
|
|
|
|
|
for the two first problems, i still have to search in the net, but about escolha_cod() returning 47 was intentionla because in the function i've been moving it around to see where the function was failing. and it's after:
if (myfile.is_open()){
So most probably this is the error, but i dont understand, everybody uses it! and its not working 4 me
|
|
|
|