Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

C++ Array Length Error - Byte ar[]

$
0
0

------NEED First PICTURE------

Hello,

C# to its worked, parametre 50 results. But C++ to 4 results :/

(sizeof(btPattern)/sizeof btPattern[0]);
                ve(sizeof(btPattern)/sizeof(*btPattern));

OUTPUT=4, I NEED 50

Thanks :)


struct bilgiler { string ad ="Emre Demircan"; int yıl = 2000; string fb = "fb.com/DeatSlayer"; }bilgi;


FindFirstFile matching problems

$
0
0

I am using FileFirstFile / FindNextFile to scan a directory with this mask: "c:\\mydir\\*.doc"

However it is finding all files with extensions that begin with DOC, including DOCX, DOCM, etc.  Is there a way to match exactly unless there is actually a wildcard?  (e.g., *.DOC*)?

I am on Windows 7 x64.

Thanks.

Regarding WindowsSdkDir path in VS 2013

$
0
0

Hi,

  I installed Windows 10 SDK & updated the registry “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows” current installed folder/version to SDK 10.

I still see in my Visual Studio Cmd, that it is pointing to 8.1(WindowsSdkDir). Does anyone can help me, how to make sure that my VS2013 uses SDk 10?

I dont want to upgrade my Vs porjects to VS 2015. Is there a way to achieve this.

Thanks

Santhi

IDE: recent projects MRU list - any way to increase the width of the list?

$
0
0
Hi,

Within the Visual Studio IDE, is there a way to increase the width of the MRU project/solution list?

We have the same solution name in different directories but the solution path name is cutoff so we have no way to tell which solution it is.

Is there a way to customize the IDE to handle longer path names?

Thanks,

Ted 

Help with mpiexec error 1722

$
0
0

Hello,

I am trying to run a simple MPI program using MSVS 2015 and the MS MPI libraries. I have downloaded and installed the microsoft HPS SDK 2012 packs, and I'm trying to get a very simple MPI program to run, but when I run the command:

...\Visual Studio 2015\Projects\MPI Instilation test\Debug>mpiexec -n 4  "MPI Instilation test.exe"

I get the error 

Aborting: mpi appplication on DESKTOP-U4S9OAG is unable to connect to the smpd manager on (null):60313 error 1722

Aborting: mpi appplication on DESKTOP-U4S9OAG is unable to connect to the smpd manager on (null):60312 error 1722

job aborted:
[ranks] message

[0] fatal error
Fatal error in MPI_Init: Other MPI error, error stack:
MPI_Init(argc_p=0x0018FA44, argv_p=0x0018FA48) failed
The RPC server is unavailable.  (errno 1722)

job aborted:
[ranks] message

[1] fatal error
Fatal error in MPI_Init: Other MPI error, error stack:
MPI_Init(argc_p=0x0018FC4C, argv_p=0x0018FC50) failed
The RPC server is unavailable.  (errno 1722)

Aborting: mpi appplication on DESKTOP-U4S9OAG is unable to connect to the smpd manager on (null):60310 error 1722

job aborted:
[ranks] message

[3] fatal error
Fatal error in MPI_Init: Other MPI error, error stack:
MPI_Init(argc_p=0x0018FB3C, argv_p=0x0018FB40) failed
The RPC server is unavailable.  (errno 1722)

Aborting: mpi appplication on DESKTOP-U4S9OAG is unable to connect to the smpd manager on (null):60311 error 1722

job aborted:
[ranks] message

[2] fatal error
Fatal error in MPI_Init: Other MPI error, error stack:
MPI_Init(argc_p=0x0018FD34, argv_p=0x0018FD38) failed
The RPC server is unavailable.  (errno 1722)

The test code that I am using is exactly the example program given on:

http://visitusers.org/index.php?%20%20title=Parallel_on_Windows#Building

What does this error mean? I've looked around for an explanation/fix, but I haven't found anything yet.

I'm running this on a 4 core desktop, and to build the .exe, I followed the steps outlines in:

