|
Use VariantChangeType[^] to convert the VARIANT to one holding a BSTR representation of the data before trying to use the BSTR.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
i write this simple program and execcte it. i thought that it will give all the name of directories where it was placed , but it is not working as i was thinking.i don't want to use system() function in place of crateprocess().my code is following-
#include<windows.h>
#include<stdio.h>
int main()
{
char *command="dir";
STARTUPINFO si = {sizeof(STARTUPINFO)};
PROCESS_INFORMATION pi;
CreateProcess("C:\\Windows\\System32\\cmd.exe", command, NULL, NULL, 0, 0, NULL, NULL, &si, &pi);
return 0;
}
please help me.i want to give command to createprocess() only when program is written not after execution of program.
|
|
|
|
|
ravi 12 wrote: char *command="dir";
change to
char *command="/C dir";
|
|
|
|
|
thanks Madhu Nair, it works fine but i didn't understant why you put /C dir .can you please explain it?
|
|
|
|
|
I don't really understand what you're trying to do, especially this is confusing:
ravi 12 wrote: i want to give command to createprocess() only when program is written not after execution of program.
Anyway, it seems that you want to start a new command shell and pass a parameter. In order to do that you would need this:
cmd /C dir
To do that with CreateProcess() I suggest the following code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
::ZeroMemory(&si, sizeof(STARTUPINFO));
::ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
if (::CreateProcess(NULL, "cmd.exe /C dir", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) == 0)
return FALSE;
|
|
|
|
|
thanks Michael Schubert, same thing i want to know with you.actually when i use
CreateProcess(NULL, "cmd.exe ", command, NULL, FALSE, 0, NULL, NULL, &si, &pi)
it will open a command prompt and then i have to write dir but i don't want that.
anyway it works fine but i didn't understant why you put /C dir .can you please explain it?
|
|
|
|
|
ravi 12 wrote: i didn't understant why you put /C dir .can you please explain it?
See the Windows Help for cmd. A statement such as cmd /C dir tells cmd to run the command 'dir' and then terminate. Without the /C option it will start a new cmd shell.
|
|
|
|
|
ravi 12 wrote: i thought that it will give all the name of directories where it was placed , but it is not working as i was thinking.
Did you try typing cmd dir in the Run dialog box and see what that did?
That aside, why are you not using the FindFirstFile() and FindNextFile() pair like was suggested here?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am using Visual Studio 6.0 when I tried to use add new files to my existing project it crashes (does the error report thing).
I also tried uninstall and reinstall visual studio..., but it does the same thing...
I have also gotten an error- MSDEV.EXE - application error...
"The instruction at "0x519e1a5b" referenced memory at "0x02004f48". The memory could not be "read""
I think this is the first time, so I have no idea if it ever worked...
I am using Win XP PROFESSIONAL SP-2.
Thanx in advanced,
Ratheesh.
|
|
|
|
|
hello Ratheesh
This may sound strange, but even I had a similar issue with VC6 after installing Project / Visio 2003 / 2007. Have you installed any of these softwares recently, or you have this problem since the beginning?
Thanx
|
|
|
|
|
Hi Vipin,
Yes that was the problem, thank you very much for your help.
Ratheesh.
|
|
|
|
|
|
|
How about the Process32First() and Process32Next() pair? They populate the PROCESSENTRY32 structure.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Dear Experts,
How to create a program for querying active directory using visual c++ with ADSI
|
|
|
|
|
How to fix the width of one of the list control columns ? It means that column can't be resized!
Thanks
|
|
|
|
|
Create a LVCOLUMN structure with its cx(width) set , and insert it to the listcontrol.
List Control[^]
|
|
|
|
|
|
See the Extras section of this article.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
I have not add any of my code to the MFC SDI project.
1. I start SDI by wizard in VS2008. Change CView's base class to CScrollView.
2. Rebulid my project and test it, maximize the window, close it and start it again,
It crashed!!!
Any one knows the different between start in normal and in maximize?
|
|
|
|
|
|
thanks you,
but this video does not show the crash case and how to fix it.......
|
|
|
|
|
I trongly suspect that default icon code of MFC dialog based app is almost totally useless.
Only useful code are the 2 lines:
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
SetIcon(m_hIcon, FALSE);
After deleting message handle OnQueryDragIcon(), SetIcon(m_hIcon,TRUE); and code in OnPaint(), visual icon on dialog interface and file-manager keeps the same.
Do you think default code I deleted is usefull in some cases?
|
|
|
|
|
includeh10 wrote: Do you think default code I deleted is usefull in some cases?
This code is placed there merely to show you how to add your own icon to your program/dialog. If you are happy to accept the default system icon then you have resolved the issue for yourself.
|
|
|
|