|
Thanks Rob. Yes your additional information changes the scenario greatly.
Rob Bryce wrote: as a motivation to make it easier to deal with object interfaces intended for re-use outside this project.
I agree that COM is inherently difficult. ATL does improve working with COM greatly but can only go so far. However COM is only necessary to support use of components developed in a different language. This is a heavy restriction and not a requirement for every project. Conversely we can choose the opposite restriction, that being, supporting native C++ components only.
led mike
|
|
|
|
|
led mike wrote: However COM is only necessary to support use of components developed in a different language. This is a heavy restriction and not a requirement for every project.
Yeah, unfortunately, defining the language of choice for projects outside my control, but using the object interfaces that I define, isn't an option - which mean COM or now .Net.
Thanks,
--Rob
|
|
|
|
|
Hi,
Iam using a c++ dll in my .net application.It is running fine on the system where visual studio 2005 is installled.
In the deployment environment we have only framework2.0 installed on the machine.Then Iam getting a pop-up error as
<big><b>"Microsoft visual c++ runtime library
Runtime error
c:\testapp\bin\debug\test.exe
The application has requested the application to terminate in the unusual way
Please contact the application's support team for more information"</b></big>
Please kindly help ASAP
|
|
|
|
|
You are responsible for deploying everything your app needs
to run on a given machine.
Deployment (C++)[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I tried the following as suggested by you:
1. I have installled the redistributable package suggested by you.
after installing i restarted the PC even now also I got the same runtime pop-up error.
2. Then I checked even with the dependency walker for the dll.
I found that there is no miising dll.
3. Then I tried by installing Visual C++ express edition..even then also i got the same pop-up error.
Kindly guide me because Iam new to these concepts...
Kindly help me.....
|
|
|
|
|
There's only a few things I can think of off hand...
Your app needs a .NET runtime that's not installed - maybe at least 2.0 SP1?
You've deployed a debug build of your app or the DLL
Bug in your code or the DLL
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It's not plugged in.
led mike
|
|
|
|
|
That's ok...it will all get cleared up at the new post here[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i have trouble sorting the name in alphabetical order that i have created.
i've tried the sort function but it does not seem to work.
below are my code:
#include<iostream>
#include<string>
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;
class Person
{
private :
char *personName;
long personphonenumber;
public:
Person(char *name, long phoneNumber);
~Person(); void PrintPerson(); void PrintFile();
friend bool operator<(const Person& left, const Person& right);
};
bool operator<(const Person& left, const Person& right)
{
return left.personName < right.personName;
}
Person::Person(char *name, long phoneNumber){
personName = new char[sizeof(name) + 1];
for(int ii = 0; ii <= (sizeof(name) + 1); ii++){
personName[ii] = name[ii]; personphonenumber = phoneNumber; }
cout << "Creating Employee: " << personName << "\t" << "Phone Number: " << personphonenumber << endl;
}
Person::~Person(){
}
void Person::PrintPerson(){ cout << "----" << endl;
cout << "Name: " << personName << endl;
cout << "Phone Number: " << personphonenumber << endl;
cout << "----" << endl;}void Person::PrintFile(){ fstream oWrite;
oWrite.open("Data.txt", ios::out | ios::app);
oWrite << "Name: " << personName << "\t" << endl;
oWrite << "Phone Number: " << personphonenumber << "\t" << endl;
oWrite << "\n\n"; oWrite.close();}
int main(int argc, char *argv[])
{
char *personName;
char name;
personName = new char[sizeof(name) + 1];
long personphonenumber;
int nInput;
int nNum;
bool cont = true;
Person *personArray; vector<Person> details;
vector<Person>::iterator lpi;
while(cont){
do{
if(cin.fail()){
cin.clear();
while(cin.get() != '\n');
}
cout << "\nPlease select: \nTo create a new data enter '1' \nTo print the data enter '2' \nTo sort the name in alphabetical order enter '3' \nTo quit enter '4'" << endl;
cin >> nInput; }
while(cin.fail() && cout << "\nPlease enter your selection again.. " << endl);
switch(nInput){
case 1:
cout << "Please enter the name: ";
cin >> personName;
cout << endl;
do{
if(cin.fail()){
cin.clear();
while(cin.get() != '\n');
}
cout << "Please enter the phone number: ";
cin >> personphonenumber; cout << endl;
}while(cin.fail() && cout << "\nPlease enter again..");
personArray = new Person(personName, personphonenumber);
details.push_back(*personArray);
break;
case 2:
for(lpi = details.begin(); lpi != details.end(); ++lpi){
lpi -> PrintPerson();
lpi -> PrintFile();
}
break;
case 3:
sort(details.begin(), details.end());
for(lpi = details.begin(); lpi != details.end(); lpi++){
lpi -> PrintPerson();
lpi -> PrintFile();
}
break;
case 4:
cont = false;
break;
default:
cout << "Invalid input try again" << endl;
break;
}
}
return EXIT_SUCCESS;
}
|
|
|
|
|
You posted your question in the wrong forum. The "ATL/WTL/STL" or "Visual C++/MFC" forums are more appropiate.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I do no if there is a limit of number on a form,
I have one form with many controls, When I need to add others, the system create duplicate control on the code and I have many duplicate errors.
That why I need to know if there is a limit.
|
|
|
|
|
There is no actual limit unless you run out of memory. But if you have to operate on a lot controls in a form, I suggest you to:
1) give up a designer and switch to manual coding.
-OR/AND-
2) merge chosen groups of controls to user controls which wouldn't paint themself in design time to avoid flickering and other artifacts while in design mode.
-OR/AND-
3) split a form onto stand-alone functional forms (depends on a kind of a project, not necessarily applicable).
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Hi;),
i have a Sdi with a splitter (4 rows).
When i click on the maximize button the window is maximized and the 1. splitter row changes its height proportionally , but when i try to restore, nothing happens with the Splitter ;(.
Please help me !
Here is my code:
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
int iCurRow_cy = 0, iMin_cy = 0;
static int iOldWnd_cy = 0, iOldWnd_cx = 0;
int iNewCurRow_cy = 0;
static int iZaehler = 0;
static CString a, b, c, d;
iZaehler++;
if (iZaehler == 1)
{
iOldWnd_cy = cy;
a.Format("%02d",iOldWnd_cy);
b.Format("%02d",cy);
c.Format("%02d",iCurRow_cy);
d.Format("%02d",iNewCurRow_cy);
MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: iZaehler == 1 " ,MB_OK);
}
if ((nType == SIZE_MAXIMIZED))
{
m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy);
iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, 1);
a.Format("%02d",iOldWnd_cy);
b.Format("%02d",cy);
c.Format("%02d",iCurRow_cy);
d.Format("%02d",iNewCurRow_cy);
MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_MAXIMIZED " ,MB_OK);
m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0);
m_Splitter_Main.RecalcLayout();
}
else if((!m_Splitter_Main.m_hWnd && nType == SIZE_RESTORED))
{
m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy);
iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, (1));
a.Format("%02d",iOldWnd_cy);
b.Format("%02d",cy);
c.Format("%02d",iCurRow_cy);
d.Format("%02d",iNewCurRow_cy);
MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_RESTORED " ,MB_OK);
m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0);
m_Splitter_Main.RecalcLayout();
}
CFrameWnd::OnSize(nType, cx, cy);
}
double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int iZahl)
{
double iNewCurRow_cy;
double iDiff;
double iFaktor;
CString ccc;
CString ddd;
CString aaa;
CString bbb;
iDiff = cy - iOldWnd_cy;
iFaktor = iDiff / cy;
iNewCurRow_cy = (iCurRow_cy * ((iFaktor)+(iZahl)));
return iNewCurRow_cy;
Many, many thanks !
Best regards !
Croc
|
|
|
|
|
Wrong board Croc!
Visual C++/MFC[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh sorry
Croc
|
|
|
|
|
7. Given the class definition
class A
{
public:
//constructors
// other members
private:
int x;
int y;
};
Give declarations of operator functions for each of the following ways to overload operator+ you must state where the declaration goes, whether within the class in the public or private section or outside the class. The operator + may be overloaded
a. as friend function
b. as member function
c. as non-friend, non-member function
I have exam from next week and this one of the ques in sample paper .please help me to solve it.
|
|
|
|
|
If it's really urgent, please post it on the correct board[^].
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
charusood wrote: please help me to solve it
No. You should have been paying attention in class.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hello again!
I got an "undefined reference" again, but I don´t know why!
Maybe someone could help me!
The compile-command is:
g++ -o headerblub.exe main.cpp header.cpp blub.cpp
Here´s the code:
main.cpp:
#include "header.h"
int main(int argc, char **argv)
{
HeaderTest h;
h.headerH();
return 0;
}
header.h:
#ifndef HEADER_H
#define HEADER_H
namespace Headerns
{
#include "blub.h"
}
class HeaderTest
{
public:
void headerH();
};
#endif
header.cpp:
#include "header.h"
void HeaderTest::headerH()
{
Headerns::blub();
}
blub.h:
#ifndef BLUB_H
#define BLUB_H
void blub();
#endif
blub.cpp:
#include "blub.h"
#include <iostream>
using namespace std;
void blub()
{
cout << "Hurra" << endl;
}
</iostream>
Thanks a lot!
Stefan
|
|
|
|
|
First, you're on the wrong board.
Visual C++/MFC[^] is for non-managed C++ questions.
Second, why would you #include a file within a different namespace?
I don't have g++ so I can't try your code.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
oh, I´m sorry. I´m new here and I don´t have an overview about the board yet.
I have to include the file in a namespace for a project I´m working on. But I found out the sollution by changing the blub.cpp into:
#include "header.h"
#include <iostream>
void Headerns::blub()
{
std::cout << "Hurra" << std::endl;
}</iostream>
|
|
|
|
|
Here's what I'm talking about...
This makes usage difficult and error prone:
namespace Headerns
{
#include "blub.h"
}
Why should you have to always remember to wrap the #include in
a namespace?
Why not do this instead:
#ifndef BLUB_H
#define BLUB_H
namespace Headerns
{
void blub();
}
#endif
#include "blub.h"
#include
using namespace std;
void blub()
{
cout << "Hurra" << endl;
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am using Visual C++ NET 2005,
I have create one form called "User".
After some handling, in my Solution Explorer, I don't see again my Designer interface (User.h[design]).
But User.h and User.cpp files exist.
How can I view again My design Interface ?
I don't Understand This problem
modified on Wednesday, October 8, 2008 1:38 AM
|
|
|
|
|
Have you tried closing the designer, recompiling your code, and then re-opening the designer? If this doesn't work, could you provide some more details? When you try to view the designer, do you get any particular error messages?
|
|
|
|
|
I have do it: to close the program ad to open again, when I click on design interface I have I red cross with this message(it is not exactly the same words but the same idea ):
Your design interface can not be open due to error. To fix it your rebuild the project or correct codes.
Why in this version, we have this kind of problem ?
|
|
|
|
|