Visual C++ :: Showing Console Windows In Win32 DLL?

Oct 31, 2014

Is it possible to show a console window in a Win32 DLL?

View 3 Replies


ADVERTISEMENT

Visual C++ :: Receiving Windows Message In Console Application?

Oct 11, 2013

I'm trying to write a program that passes Windows messages back and forth from another program that controls a laboratory instrument. I was able to write a program that successfully passes instructions, as evidenced by the instrument doing what I tell it. However, I am having trouble getting a return status from the instrument. The manual instructs the following:

// demo code, etc.
// send message to the instrument operating software here...
SendMessage(hwnd, WM_COPYDATA, tag, (LPARAM) &cd)

Either a completion message or return data is returned. Remote commands ReturnStatus, ReturnTiming, and ReturnData return data. In either case, data is received through an asynchronous windows message inside Win32 COPYDATASTRUCT type data packet.For example, a typical OnCopyData window callback is shown below, where the string data retrieved is finally stored into a Microsoft CString object. Note the use of variable replyTag, discussed above, which is used to isolate the correct windows message returned.

BOOL CUserDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* cd) {
….
if (cd->dwData == replyTag) {
/* String pointing to status */
CString retStatus = (char*) cd->lpData;
}
….
}

I can't tell if my problem is in generating the replyTag, getting the HWND to my own console window, or the actual receiving part of the code.