http://blogs.technet.com/b/windowshpc/archive/2015/02/02/how-to-compile-and-run-a-simple-ms-mpi-program.aspx

Thanks,

Michael

S-Box in C [2] Simplified [ Question ] v2.1

$
0
0
void initialize_aes_sbox(uint8_t sbox[256]) {
	/* loop invariant: p * q == 1 in the Galois field */
	uint8_t p = 1, q = 1;
	do {
		/* multiply p by x+1 */
		p = p ^ (p << 1) ^ (p & 0x80 ? 0x1B : 0);
		/* divide q by x+1 */
		q ^= q << 1;
		q ^= q << 2;
		q ^= q << 4;
		q ^= q & 0x80 ? 0x09 : 0;
		/* compute the affine transformation */
		sbox[p] = 0x63 ^ q ^ ROTL8(q, 1) ^ ROTL8(q, 2) ^ ROTL8(q, 3) ^ ROTL8(q, 4);
	} while (p != 1);
	/* 0 is a special case since it has no inverse */
	sbox[0] = 0x63;
}

This is where we left on previous thread. : 

Presumably you are asking where something like 16 * 2 + 3 is used in the sbox generator. Nowhere. 16 * 2+ 3 is just an example to show you that you can access data in a single dimensional array as if it was a table with rows and columns. For example you could display the array filled by initialize_aes_sbox in a table format by using this:

for (int i = 0; i < 16; i++)
{
    for (int j = 0; j < 16; j++)
        printf("%02X ", sbox[i * 16 + j]);

    printf("\n");
}
by Mike Danes

Then what's in S-Box above and how to handle  and use  that for ? 

What all process will take when we run the executable file in windows

$
0
0

When we are compiling source file first it will convert into .Obj file and then linker will produce an executable file. So my question is will the executable file contains both .h and .cpp file or only .cpp file?

What all process will take place when we run the executable file(.exe)?

If someone helps me in this it would be great thank you.

enum in IDL

$
0
0

Hello folks,

I've defined an enum in my IDL file:

typedefenum


{

PROP_PROPSET = 0,

PROP_PROPGET = 1,

PROP_PROPNOTIFY = 2

} PROPREQOPERATION ;

Unfortunately, this enum does not appear in .tlh file.

What can be the reason?


Establishing automatic comport Detection

$
0
0

Am trying to establish automated serial connection with a bluetooth device.

For ex . the device is paired with a comport number 20 (Outgoing port) .The problem in this device is once the device is turned off ,it disconnects the bluetooth connection resulting the comport in some inaccessible state.(ie. when i try to open the create file handle returns 0x79 -ERROR_SEM_TIMEOUT).

So i tried polling for the comport connection as shown below in main thread ,

{
......

    do
    {

        hSerial = CreateFileA(pcomport,
            GENERIC_READ | GENERIC_WRITE,
            0,
            0,
            OPEN_EXISTING,
            IO_ATTRIBUTE,
            0);

        if (hSerial == INVALID_HANDLE_VALUE)
        {
            result = GetLastError();
            if (ERROR_FILE_NOT_FOUND == result)
            {
                //serial port does not exist. Inform user and exit for now...
                printf("spc [OpenSerialPort]:unable to detect COM port: %s\n", pcomport);
                return hSerial;
            }
            //some other error occurred. Inform user.
            printf("spc [OpenSerialPort]:unknown error 0x%08x at %s\n", result, pcomport);
            CloseHandle(hSerial);
            //return hSerial;
        }
    } while (hSerial == INVALID_HANDLE_VALUE);

....
}

This seems to work fine .But the problem am facing is while this program is running aside ,when i  run another program which  opened some other device (different comport num - Incoming port) where bluetooth connection is maintained ,the Readfile method couldnt read the data sent by the device .it fails .

When i stop this polling code,i can get the data from other device (which uses the Createfile followed by Readfile without polling) .

To be clear why Reading a comport fails , while  using Createfile continuously with another comport ?

may be because of polling with  CreateFile() ?!  


I couldnt find any method in msdn to detect the Serial port connection is established. ?

Any help would be appreciated .thanks.


EDIT:  Sorry i have updated my question  in detail .




How to enumerate tasks in Task Scheduler? Where are my Tasks/jobs?

$
0
0

I downloaded and ran the example here:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa446881%28v=vs.85%29.aspx 

This lists three tasks including one from dropbox. However I did not see the several tasks I have created and run that appear in the task scheduler GUI in the control panel.

Actually I have dozens of tasks various third parties have installed on my machine and only three show up with this sample program (and they all end with .job -- what does that mean?).

How can I modify this sample program to display all my jobs/tasks that I see in the Task Scheduler GUI in the control panel?

Thanks

Siegfried


siegfried heintze


Android Development with C++ ( Visual Studio 2015 Update V1)

$
0
0

Hello everyone,

We are trying to develop Android Project with using C++ and Android. We have 2 C++ projects that one of them depend on the other, in Visual Studio 2015 update v1. Let say our X project depend on Y project , thus we need to build firstly Y then X. Even we do not change anything in Y project (already builded) , Visual Studio can not figure out the Y is ready and rebuild it which is not necessary.

Since We have 8 different projects , 1 changing on the first project cause that all 8 projects need to build. This is huge waste of time for us. If we don't give a build dependenciens and then rebuild the just changed one is okay. However this time, we have to build one by one.

Briefly, we want to give a build dependenciens to all projects but VS don't understand the project is already builded. What should we do? 

Send data to respective Serial Comports Bluetooth

$
0
0

Hi ,

Another question related to BT Serial Connection.

I  two devices A & B.Both have its own com ports  eg: A has com 21 ,B has com 22.

When i turn on the device A and open the port 21 ,it sends data to the port (opened using Terminal teraterm).the same works for device B with com 22.

In case when i turn on device A and open com 22 ,still it receives data .Same with device B & com 21 

So  watever incoming com port i open first ,the device sends data to these ports irrespective of their dedicated Com channels. 

i did this experiment in a normal Terminal program (eg:Teraterm,realterm etc ) . How can i make these devices to send data to its dedicated Comports ,rather than the one which is opened first.

EDIT: 

these two BT devices( SPP profile based) are paired & have their own dedicated Comports assigned.As far as i know  these devices should use their respective comports to send data to PC.

But they tend to send data to any random comport which is open at that point of time  ! 

Thanks


Check MS Office license status

$
0
0

Is it possible to programmatically check MS Office (2007-2016) license status? (C++ preferable)

I'll share with you my research, maybe it will somehow help.
I know that starting from office 2010 there is OSPP.vbs script to check license status. But since I can't use this script in my code (because of security issues), I'm using WMI to query LicenseStatus from SoftwareLicensingProduct information in C++ . 
The problem is that for 2013 office there are 36 licenses returned from the query (2 of them have keys - the first license stands for Word,Excel,PowerPoint, and the second for Visio). 
For 2016 office there is a license for EACH office application (one for Word, one for Excel, one for Powerpoint and one more for Visio). One of them may expire earlier than another, while for 2013 office there is a common license for Word-Excel-PP and another for Visio. How can I unambiguously detect whether certain license 1) covers the Office application I'm using through object model 2) hasn't expired yet? 
(Is there some kind of ID for each application which is availble in SoftwareLicensingProduct class?)

N.B. The point is that I'm using Word, Excel, PowerPoint and Visio (2007-2016 versions) through object model in C++ and before starting any of the applications I need to know, whether their licenses have expired. 

I'll appreciate any help! Thank you in advance.

CHtmlView "Microsoft Print to PDF" "Programmatically set filename and path for the file to print"

$
0
0

I currently display HTML report documents in a CHtmlView.

In Windows 10 OS, currently I'm printring directly to the "Microsoft Print to PDF" using the following code :
//sets the printer name of the default printer for the current user on the local computer.
SetDefaultPrinter(_T("Microsoft Print to PDF"));
//Print command - without prompting the user.
m_pWndHtml->ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, &parameter, NULL);
Note that m_pWndHtml is CHtmlView object. 

However this will prompt user for location+filename. 
I would like to programmatically control this from C++ to not prompt for the PDF filename but save to a specific filename in some folder that I provide.
Would it be possible to accomplish that??
Unless it would be possible to specify the name of the file before calling m_pWndHtml->ExecWB?

I would like for my C++ code to call an API(or a printer) that would let me automatically generate/create PDFs from my HTML documents to a specific file and location (which I will pass as a parameter to the API method) without any prompt/dialogs to the user.

This question is a Follow-up on the following one:
https://social.msdn.microsoft.com/Forums/en-US/70705f9d-6a1a-41f0-aeb9-aeee2e13983e/microsoft-api-that-would-let-me-automatically-generateprint-my-pdfs?forum=vcgeneral

Thank You.

MichelCunha

3D Perspective Projection - Too samll

$
0
0

Using VC++ MFC OpenGL's gluLookAt(), glFrustum, I can render this cabinet on the screen OK in a perspective view.  

Now, without using OpenGL, I want to draw the same cabinet using MoveTo/LineTo on the screen. Device coordinate to screen conversion is already taken care of.,,, So, my line drawing should precisely match my OpenGL rendering...

So I applied ViewMatrix to the vertex COORD of the cabinet and drew my line-drawing cabinet. The picture looks similar to OpenGL, with proper rotation, but "perspective" is missing, 

So, using the formula, I created a frustum matrix using width/height, near, far values. I applied this Frustum matrix to the vertex COORD above and drew the cabinet picture. I did use homegeneous coordinate and divided my vertex COORD (x,y,z) by "W." Now my line drawing cabinet came out exactly as the OpenGL picture, except it is much smaller...

I am using the same device-to-screen conversion as OpenGL, so some scaling factor is missing in my line drawing (not using OpenGL). If I use a larger W, say, 100 x W, my cabinet size becomes closer to OpenGL picture.

I lost the scale because Homogeneous Coord System is "Scale-invariant" ...

So,  where can I get it?

Makoto







In C++ how to use new line in mailto protocol?

$
0
0

Hi,

I am using mailto protocol to launch default mail client.

In mailto protocol body client I need to insert line break.If I use \n line break is not displaying.

and how to escape special characters such as ", &,{, }, etc.

Please anyone help me.


C++ Compiler Optimization Broken in VS2013 and VS2015

$
0
0

I've noticed today that many of my compiled projects are now much larger than previously.

After investigating it looks like the compiler is no longer optimizing code during compilation.

I have tested with a simple Win32 Console App, with the code below, however the test string is showing in the compiled code!

I would be grateful, if others on the forum can confirm this as an issue (and perhaps any kind of solution?)

#include "stdafx.h"
#define debug 0
int main()
{
	if (debug > 0)
	{
		fprintf(stderr, "This should not appear in the compiled code!!!!!\n");
	}
    return 0;
}

c and cpp projects

$
0
0

I need to work on visual studio. Looking for IDE to work on C and CPP. which version of visual syudio to download for windows 2010

Connecting to an Access database with visual c++

$
0
0

Look folks is there any way I can SIMPLY connect to an access database inside my dialog based MFC application?

I am not remotely interested in learning how to create database 'battleship' solution, with project wizard, when all I need is a 'dingy'.

Or am I just better off sticking my data in some text files and access it the old fashioned MS-DOS way with CTextFile::gets() etc?

How to solve procedure entry point not found in dll ?

$
0
0

I have written a c++ cod for windows 7 32 bit machine using visual studio 2015 and build the solution. The exe file executed perfectly in my system, in which code is built but shows missing dll files. I have downloaded dll files but then came new error. "Missing procedure entry point in dll".

How to solve this??

Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>