|
No you only need to include the wininet.h file where you are using the API functions at the top where you are including rest of the files
Alternatively you can include this wininet.h file in the stdafx.h file if you are using this API at various places in your project
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
plz tell me how to open a dialog box from another dialog box using MFC in a way that control can be transfered from one dialog to another simultaneously.
|
|
|
|
|
Create the second dialog box as a Modeless one.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If you need to interact with both, make the second dialog modeless. Otherwise, if you don't need to interact with the first dialog while the second dialog is active, make the second dialog modal.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I want to place a bitmap on the other side of the toolbar which is always empty.how can i use this place.
E-Ramu
|
|
|
|
|
Here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
objective: my objective is to write a code that has gui buttons, just by simply drag and drop i have to create a flow chart(same as the controls what we use in MFC). Does any one know how to do it. Help me.
KIRAN PINJARLA
|
|
|
|
|
See Here[^]
Cheers
"Peace of mind through Technology"
|
|
|
|
|
My first suggestion would be to break this problem down into several, smaller ones (e.g., one project with GUI buttons, one project that supports drag-and-drop, one project that allows drawing flowcharts). Solve them each individually, and then solve the project as a whole.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello
In Visaul Studio, I create a button in childview by CButton.create. Then I run the PPC emulator. I use the button in childview and the left key in navigation control set to call the specified function. When I press the left key, I can use the WM_KeyDown to call the specified. Then I pree the button, I can use
the OnCommand to call the specified function. Once I press the left key, but
I can't get the WM_KeyDown message.
What function or what setting are necessary to solve the question.
Thanks a lot
1
|
|
|
|
|
hi there,
which is the best way to add class objects at
program (c++) run-time?
thanx,
di troia
|
|
|
|
|
Uuuh ??
What do you mean by 'adding a class at runtime' ? You can't do such a thing (not directly I mean)
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
He was saying 'adding objects' ... ?!
Then it would be new
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: He was saying 'adding objects' ... ?!
Then it would be new
ASSERT(adding != creating);
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Hi all.
It's me again with another question regarding calling a process out of my program and reuse the output of it. I managed to get the output of the child process by using CreatePipe and CreateProcess (like described in the MSDN article Creating a Child Process with Redirected Input and Output). The problem is: i can't run any program i like. I tried with ipconfig and it works as a charm, when i tried dir, i get the filenames of the directory, but not as expected. I can't get the same output as in the command shell.
Example (i call a simple dir command from my program):
<br />
ExecCommand cmd;<br />
char* myCmd = cmd.Execute("dir C:\\");<br />
myCmd:
AUTOEXEC.BAT NTDETECT.COM hiberfil.sys
bla.bat bla2.bat blubb.exe
... ... ...
shouldn't the dir command return something like:
Volume in drive C is System
Volume Serial Number is D415-C6D2
Directory of C:\
05.04.2006 12:12 0 AUTOEXEC.BAT
05.04.2006 12:12 0 CONFIG.SYS
06.04.2006 10:34 <DIR> bla
...
And what about the return of a directory that contains a lot of files (like C:\WINDOWS\system32\)
My application freezes when i do char* myCmd = cmd.Execute("dir C:\\WINDOWS\\system32\\")
Thanks in advance,
n.
<br />
#include "stdafx.h"<br />
#include "ExecCommand.h"<br />
<br />
#define BUFSIZE 4096<br />
<br />
HANDLE hChildStdinRd, hChildStdinWr, hChildStdoutRd, hChildStdoutWr, hInputFile, hStdout;<br />
<br />
<br />
ExecCommand::ExecCommand()<br />
{<br />
<br />
}<br />
<br />
ExecCommand::~ExecCommand()<br />
{<br />
<br />
}<br />
<br />
<br />
char* ExecCommand::Execute(char* szCmdline)<br />
{<br />
SECURITY_ATTRIBUTES saAttr;<br />
bool fSuccess = false;<br />
<br />
<br />
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);<br />
saAttr.bInheritHandle = TRUE;<br />
saAttr.lpSecurityDescriptor = NULL;<br />
<br />
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);<br />
<br />
if (! CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0))<br />
ErrorExit("Stdout pipe creation failed\n");<br />
<br />
SetHandleInformation(hChildStdoutRd, HANDLE_FLAG_INHERIT, 0);<br />
<br />
fSuccess = CreateChildProcess(szCmdline);<br />
if (! fSuccess)<br />
ErrorExit("Create process failed with");<br />
<br />
<br />
return ReadFromPipe();<br />
<br />
}<br />
<br />
bool ExecCommand::CreateChildProcess(char* szCmdline)<br />
{ <br />
<br />
PROCESS_INFORMATION piProcInfo;<br />
STARTUPINFO siStartInfo;<br />
bool bFuncRetn = false;<br />
<br />
ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));<br />
<br />
ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));<br />
siStartInfo.cb = sizeof(STARTUPINFO);<br />
siStartInfo.hStdError = hChildStdoutWr;<br />
siStartInfo.hStdOutput = hChildStdoutWr;<br />
siStartInfo.hStdInput = hChildStdinRd;<br />
siStartInfo.wShowWindow = SW_HIDE; <br />
siStartInfo.dwFlags |= STARTF_USESTDHANDLES;<br />
siStartInfo.dwFlags |= STARTF_USESHOWWINDOW;<br />
<br />
bFuncRetn = CreateProcess(NULL, <br />
szCmdline,
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&siStartInfo,
&piProcInfo);
<br />
<br />
<br />
if (bFuncRetn == 0) ErrorExit("CreateProcess failed\n");<br />
else<br />
{<br />
WaitForSingleObject(piProcInfo.hProcess, INFINITE);<br />
CloseHandle(piProcInfo.hProcess);<br />
CloseHandle(piProcInfo.hThread);<br />
return bFuncRetn;<br />
}<br />
}<br />
<br />
char* ExecCommand::ReadFromPipe()<br />
{<br />
DWORD dwRead, dwWritten;<br />
static char chBuf[BUFSIZE];<br />
<br />
if (!CloseHandle(hChildStdoutWr))<br />
ErrorExit("Closing handle failed");<br />
<br />
for (;;)<br />
{<br />
if (! ReadFile(hChildStdoutRd, chBuf, BUFSIZE, &dwRead, NULL) || dwRead == 0) break;<br />
if (! WriteFile(hStdout, chBuf, dwRead, &dwWritten, NULL)) break;<br />
}<br />
<br />
return chBuf;<br />
}<br />
<br />
void ExecCommand::ErrorExit(LPTSTR lpszMessage)<br />
{<br />
fprintf(stderr, "%s\n", lpszMessage);<br />
ExitProcess(0);<br />
}<br />
|
|
|
|
|
nmx_de wrote: ...when i tried dir, i get the filenames of the directory, but not as expected.
Use the FindFirstFile() /FindNextFile() pair.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Can i use the insert query in d foll way with a variable..where
char* url="asdf";
How else do i insert value into MS Access DB which is contained in a variable?
_Commandptr m_pCommand;
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->CommandText = "INSERT INTO wcs(URL,Object_size,No_of_accesses,Transfer_cost,Group_no,Hvalue,Location)
VALUES(url,7,6,8,'hi')";
m_pCommand->CommandType=adCmdText;
m_pCommand->ActiveConnection = m_pConnection;
_variant_t vRecords;
m_pCommand->Execute(&vRecords,NULL,adCmdText);
|
|
|
|
|
Basically, that's just string manipulation routine. I don't know the type of _Commandptr::CommandText but take a look at sprintf (for a char string). If it is a std::string, then you can simply use a concatenation (+ symbole) to concatenate several strings.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Cedric Moonen wrote: If it is a std::string, then you can simply use a concatenation (+ symbole) to concatenate several strings.
concatenate?????i want to insert d value from url into access DB..so wher does concatenate come in2 d picture??
url is a user variable!
|
|
|
|
|
Yes, concatenate. You have to make a difference between the DB instruction (or whatever you call it) and how it is represented. In your case, what you are doing is executing a SQL (I think) commands that is contained in a string. But the way you 'construct' the string can be done in whatever way you want.
Let's take a simple example: suppose you want to select something from a database (very simple example). The 'thing' you want to select is contained in a variable:
std::string ThingToSelect = "Name";
So, in fact, you want to execute a command that looks like: "SELECT Name from table" and your "Name" is in fact contained in a variable.
So, just construct your string this way:
std::string Command = "SELECT" + ThingToSelect + "from table";
And you get exactly the same.
See, it is simply string manipulation and has nothing to do with your database.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
U mean lik this...rt?
But dis dint work either...some prob here?or any related glitch?
CString newurl=url;
CString string="INSERT INTO wcs(URL,Object_size,No_of_accesses,Transfer_cost,Group_no,Hvalue,Location)
VALUES("+newurl+",7,6,8,'hi')";
m_pCommand->CommandText = (_bstr_t)string;
|
|
|
|
|
shuchigo_jane wrote: But dis dint work either
Be more specific. What do you mean by 'don't work' ?
Also, use your debugger to see if the string is correctly written.
shuchigo_jane wrote: m_pCommand->CommandText = (_bstr_t)string;
Also for that, I don't think the cast to a (_bstr_t)string will work. What is the type of CommandText ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
dint work=throws an exception...
Cedric Moonen wrote: What is the type of CommandText ?
From msdn!!!...Sets or returns a String value containing a provider command, such as an SQL statement, a table name, or a stored procedure call. Default is "" (zero-length string).
Also if not cast,it gives a casting error.
|
|
|
|
|
And, did you check with your debugger to see if the string is properly 'spelled' before calling execute ? If you made spelled incorrectly, I cannot help you. One thing you have to try: just for a test, execute the same string but hard-code it (so, write it completely yourself with the url and everything). If you get an exception, then it means that the string is not properly spelled.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
worked jus fine with a hard coded string...
prob arose only wen we wanted to insert a value from a variable..
|
|
|
|
|