Visual C++ :: Send Commands Or Variables
Jul 19, 2013
I'm trying to create an executable with C or C++ that send a command with the function system, but it waits for a command or key.
Example :
I send this:
C:
unas /noprofile user:administrator notepad.exe
But it waits for password.
Please type the password :
So my question is how can I make to send the password or that my program detect that prompt.
View 1 Replies
ADVERTISEMENT
Jan 23, 2015
This code doesn't send parameters to mysql database vis WININET post, i see it send empty fields, what exactly could be the problem:
Code:
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <Wininet.h>
#define PAGE_NAME "gate.php"
[Code] ....
View 13 Replies
View Related
Jan 26, 2013
I have struggled to send email from my MFC applications using severl methods:
1) http via my server - works but limited
2) M$ Outlook automation - works but not easily interchangeable between machines
3) Windows Sockets - available information simply too complicated
4) Purchase an ActiveX control - I hate black box solutions and am too cheap
I have looked at P. J. Naughter's class
CPJNSMTPConnection v2.99
An MFC class to encapsulate the SMTP protocol
[URL]
This approach requires the implementation of OpenSSL which turns out to be nothing short of a nightmare to install (so I never got it to run). I am looking for an example of an application that utilizes SMTP via Windows sockets api.
View 6 Replies
View Related
Feb 17, 2013
I want to send messege to click select check box. I can click button but I don't know how to select check box with VC.
View 2 Replies
View Related
Jan 10, 2013
I have found the following article to be a very excellent run through on how to use Outlook automation with C++ in Visual Studio 2010. However, I cannot find any description of how to add an attachment(s) to an email.
How to automate Outlook 2010 by using C++ in Visual Studio 2010 together with MFC
[URL] ....
View 5 Replies
View Related
Jan 2, 2014
I have a problem in a c++ project. I have created a .dll file and hooked to an .exe
I want this .dll to make a ping or to send a message like hello somewhere, and IF ping or message doesn't receive an answer that's means the user has suspended-terminated this dll from the exe then the exe will close. How can i do that?
View 11 Replies
View Related
May 14, 2014
I want to send a number to my OPENGL class from my main dlg. Im using a updated edit control.
here is my open gl code that will draw what I want
Code:
void COpenGLControl::oglDrawScene()
{char side[32];
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin(GL_LINE_LOOP);
for(int i = 0; i < 256; i++) {
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
[Code]...
I want to update the glVertex3f values when I enter numbers into edit controls on my main dialog
how can I send messages from my main dialog to the opengl class that I created?
View 1 Replies
View Related
Sep 6, 2013
I am writing an MFC app in Visual Studio 2012 that will open a JPG file as binary and read all the contents to a CString.
I am able to read it to a std::Vector, but that doesn't work much as i need to pass all the binary content as a MFC CString to another function.
More Update:
Let me explain the problem a little more deeper.
I am trying to call a JavaScript (JS) function in a HTML page and then want to pass the binary date. The C++ function that calls the JS is given below.
bool CallJavaScript(const CString strFunc,CComVariant* pVarResult);
The 1st argument is the JS Function Name and 2nd is the one to pass the Binary Data. 1st argument works fine as i am able to call the JS fucntion called "LoadImage" without any problem. Problem is with 2nd argument that's supposed to take the Binary data of the JPG file.
If i try to pass a std::Vector or std::string then it will give me an error.
But it's happy if i pass CString. But then with CString there's a problem with NULL characters.
Actually my plan is to pass the binary of a JPG to a JS function and let it display the JPG in the HTML page.
Can i typecast a Vector or std::string to a CComVariant*?
View 3 Replies
View Related
Nov 7, 2013
So, as far as I can tell, this code should run a system command from the C++ program:
system("ping 192.168.1.2 /t /l 32768");
However, I just keep getting a "system Was not declared in this scope" error message. Is there something wrong with this?
View 1 Replies
View Related
Sep 10, 2013
I got a assignment in which i have to write codes for execution of certain commands.
One of the command is set_time. if user enters set_time 12:12:12
The time should get reset to 12:12:12 no matter what it is now.
View 7 Replies
View Related
Nov 3, 2014
I am working on a program that does something like this,
Void main() {
cout<<"H";timedelay(1);
cout<<"E";timedelay(1);
cout<<"L";timedelay(1);
cout<<"L";timedelay(1);
cout<<"O";timedelay(1); //timedelay(int a) is a function which gives a delay of 'a' seconds.
{
....
}
}
This code is just for fancy and I would like to squish in some statements which would give the user an option to skip it (by entering any keyboard key),and resume with the rest of the program.
View 10 Replies
View Related
Sep 18, 2012
In Windows, if you open a command prompt, there are a bunch of keywords like, 'chdir', 'copy', ...
What I'm trying to figure out is how to use that COPY command in c++ code. I want to use the COPY command with the options (/a, /b, ...).
View 3 Replies
View Related
Mar 3, 2013
I made client server program with fork ,without using signal handler because I want to see the status zombie for parent server, but when i execute "ps" command i didn't see anything for server or client pid or ppid ,i wonder about how to show the server and client process coz when i execute commad "ps" i saw only ps and bash processes???
View 1 Replies
View Related
Aug 1, 2013
I've read that we can write a program that displays a menu of commands for the user to choose from.We can write some functions that implement these commands, then store pointers to the functions in the array :
Code:
void ( *file_cmd[])(void) = { new_cmd , open_cmd }; // 2 cmd's for simplicity
We can get a similar effect with a switch statement but using an array of function pointers gives us more flexibility since the elements of the array can be changed as the programm is running.
I decided to write an example about this in order to understand better the context, I am facing some problems though :
Code:
#include<stdio.h>
#include<stdlib.h>
typedef void (*p_foo) (int);
void foo(int x);
void foo2(int y);
[Code] .....
The problems are :
Code:
TEST2.c:9: warning: initialization from incompatible pointer type
TEST2.c:9: warning: initialization from incompatible pointer type
TEST2.c:25: error: too few arguments to function "*(arr + (long unsigned int)((long unsigned int)i * 8ul))"
View 14 Replies
View Related
Sep 15, 2013
I'm writing a program to turn the two commands "gunzip file.tar.gz" then "tar -xvf file.tar" into "x file.tar.gz", but I've ran into a problem I can't find a solution to, here are the outputs I get depending on if I use a gunzip -f flag in my system() call or not:
if I use: (void)system("gunzip ", store );
> x file.tar.gz
gzip: compressed data not read from a terminal. Use -f to force decompression.
type: gzip -h
store 1: file.tar.gz
tar: option requires an argument -- 'f'
[code]....
I don't know if the problem is something to do with my code or something to do with gunzip and if it is to do with gunzip if I can even solve it with my code? I've tried for a while to find more info and read the gunzip man file, ran "gunzip file.tar.gz" outside of my program and found that it works normally producing file.tar so I suspect the problem is related to system()?
View 3 Replies
View Related
Mar 24, 2013
I'm trying to write a recursive function that takes in a vector of strings that contains
"1 forward", "2 forward", "rotate left", "2 backwards" ... etc
how can I write recursive function that creates a vector of every unique combination of commands?
View 8 Replies
View Related
Apr 19, 2014
I was interested in making a food ordering program utilizing voice commands. I hope to build a GUI with items listed on one side, and with voice commands picking up on key words that will add the food to the right of what you chose.
View 4 Replies
View Related
Feb 9, 2014
I am using Visual C++ to write an app. One problem is that the application will allocate a lot of object instances of a specific class CMyObject, maybe 400, 000. This will cause "Out of memory" error when total allocated CMyObject reaches 400,000.
To solve this problem, I just wonder when a new CMyObject instance is created, is it possible to specify so that the instance will allocate on a disk cache, or file mapping instead of the memory space?
View 3 Replies
View Related
Oct 13, 2014
In the following code I want to iterate through "Win32_OperatingSystem" to find all variables and their values. Using GetNames() I can get the names of all the variables but the subsequent Get() call fails to return a value.
Code:
//connect to WMI
std::wstring wmiClass = L"Win32_OperatingSystem";
CComPtr< IWbemLocator > pLocator;
HRESULT hResult = pLocator.CoCreateInstance( CLSID_WbemAdministrativeLocator, nullptr, CLSCTX_INPROC_SERVER );
if ( SUCCEEDED( hResult ) )
[Code] ....
View 12 Replies
View Related
Apr 7, 2010
The objective: Open and read a CSV file one line at a time using SQL commands.
The problem: I am getting an error that I have a feeling may not point to the "real" problem.
Where I may have syntax or other errors in code.
stInputConn = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=V:\IT\RE\Exports\;Extended Properties="text;HDR=YES;Format=Delimited(,)"";
OleDbConnection cn = new OleDbConnection(stInputConn);
stInputFileName = ConfigurationManager.AppSettings.Get("InputFile");
// the input file name is CSV_DataExport.CSV
[Code] .....
The last line (ExecuteReader) is where I get the OleDb Exception.
View 9 Replies
View Related
Apr 8, 2015
C++
Create a Triangle class that has the following member variables:
side1 - a double
side2 - a double
side 3 - a double perimeter area
The class should have the following member functions:
- default constructor that sets the value of all 3 sides of a triangle to 0.0
- a constructor with arguments that accepts values for the three sides of a triangle (member variables) as arguments
- setDimensions - a function that allows the value of the three sides to be entered by the user through the keyboard
- testSides - a function that determines if the 3 values entered can actually be the sides of a triangle. If they do not create a triangle, print the values entered and an appropriate message
--The sum of any two side lengths of a triangle must always be greater than the length of the third side: so side 1 + side 2 > side 3 and side 1 + side 3 > side 2 and side 2 + side 3 > side 1 ( all three must be true for the 3 values to make a triangle)
- getSide1 - a function that returns the value of side 1, getSide2 - a function that returns the value of side 2, getSide3 - a function that returns the value of side 3
- getArea - a function that returns the area of a triangle: The formula for the area of a triangle (when the height is not known) is: A = sqrt (p(p-side1)(p-side2)(p-side3)) where p = (side1+side2+side3)/2
- getPerimeter - a function that returns the perimeter of a triangle: Perimeter = side1 + side2+ Side 3
- A displayTriangleInfo function that displays side1, side2, side3, area, and perimeter for a triangle object.
After testing your code for a single object, create an array of 5 triangles. Use a for loop and the setDimensions function to allow the user to set the values for the 3 sides of a triangle, test the vales entered to determine if the 3 create a triangle. If they do create a triangle than use the getArea and getPerimeter functions to calculate the Area and Perimeter for the triangle and use the displayTriangleInfo function to display all of the data for that triangle. If the three values do not create a triangle then print the 3 numbers entered and an appropriate message. In either case the loop should then move on and get the data for the next triangle from the user.
View 7 Replies
View Related
Oct 18, 2014
I just started programming and want to make the game cows and bulls. The problem is that after the loop has ended and both vectors are not the same I want the user to 're-input' the starting variables a,b,c&d but I don't know how to.
Code:
#include "std_lib_facilities.h"
int comparison(int a, int b, int c, int d)
{
vector<int>bc={ 1, 2, 4, 9 };
[Code].....
View 2 Replies
View Related
Mar 10, 2014
I came across the following code today and I was a bit surprised that it worked:-
Code:
std::string func_A () {
static std::string x;
if (!x.empty())
return x;
[Code] ....
I've simplified things slightly - but the basic point is that both functions are in the same source file and they both have a static std::string called 'x'. Being static, I guess they aren't (strictly) local variables. So how does the compiler know that they're different entities? Does it encode their signatures using the function name or something like that? If I call each function separately I do seem to get the correct string...
View 5 Replies
View Related
Sep 30, 2014
I have created a windows form project in visual studio so that I can use a windows form to interact with the game class that I'm creating, but I'm running into some problems.
For one thing, I would like to be able to call Image::FromFile() one time only during initialization, and store the result in a member variable (called mBGImage). From what I can tell, the variable needs to be of type String^ (this caret symbol is new to me, but I understand it is the "managed code" version of the standard pointer, which would look like String*).
When I try to compile the following code (located in my header file) I get the error :
"error C3265: cannot declare a managed 'mBGImage' in an unmanaged 'BSG::BSGame'".
How can I store the result of Image::FromFile() permanently in my class?
When I try to declare a global variable of type "Image^", I get "error C3145: global or static variable may not have managed type System:rawing::Image ^"
#include "stdafx.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
[Code] ......
View 2 Replies
View Related
Sep 8, 2014
I am new to VC++ 2012. I have this code snippet.
Code:
auto it = query_map.find(U("callback"));
The problem is right under the dot there is a red line the error is
Error1error C2664: 'std::_Tree_iterator<_Mytree> std::_Tree<_Traits>::find(const http::uri::encoded_string &)' : cannot convert parameter 1 from 'const wchar_t [9]' to 'const http::uri::encoded_string &'d:maverickprojectsstrikeforcesrcserverserverserver.cpp26
What is the solution to this error?
View 3 Replies
View Related
Jul 31, 2013
I have written a class "FileSet " in program's Document class.
This class contains other Four classes as
"Machine1" , "Machine2", "Machine 3" and "Machine 4".
Now my problem is Machine 1 can not access variables from Document class or other variables from FileSet.
How to access them ?
View 9 Replies
View Related