|
please help me to solve this problem
i am using the ShellExecuteEx to open a text file but an error occures
ERROR_ACCESS_DENIED if the os is NT.
thanks
|
|
|
|
|
1) Check the permissions on the file
2) Make sure you're setting the cbSize variable:
blah.cbSize = sizeof(SHELLEXECUTEINFO);
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
How to convert char * to const char * ?
LPSTR s1;
LPCSTR s2;
s1 to s2
Thank you.
|
|
|
|
|
You don't have to. The conversion is done automatically.
|
|
|
|
|
LPSTR smenu;
GetMenuString(hmenu_options_thread1,uIDCheckItem,smenu,0,MF_BYCOMMAND);
MessageBox(hWnd, smenu,"Thong bao",MB_OK);
It appear an error, why is it ?
Thank you.
|
|
|
|
|
microsoftcertificate wrote:
LPSTR smenu;
Buddy, you forget to provide memory to smenu .
microsoftcertificate wrote:
LPSTR smenu;
GetMenuString(hmenu_options_thread1,uIDCheckItem,smenu,0,MF_BYCOMMAND);
MessageBox(hWnd, smenu,"Thong bao",MB_OK);
Right code will be something like this
LPSTR smenu=NULL;
int nSize=GetMenuString(hmenu_options_thread1,uIDCheckItem,NULL,0,MF_BYCOMMAND);
smenu=new TCHAR[nSize+1];
GetMenuString(hmenu_options_thread1,uIDCheckItem,smenu,nSize,MF_BYCOMMAND);
MessageBox(hWnd, smenu,"Thong bao",MB_OK);
if(smenu)
{
delete []smenu;
smenu=NULL;
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
microsoftcertificate wrote:
Thanks.
Mention Not Buddy!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
There is no real conversion!
char * and const char * are the same data types, but for the latter, there is only read-permission given by the compiler. When the software is compiled, there should be no difference at all!
So:
s2 = s1;
Don't try it, just do it!
|
|
|
|
|
when we double click a bat file, we see a DOS window, the program is command.com
my question is:
can we redirect standard output, error and input streams of command.com to my own app?
i.e. in my app, i use CreatePipe(...) for command.com and send command line to it to execute the coomad line then read responding from it to my app.
any links or hints for my question?
thanks
includeh10
|
|
|
|
|
includeh10 wrote:
when we double click a bat file, we see a DOS window, the program is command.com
my question is:
can we redirect standard output, error and input streams of command.com to my own app?
i.e. in my app, i use CreatePipe(...) for command.com and send command line to it to execute the coomad line then read responding from it to my app.
any links or hints for my question?
Try this site: Click[^]
especially: http://www.robvanderwoude.com/redirection.html[^]
|
|
|
|
|
i need to redirect to my app, not a file.
in other words, command.com is invisible, i can not find clue on the web-site.
is it ur site? it looks great.
includeh10
|
|
|
|
|
|
hi
i have the string as str1 and then concatenated in str2 and now i have to execute it
str1="\"c:\Program Files\Demo\xyz.dll\"" ;
str1="regsvr32.exe /u " + str1;
how can i execute this programatically.
Itried with ShellExecute and system but it does not work
waiting for reply
Best Regards
|
|
|
|
|
Try this
string sFile(_T("regsvr32"));
string sParam(_T("/u \"F:\\Data\\MAPIProp\\mapiprop.dll\""));
::ShellExecute(NULL,_T("open"),sFile.c_str(),sParam.c_str(),0,SW_SHOW);
|
|
|
|
|
u can find source code of regsvr32.exe in VC++ samples, which is just a few of lines.
add the few lines inside ur app, things will be much easier and better - then you do not need regsvr32.exe again.
includeh10
|
|
|
|
|
Could you tell me what are differences between CComBSTR and _bstr_t ?
Thanks in advance.
|
|
|
|
|
|
When do we use CComBSTR or _bstr_t ?
Thank you.
|
|
|
|
|
microsoftcertificate wrote:
When do we use CComBSTR or _bstr_t ?
Depending on Situation!
CComBSTR use ATL.dll and _bstr_t use msvcrt.dll
anyways _bstr_t is always better as it's come after CComBSTR and Still in process of upgradation!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi
I am working with a win32 application. I am drawing 4 ellipses in a line on the window. When I draw the second ellipse, I want the first ellipse to be erased on the window and so on..i.e at a time I should see only one ellipse moving on the window in a line.
I am doing the painting in on WM_PAINT handler
I tried using InvalidateRect(NULL, rect, FALSE), it worked but the background drawing which was there on the window initially is getting erased, and the program is going into infinite loop.
Can anyone please give me some suggestions on this?
Thanks
osi-sys
|
|
|
|
|
I really think you are doing too much in your paint routine. The animation calculations should be left outside of your paint routine. Keep the painting very simple.
Your paint loop should only be concerned with painting the single 'current' ellipse.
Also, it can take care of erasing the location of the 'previous' ellipse if you want. Disabling background erasing might reduce your flicker.
Another option is to draw to a memory device context and blit that to the screen during your painting. This will reduce your flicker. And you can erase into the memory DC the old ellipse (an operation that will NOT be visible ont he screen), draw into it the new ellipse, and blit to the screen, then repeat.
|
|
|
|
|
How to enlarge image with antialiassing?
|
|
|
|
|
Hi,
I have coded a chat app. Server-Client based.
Everything worked fine. And suddenly I cant send a normal message anymore, which worked before.
What it does:
The client connects to the server and sends its name, which works. I get all contacts, and see them in my buddylist.
But if I want to send a message to one of the users (which goes to the server first), I get the above mentioned error.
This one means, that I am trying to send the message with a socket, which is no socket?!
But the socket is ok, it has a number, I mean, I get contacts through it etc.
I declared it globally cause I need it very often.
The message I want to send is ok, the string length is ok.
Whats wrong there?
I am coding in VC++6 without MFC.
here my little codesnippets:
/*** Creating socket ***/
if(WSAStartup(MAKEWORD(1,1), &wsaData) != NULL)
return(error(hDlg, "Cant initialize Winsock!"));
if((sock_clnt = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET)
return(error(hDlg, "Cant create local socket!"));
if((phostent = gethostbyname(ip)) == NULL)
return error(hDlg, "Cant get host by name!");
memcpy((char FAR *)&(sockin_clnt.sin_addr), phostent->h_addr, phostent->h_length);
sockin_clnt.sin_family = AF_INET;
sockin_clnt.sin_port = htons(port);
if(connect(sock_clnt, (SOCKADDR *)&sockin_clnt, sizeof(sockin_clnt)) == SOCKET_ERROR)
return error(hDlg, "Cant connect!");
/*** Here the problem call: ***/
int test = 0;
int test2 = 0;
test2 = strlen(msg2srvr);
if((test = send(sock_clnt, msg2srvr, test2, 0)) <= 0)
{
test = WSAGetLastError();
error(hDlg, "Cant send message!");
}
/*** Socket declaration before main function (globally): ***/
SOCKET sock_clnt;
Thats it. I really hope you can help me. Such errors are so annoying...
EDIT: What I just saw: The value of the socket from the client, changes between sending name at the beginning and sending a message when pressing the send button. Is that normal?
I Just connected to the destination socket, and run a thread with an endless loop receiving data with recv(). And if user presses the send button, it sends data through the same socket with send(). This is how it should work, right?
DKT
|
|
|
|
|
sock_clnt should never change!!!
Check your code if any line changes the value of sock_clnt.
Don't try it, just do it!
|
|
|
|
|