When setting the replyTag, the manual instructs: UINT replyTag = RegisterWindowMessage(“SOFTMaxProReplyMsg”);. However, I have to put an "L" in front of the string or I get a data type error (can't convert const char* to LPCWSTR).

When setting a HWND for myself, the manual instructs: HWND MyWnd = GetSafeHwnd().

That produces an error because GetSafeHwnd is a function of the Cwnd class, and I don't have a Cwnd. I have replaced it with HWND MyWnd = GetConsoleWindow();

When listening for the reply message, the manual instructs what I quoted above. However, I again don't have a Cwnd. I therefore simply used

if (cd.dwData == replyTag) {
CString retStatus = (char*) cd.lpData;
}

The above if statement always evaluates false, and the cd.lpdata contains the message that I had sent out instead of a reply message. How to get a reply using my console application. Here is the full code of my function:

Code:
#include "stdafx.h"
#include<iostream>
#include<vector>
#include<string>
#include<afxwin.h>
using namespace std;
void SendCommand(string command) {
// Get tags to identify the receiving and sending messages

[code]....

View 3 Replies View Related

C++ :: How To Use Mouse In Win32 Console

Jan 28, 2014

I want to show and control mouse in Win32 Console. What should I do? And I want to learn MFC programing.

View 3 Replies View Related

C++ :: Unable To Read A Certificate In Windows Store From Console Application

Sep 23, 2014

I have been struggling to read a certificate in windows store from C++ DLL, but its not happening. from console application I can but when same code built as a DLL and tried to access from a separate console application. I think its not going to windows store to read the cert.

pCertContext = CertFindCertificateInStore((HCERTSTORE)*pCertStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_ISSUER_OF, operator PCCERT_CONTEXT(), pCertContext);
int Error = GetLastError();
if (Error == 0)
LINFO << "
Signtuare is valid
";
else
LINFO << std::hex << Error << '
' << "GetLastErrorStdStr=
" << GetLastErrorStdStr();

it returns 80092004 GetLastErrorStdStr= C a n n o t f i n d o b j e c.

View 1 Replies View Related

Visual C++ :: Replacing GUI In Win32 Application?

May 15, 2014

I have a Win32 C++ application which works pretty well, but I don't like the GUI and I want to replace it with one designed graphically, a la Windows Forms. What is the best strategy to port my code? I tried creating a new Windows Forms C++ application and got pretty far with it, but was stymied when trying to call my unmanaged functions on a button press. If I can't use Forms to add a GUI without completely rewriting the program, what's my best bet?

View 14 Replies View Related

Visual C++ :: Calling Routines From Fortran 77 Using Win32 DLL

Aug 14, 2014

Is it possible to call VC++ routines using a Win32 DLL form fortran 77??

View 3 Replies View Related

Visual C++ :: How To Debug Win32 Message Loop

Sep 28, 2014

You place a breakpoint at one of locations within the message loop. But I want the breakpoint to trigger when I click on the application window, for example. But I can't, it went so fast so long as I switch from VS to the application program, the breakpoint is hitted again, then the application is frozen again. I don't know how to setup a conditional breakpoint.

View 3 Replies View Related

Visual C++ :: How To Call A Dialog From Win32 Resource DLL

Jan 16, 2013

How can I call a dialog , which is present in a seperate Win32 resource DLL .

View 4 Replies View Related

Visual C++ :: How To Get Same Info As Win32 PortConnector From DeviceIoControl

Mar 21, 2013

I can tons of information by calling DeviceIoControl (such as device ID, device description, whether it's connected or not) since I couldn't do it all with WMI. But I haven't figured out how to get from DeviceIoControl the info that a call to WMI's Win32_PortConnector gets. Are there any calls, directly to DeviceIoControl or something else that for a given device ID or device description would get the PortConnector information?

I would have used a combination of Win32_PortConnector and DeviceIoControl calls but the trouble with PortConnector is that it doesn't provide any information that would allow one to figure out which device ID it belongs to. Why do I need to do this? Because I'd like to get a combination of all the information the two methods provide for a given device such as a USB port, and all I'm getting from Win32_PortConnector is these scant few fields with no other clue:

string Caption;
string ConnectorPinout;
uint16 ConnectorType[];
string CreationClassName;
string Description;
string ExternalReferenceDesignator;
datetime InstallDate;

[Code] ....

View 1 Replies View Related

Visual C++ :: Create Window Form Function Using MFC Or Win32 API?

Jan 7, 2013

My setup is as follows:

There is function written C++, that must be compiled to DLL. This DLL is linked to some CAD (computer aded design) tool, that has special interface for it.

I want to add to this function some GUI (graphical user interface). So the creation of a window is necessary.

I've tried already with Win32, but without success.

The problem is that CreateWindow function requires application instance handle, that is provided by Windows itself when window is created in "normal conditions".

View 14 Replies View Related

Visual C++ :: What Is The Usual Maximum Size Of Stack Of A Win32 Program

Sep 24, 2014

I know that if the structure doesn't fit into the stack, it needs to be put onto the heap. But what is maximum size of a win32 stack in usual case?

View 4 Replies View Related

Visual C++ :: Program To Map Keyboard And Mouse To Xbox 360 Controller With Win32 And Xinput?

Aug 10, 2013

I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using

Code:
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) {
GetCursorPos(&mousepos);
profile->Buttons[6]->input.type = INPUT_MOUSE;

[Code] .....

I have tried everything to fix it.

View 1 Replies View Related

Visual C++ :: Showing Row And Column Totals?

Apr 24, 2013

Trying to show the Row totals and the Column totals.

#include <stdio.h>
int main() {
/* start of main */
#define NUMROWS 5 /* establishes NUMROWS as 5 */
#define NUMCOLS 5 /* establishes NUMCOLS as 5 */
int val[NUMROWS][NUMCOLS] = { {23,06,85,22,01}, /* declares array val to have 5 rows and 5 columns */
{07,33,62,17,04},

[Code] ....

I receive this message after building:

1>------ Build started: Project: WA 4 A 1 Christopher Caron, Configuration: Debug Win32 ------
1> WA 4 A 1 Christopher Caron.cpp
1>c:userschrisdocumentsvisual studio 2010projectswa 4 christopher caronwa 4 christopher caronwa 4 a 1 christopher caron.cpp(21): error C2106: '=' : left operand must be l-value

[Code] .....

View 2 Replies View Related

Visual C++ :: Showing Time For A User While Entering Some Characters

Dec 26, 2014

Im working on my project for college and i want to know how to add sth similar to a chronometer for user to see how much time have passed while entering some characters using cin.getline function.

View 2 Replies View Related

Visual C++ :: Payroll Program Is Showing Zero In Output Section

Nov 25, 2013

The program is showing zero in output section ....

Code:
#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int SZ = 55;

[Code] ....

The output:

Code:
First Last Employee Hours Rate Regular Overtime Gross
Name Name Number Worked of Pay Pay Pay Pay
==============================================================
Jane Adams A1234 40.00 10.00 0.00 0.00 0.00
Mary Lincoln L8765 50.00 10.00 0.00 0.00 0.00
Martha Washington W7654 25.50 10.85 0.00 0.00 0.00
John Adams A9876 52.00 15.75 0.00 0.00 0.00
George Washington W1235 45.00 25.00 0.00 0.00 0.00
Abraham Lincoln L9087 40.25 55.00 0.00 0.00 0.00
William Tell T9876 30.00 9.75 0.00 0.00 0.00

View 12 Replies View Related

Visual C++ :: Tool Tips Not Showing - Toolbar Menu Items Disabled / Inactive

Jan 8, 2014

My problem is ToolTips are not shown if any of the tool-bar menu items is disabled/inactive.

They are shown when all tool bar menus are active/enabled.

I am using TTS_ALWAYSTIP while creating Tool-Bar.

What to do to enable/display tool-tips always.

View 5 Replies View Related

Visual C++ :: Run MFC Application From Console?

Feb 7, 2013

I have a question about to run an MFC dialog based C++ application from console: if I run my application from console, I see the application start and the console immediately back to prompt. I need that console wait the application exit before show me the prompt again. I tried on Visual Studio 6, 2005 and 2010 but the behavior is the same.

View 3 Replies View Related

Visual C++ :: Cleaning Code For Better Console Presentation?

Dec 17, 2013

I have this function and it works, the problem is that it couts a bunch of stuff that I don't need. What this functions does asks the user to input a job (show) and if the show is found to list all the talents (actors/actresses). If the show is not found, to print "show not found". I have the function working just need to present it better. What I want the function to do is just print "show not found" and nothing else. How I have it currently will print:

Notice how its outputting all the unnecessary information. If the job is found should look like this:

Uploaded with ImageShack.us

Code:
void TalentsByJob(Agency Talents[], int limit) {
system("CLS");
string show;
cout << "Enter the Job: ";
cin >> show;
bool found = false;

[code].....

View 14 Replies View Related

Visual C++ :: Moving Cursor With Arrows In Console?

Nov 22, 2012

I have to write tic-tac-toe game in Visual 2010. My only problem is that I don't know how I can move the cursor with arrows in the console in order to fill in chosen positions in 3x3 table:

Code:
_ _ _
_ _ _
_ _ _

I guess that the needed functions are in here: [URL] ....

but I don't know from what to start with...

View 1 Replies View Related

Visual C++ :: Dump Information To Console Or Output Window?

Feb 6, 2014

I used to use OutputDebugString, and not using it now because it only allows to strings to be outputted, are there any methods that I can dump virtually anything to the console?

cout << thing << endl;

But what if I am not start running the program from the command prompt?

View 2 Replies View Related

Visual C++ :: Running / Debugging Console App That Needs Admin Privileges

Nov 4, 2012

I see there's something called a manifest file but VS C++ EXPRESS seems different than non-express. The solutions I've seen show applets/tabs that I don't have in Express.

In one of my physical DEBUG folders are some .manifest. files and some a .res and .rc file.

I know you need to edit the XML and change asInvoker to requiredAdministrator (or something like that).

The confusing part is if I go into Project Properties, MANIFEST TOOL caret/tree, under INPUT AND OUTPUT, it shows this .manifest file is OUTPUT. It's as if it rewrites it every time with some defaults? I have edited it, but I see it's back to asInvoker. There is a spot to put in a ADDITIONAL manifest file (or .res file).

Does a manifest somehow affect the physical .exe file (something is imbedded in it??)?

How do I change my project to make sure that the .exe always runs as Admin? Will doing this ALSO allow me to DEBUG it in VS C++ EXPRESS without having to do anything different (play with manifest or run VS outright with Admin level)?

View 2 Replies View Related

Visual C++ :: Updating To New Windows SDK?

Apr 27, 2013

I've just integrated the Windows SDK V7.0A into my VS2005 application, and I'm getting the dreaded "Application configuration error" when I try to run it on an XP machine.

It runs fine on the development machine, and some customer machines (Win7 and Win8), but will not run on XP due to missing/incorrect version dlls.

I've rebuilt all my libraries, but still no joy.

So, my first question is - If I upgrade the Windows SDK to V7.0A, do I also need to use MFC 10 and msvcrt10, or can I stick with MFC 8?

The next question is, how do I find out which dlls are missing, and which libraries or other dlls are requesting the missing versions?

View 11 Replies View Related

Visual C++ :: Deactivated All Windows Unless ONE

Apr 17, 2013

In my application I have some type of windows showed in an instance of time, and an action shows a new one that i want have the focus all the time , in the way that i can't works with no one of the others. They all are windows, child windows an modeless dialogs, but i don't know how to do. I try use EnableWindow(FALSE) that all the others windows and dialogs, but not works.

View 2 Replies View Related

C :: Possible To Split Command Console Into 2 Parts - Visual And Text Area

Feb 1, 2015

I have had experience in programming from python (slightly related, html/css) and the computercraft from minecraff (basic i think it is).

My question is mainly about the C and past experience with the computercraft.

1. Is it possible to split the command console into 2 parts (a visual area and a text area)
2. Is it possible to use any form of pixel art or custom characters within any command console using C.

View 2 Replies View Related

Visual C++ :: Use For Loop To Read Certain Data From Txt File And Print To Console

Sep 28, 2014

I'm new to programming and i'm trying to do a certain task. I want to use a for loop to read certain data from a txt file and print them to a console. I'm trying to read student names and their grades.

Something like
3 // 3 represents the number of students.
George 97
Sarah 70
Maya 88

The data may vary but it's always in this format.

View 14 Replies View Related

Visual C++ :: Retrieve IP Information On Any Windows

Sep 23, 2012

I used to retrieve IP and NIC information by querying windows registry. Now I'm trying to use GetAdapterAddresses() API. Using GetAdapterAddresses() to get IP is not that easy, I need to dig a long deep as I check some examples so far, anyways my question is: Calling this API will return success on all versions of Windows ie: 32bits & 64bits ?

Though Microsoft has not opened any source, where this API is actually retrieving Windows IP information.?. Is it reading Registry or some windows file.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved