Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all 3033 articles
Browse latest View live

Passing message using Active Directory

$
0
0
I have a DLL developed using pure VC++ (all unmanaged code that doesn't use .NET framework). This DLL will be deployed in different client PCs within a network and will act like an agent.

Now I have establish a communication between this DLL and a WCF web service, that will be deployed in a server PC. The Service will first get a list of PCs either name or IP Address within a network using LDAP (Active Directory) and once, we get the PCs, I have to establish a communication between the web service and the agents that reside in these client PCs,

How can I accomplish this?

array of numbers sorted in the ascending order

$
0
0
Greetings,

Can anyone help me understand the details of what this function actually do? detailed explanation :)

Name:  Func2.jpg
Views: 77
Size:  26.7 KB
Attached Images
 

How to use TextOut without processing WM_PAINT?

$
0
0
I call TextOut within WM_PAINT and it works. But if I call TextOut within WM_INITDIALOG or WM_SHOWWINDOW, it doesn't work. Here is the code,
Code:

RECT rect;
::GetClientRect(hwnd, &rect);
HDC hdc = ::GetDC(hwnd);
TextOut(hdc, rect.left + 60, rect.top + (rect.bottom - rect.top) / 2.0 + 5, L"test", wcslen(L"test"));

Basically I use the same piece of code above within WM_PAINT or WM_SHOWWINDOW. Is there anything I missed? Thanks.

Hello! I'm new

$
0
0
Hello guys. I registered on this site because i need some code to implement a STATIC linked list! I have an example on my PC but it is totally nosense and it absolutely doesn't work: despite it is a linked list, and not a queue or a stack it still has "Push" and "Pop" functions that doesn't make sense in a linked list, and so many other things. So, please, post me some examples of a list implemented with a static vector. Thanks so much

Emptying CString

$
0
0
I fronted with a weird issue: I have a class, derived from CObject, which has a member variable, CString m_sError (nothing special).

If I used an excel wrapper, I have inside of CMyClass::m_sError the following text:
Code:

Excel.Application.12
Ok, I call
Code:

m_sError.Empty();
but surprise, if I check the string inside of m_sError, I have the same string : Excel.Application.12, but string length is 0 !

Code:

TRACE("%s - %d length\n", m_sError, m_sError.GetLength());
I have:
Code:

Excel.Application.12 - 0 length
Isn't weird ?

What is happened there ? How to surely emptying a CString ?

Need Coder - Simple Program [Paying!!]

$
0
0
I need artifact registrator.

I will need to input there (From,age etc..) and image that i will can resize in program i mean crop image what i want to show on paper. When i click export i will get it into printable file and print it to paper.

Here is image how it needs to be on paper:
http://i.imgur.com/iMhLbBW.png


Resize pic needs to be made like this, let's say i have a really big image 500x500cm and i put it into program , then i need to crop image and only ring on that needs to be shown means i will pick what part of image will be on the paper. Images needs to be all same dimensions on printable document.


I don't see what other details i need to say? just make program where i will put right side of text from file and left side needs to be same like on paper,but that is easy editable if you make mistake on program..

It needs to be program for Microsoft Windows XP , that means you need to use framework 4.0 not higher.

Long Time Button Pressed Event - MFC

$
0
0
Hi,

I Like to Open a Dialog When the Button Was Pressed for 5 seconds Continuously.

I'm using Windows 8 HP Tablet, Is MouseUp & MouseDown events suitable for this requirement.

Decoding RFID data hexadecimal math issue C++

$
0
0
I currently am stuck at getting the needed outcome data from my RFID card. I got it decoded but now I need to do a few more things in order to get the final card number off the back of the card.

The cryptic value was E********B**0**E** (covered to protect card)
Decrypting it turned into 0000003048D1263B

Now I have 3 more steps to take in order to get to my wanted card number.

Quote:

Step 1) Mask off the lower 20-bits (which should give me 0x1263B) I am unsure of how to go about doing that using C++.
Quote:

Step 2) Divide by 2 to strip off the lower parity bit (which should be 0x931d). And again, I'm unsure of how to go about doing this in C++.
Quote:

Step 3) Convert hexadecimal value to decimal value (which would equal my wanted card number). This should be easily done using C++ at this point - though hard to confirm that since I am on step 1).
Code:

    const char* original = "0x931d";
        unsigned long n = std::strtoul(original, nullptr, 16);

All of this looks to me like RegEX does to most people - complicated and not understanding why it does what it does but gives the correct output.

All help would be appreciated!

MFC List Control Position

$
0
0
Hi,
I have a mfc project with a List Control (Report View).
When I run the project, the list control appears in the middle of the window instead of appearing where I placed it.
Is there a qay to make it stay where I need it?
THANK YOU!

Range and incrementation issue

$
0
0
so there is suppose to be a constant that shows the total number of values to be shown in this range. The user enters two values, lets say userMin is -2 and userMax is 2, it's suppose to add 0.2 to -2 and so on until it reaches 2. It starts doing that up until it reaches -1.0, then it goes to -0.9, -0.7.... etc, It also goes beyond 2. Any ideas?


Code:

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{

  cout << fixed << setprecision(1);
  float userMin;
  float userMax;
 
  const int SIZE = 21;
  float arr[SIZE];
  const int SIZE2 = 21;
  float arr2[SIZE2];
  int count = 0;
  cout << "enter min ";
  cin >> userMin;
  cout << "enter max ";
  cin >> userMax;
  float inc = (userMax-userMin)/SIZE;
  float x = inc*count + userMin;



  while (x <= userMax)
  {
      for (int e = 0; e < SIZE; e++)
      {
        arr[e] = x;
        arr2[e] = 2 * x*x*x + 4 * x + 5;
        cout << setw(15) << arr[e]
            << setw(15) << arr2[e]
            << endl;

        count++;
        x = userMin + inc*count;
      }
  }

  return 0;
}

recursive crashes + debug problem

$
0
0
I got two issues:
one is that Using VS2012, the recursive code in below crashes in case of passing large numbers in debug mode. With small numbers seems to work. Also, in release mode seems to work. It might stack overflow issue.?? How to increase stack in visual studio 2012?.
Code:

#include <iostream>

struct mystrut
{
        int a;
}mys;

mystrut decr ( int s )
{
        std::cout << s << std::endl;
        mystrut f;
        f.a= 0;
  int i = 0;
  if ( s == 0 ) 
    return f;               
  f = decr ( s - 1 );
  return f;
}
int main()
{
  mystrut f = decr ( 10000);
  std::cout << f.a << std::endl;
}

secondly:
Code:

double myrndn =  myround(1.799999);
When I look at the myrndn in debug mode,moving the cursor over it, the return,myrndn, is the same,1.799999.
Why isn't it updating?.
However, std::cout shows 1.8.

Need smart card programmers advices

$
0
0
Smart card programming is a new concept to me and i have a project as intern in telecom company to build an application for smart card. i would like to do it in VC++ environment but i do not know how i could start coding. i have the manual of the SDK even the sample code but i don't understand much. so i am calling out to smart card programmers or anyone in this field to give me a hand and Help me out to start my project so that i could submit my project on time.
Thank you in advance for your help.

Program shoudn't count comments and blank lines

$
0
0
OK, I'm making some progress. My program does compile and output the number of line per code, but it shouldn't count comments and blank lines. I tried using (s.substr(0,2) == "//") as suggested but it didn't work. I definitely appreciate any recommendations and suggestions. Thanks guys.
This is my improved code:
Code:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

const int A = 3;

int main()
{
string s;
ifstream myfile ("example.cpp");
int count = 0;
//int A = 3;
getline(myfile, s);

if (myfile.is_open())
{
while ( getline (myfile, s) ){
count++;
if (s[0] == '/' || s[0] == ' ' || s[0] == '#'){
count--;
}

}

}
cout << "This is your LOC: " << count << endl;
return 0;
}

Automatic Login & Password into web page using Details_Fully Automated

$
0
0
I Want to login this webpage automatically using vbs or any other javascript

I want to login into this https://www.ttdsevaonline.com/ web page and book the tickets for me by automatically.

Requirements into the site as given below as mentioned in order

Login with Login Details

Captcha Will be there, for that assume manually entered.

then select particular event, pick the date and again check the event, select the number of persons, click on submit button.
Fill the Persons details and photo.
Check the button of I read the terms and conditions.
Click on the submit button
All these should be done within the small time.
Dont tell me how to do it, actually I dont have Knowledge about coding, if anyone help on this fully.Help on this if you are interested and tell me how much will you charge . Site is :https://www.ttdsevaonline.com/

If you dont understand my question, I will explain. tell me where you dont understand.

Exit codes availables

$
0
0
Hi,
I want to define a range of exit codes in my application. These codes will be used as a return value of ExitInstance function. I want to know the exit codes availables (values not used for example by windows to inform about an other error). When I force to crash my application, I get some different error codes: 8148, 10176.

What is the no available range exit codes?

Is this the ranges code unavailable?

https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

Thank you very much.
Regards.

Bubblesort and Llinkedlist

$
0
0
Hello , im new at this bubblesort stuff and linkedlist and need a little help with my loop.

struct node
{

int data;
node* next;


};

void PushFront(node*& head, int newData);
void printlist(node* head);
void BubbleSort(node*& head);

int main()
{
node* head = nullptr;





PushFront(head, 60);
PushFront(head, 70);
PushFront(head, 40);
PushFront(head, 16);
PushFront(head, 29);
PushFront(head, 32);

printlist(head);

BubbleSort(head);

printlist(head);


system("pause");
}




void printlist(node* head)
{
for (node* temp = head; temp != nullptr; temp = temp->next)
{
cout << temp->data << " -> ";
}

cout << "NULL\n\n";
}


void PushFront(node*& head, int newData)
{
node* newNode = new node;

newNode->data = newData;

newNode->next = nullptr;

if (head != nullptr)

{
newNode->next = head;

}
head = newNode;
}
void BubbleSort(node*& head)
{
node* ptr1 = head;

if (ptr1 == nullptr)
return;

if (ptr1 != nullptr)
{
while (ptr1->data > ptr1->next->data)
{
swap(ptr1, ptr1->next);
}
ptr1->next = head;
}
ptr1 = nullptr;
}



Here the "ptr1" gets all the "head" numbers
Name:  1.jpg
Views: 22
Size:  53.5 KB

But after the function ends it returns a inf loop for 32
Name:  2.jpg
Views: 16
Size:  60.1 KB
Attached Images
  

Tool for automation

$
0
0
Hello all,

I need a little help: I want to create an application that automatize different applications in the sense that my application will be able to press automatically different buttons on another application.

For example: my application will start, let's say, Microsoft Office, will press some buttons in MSOffice, and will close MSOffice.

Could you give me an idea how to do that ? I have no clue... some code in C/C++ would be perfect.


Thank you in advance.

what programming language should I learn?

$
0
0
I have some C++ experience in highschool and a comptia cert, but very little experience otherwise. What language should I dive into in order to create games on an average computer with windows vista? Specifically, I want to be to create a 3D space strategy.

VC++ 6.0 & Localizatioin. What do I gain with Unicode?

$
0
0
I'm thinking abour updating my VC++ 6.0 project to support localization. Right now it is an ANSI project (MBCS and UNICODE are not defined). If I do nothing else, what do I gain by moving to Unicode?

[Help] If & Else if & else

$
0
0
Hello guys im very new to c++ and i need help with this code if anyone can help i'd appreciate it. How would i do multiple if and else as with this code below i get an error.

Code:

void Display::setWeapDetails(int ammo, int clips, int mode, int weapon)
{
        if(!Inited) return;
        Scaleform::GFx::Value var[4];
        var[0].SetInt(ammo);
        var[1].SetInt(clips);
        if(mode==1)
                var[2].SetString("one");
        else if(mode ==2)
                var[2].SetString("three");
        else
                var[2].SetString("auto");
        if(weapon ==1)
                var[4].SetString("honey");
        else if(weapon ==2)
                var[4].SetString("m16");
        else
                var[4].SetString("honey");

        gfxWPHUD.Invoke("_root.api.setWeapDetails", var, 4);
}

Viewing all 3033 articles
Browse latest View live