|
Hi!
I need some help with one of my programs. It won't start unless Visual C++ is installed on the computer. If Visual C++ isn't installed then nothing happens when I try to start the program. Does anybody know what might cause this? I've used the dependency checker in Visual C++ to see if there are any DLLs missing but the program doesn't find anything wrong...
|
|
|
|
|
Which version of the VC++ are you using (standard, professional)?
Are you using some ActiveX controls in your applications?
What type of application it is, MFC, ATL etc?
Please try to use the Dependency Walker (or Depends) utility to find out which components your application depends on.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Hello C++_Beginner,
1. It sounds like the reason for the failure to launch is due to one or more DLLs missing.
There is a very good tool at the SysInternals web site called "FileMon". The following is the link to it :
http://www.sysinternals.com/ntw2k/source/filemon.shtml
This program is available in Win9x, WinNT, Win2K and XP versions. It basically monitors all file activities including file openning and closing.
If there are any missing files (including DLLs) while your app is launching, this program will report it.
2. The other possible reason for failure is missing registry entries. Another tool at SysInternals called "RegMon" which monitors registry activities.
The following is the web address :
http://www.sysinternals.com/ntw2k/source/regmon.shtml
This may help you to identify missing registry entries that are required by the system to identify further DLLs (e.g. COM servers).
Try out these two utilities and I'm very sure they will be of great help to you.
Best of luck.
Regards,
Bio.
|
|
|
|
|
Did you compile in Release mode? if not, your program is linked against debug libraries, and will never work without VC.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Why it wont start unless VC++ is installed is because you have probably have checked the "As shared DLL" alternative in AppWizard. Then you'll need those files in the same dir as the exe to run a MFC app on another computer:
MFC42D.DLL
MFCO42D.DLL
MSVCRTD.DLL
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Make sure that if you are using shared DLL that you link to the Release versions of the DLL's.
Redistributing the debug dll's is a bad idea and may also be a violation of Microsoft's licence agreement.
Michael
|
|
|
|
|
Thanks for all the answers!
It is an MFC app and I'm using the release build so the program doesn't use any of the development dlls. I'm using two ActiveX controls, mediaplayer2 and MS Image Forms 2.0. My devenviroment is VC++ Pro.
Using the filemonitor program I can see that my program depends on MFC42.dll, MFC42LOC.dll, MSVCIRT.dll, OLE32.dll, OLEAUT32.dll, CLBCATQ.dll and MSVCRT.dll. Everything is successful when I load my program. I can't see anything wrong when I run the Regmonitor, the dependency walker v2.1 can't find anything wrong either.
The program just shuts down after having something to do with ~CLBCATQ.dll. I'm trying to run my program in W2k without VC++ installed. I know it works with VC++ installed.
I can't understand anything...? Any suggestions are welcome!
|
|
|
|
|
According to MSDN, having the ~CLBCATQ.dll present means that COM+ hasn't been installed correctly on your machine.
Are you using COM + services?
Michael
|
|
|
|
|
That's strange... No, I'm not using any COM+ services.
- Tobias
|
|
|
|
|
Please help! I am trying to make a CList of CUIntArray. Add a CUIntArray to the list, read the CUIntArray from the list and TRACE it to the debug window! Here is the code however when I try to compile i get the error...
'CUIntArray' : 'operator =' function is unavailable.... Please Help!
CString debug;
CUIntArray array;
CList <cuintarray,cuintarray&> list; // create the list
array.SetSize(3);
for (int x=0;x<3;x++)
{
array[x]=0;
}
list.AddTail(array); //create array and add to the list
POSITION pos=list.GetHeadPosition(); // get start position of list
int arraylength;
while (pos!=NULL)
{
list.GetNext (pos);
arraylength=(list.GetAt(pos)).GetSize();
for (int x=0;x
|
|
|
|
|
Which use of = ? Which line is the error occuring on?
--Mike--
My really out-of-date homepage
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I think it has something to do with
CUIntArray=CUIntArray causing a problem
the only way i can think to remedy this is to use a CStringList, and convert between characters and integers
template<class type,="" class="" arg_type="">
POSITION CList<type, arg_type="">::AddTail(ARG_TYPE newElement)
{
ASSERT_VALID(this);
CNode* pNewNode = NewNode(m_pNodeTail, NULL);
pNewNode->data = newElement; ////// this is where the error is!
if (m_pNodeTail != NULL)
m_pNodeTail->pNext = pNewNode;
else
m_pNodeHead = pNewNode;
m_pNodeTail = pNewNode;
return (POSITION) pNewNode;
}
|
|
|
|
|
i've found that this code can be used which when implemented is identical to the CList of CUIntArray.....
CString debug,str;
CStringList list;
for (int x=0;x<3;x++)
for (x=0;x<3;x++)
str.Insert(x,static_cast <char>(0)); // create string containing integer after convertion to character
AfxMessageBox(str);
list.AddTail(str); // add string to CStringList
POSITION pos=list.GetHeadPosition(); // get start position of list
for (x=0;x<list.getat(pos).getlength();x++)
{
=""
="" debug.format(="" "%d="" ",static_cast="" <int="">(list.GetAt(pos).GetAt(x)) ); // Get character from list convert to integer
TRACE (debug); //// display on Debug window with trace
}
|
|
|
|
|
I am trying to set the background color of a mini server to that of the container. Can I access the container's ambient properties from MFC's COleServerItem class? How is this typically done?
Thanks
~ Paul ~
|
|
|
|
|
Hi,
I find there is a slight inconvenience with the std::getline function in C++. Here is an example:
-----------------------------------------------------------
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::getline;
#include <string>
using std::string;
int main()
{
string strTemp;
cout << "Enter a sentence: ";
getline(cin, strTemp);
cout << "\nYou entered: "
<< strTemp << endl;
return 0;
}
-----------------------------------------------------
If you run the code above, and hopefully I did not leave anything out, out will find that after you entered a sentence and press Enter, the "cursor" will go to the next line, but the program does not move onto "You have entered: " until you press Enter the second time. In other words, I have had problems with the getline function in term of having to press Enter twice to get it to move onto the next algorithm.
I have tried for example:
getline(cin, strTemp, '\n');
It has the same effect.
Is there a way to get around having to press Enter twice?
Thanks,
Kuphryn
|
|
|
|
|
Probably, you're running into a known bug in Dinkumware's implementation of the C++ standard library. This article addresses the problem (look for the "Fix to <istream> " section) and proposes a fix.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
zen from cprogramming.com posted something about a bug in VC++:
http://www.cprogramming.com/cboard/showthread.php?s=a4253030337e8f0dc4d9e68fb761087c&postid=48172#post48172
That fixed the problem.
Kuphryn
|
|
|
|
|
Hi.
I am working on a simple program that reads data into memory in binary. It then write the data from memory to a second file in memory.
Is it possible to read from ifstream straight to an STL container instead of having to go through dynamic memory allocation?
Thanks,
Kuphryn
|
|
|
|
|
Yes.
You can read a file into a
<br />
vector<char> data;<br />
<br />
or<br />
<br />
string data;<br />
can use istreambuf_iterator to load the file
<br />
ifstream file("c:\\somefile");<br />
vector<char> data((istreambuf_iterator<char>(file)), istreambuf_iterator<char>());<br />
you can make it faster by getting the file size and using dat.reserve() to pre-allocate the required memory.
Todd Smith
|
|
|
|
|
Thanks.
Okay, this is more advanced STL than I am used to. I have no prior knowledge of istreambuf_iterator or ostreambuf_iterator.
First will:
vector data((istreambuf_iterator(file)), istreambuf_iterator());
read data from a file into vector data in *binary* mode?
I am used to something like:
--------------------
char x[5];
istream data;
data.open(x, ios::in | ios::binary);
data.read(reinterpret_cast<char *="">(x), 5);
--------------------
The same goes for data.reserve("size???").
Kuphryn
|
|
|
|
|
Can anyone help with a nice algorithm to create a gradient style color ramp?
What I need is to specific the first and last colors and generate a specified number of colors between them.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
This is what I use :
COLORREF *Gradient(COLORREF start, COLORREF end, int steps)
{
if (steps < 2)
return NULL;
COLORREF *output = new COLORREF[steps];
output[0] = start;
output[steps - 1] = end;
double sR = (double)GetRValue(start);
double sB = (double)GetBValue(start);
double sG = (double)GetGValue(start);
double eR = (double)GetRValue(end);
double eB = (double)GetBValue(end);
double eG = (double)GetGValue(end);
double RedStep = (eR - sR) / (double)steps;
double BlueStep = (eB - sB) / (double)steps;
double GreenStep = (eG - sG) / (double)steps;
for (int x = 1; x < steps - 1; x++)
{
sR += RedStep;
sB += BlueStep;
sG += GreenStep;
output[x] = RGB((BYTE)sR, (BYTE)sB, (BYTE)sG);
}
return output;
}
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
(I previewed this before posting it, but I don't know why the blank lines are missing from the pre section.)
void RampColours(int nColourCount, COLORREF crLowColour, COLORREF crHighColour, COLORREF* pColourTable)
{
double red_step, green_step, blue_step;
int red_low, green_low, blue_low;
red_low = GetRValue(crLowColour);
green_low = GetGValue(crLowColour);
blue_low = GetBValue(crLowColour);
red_step = (double)(GetRValue(crHighColour) - red_low) / (double)nColourCount;
green_step = (double)(GetGValue(crHighColour) - green_low) / (double)nColourCount;
blue_step = (double)(GetBValue(crHighColour) - blue_low) / (double)nColourCount;
pColourTable[0] = crLowColour;
pColourTable[nColourCount] = crHighColour;
for (int i = 0; i <= nColourCount; i++) {
pColourTable[i] = RGB( red_low + (red_step * (double)i), green_low + (green_step * (double)i), blue_low + (blue_step * (double)i) );
}
}
"Am I talking too fast, or are you just playing dumb? If you want I can write it down." -Jarvis Cocker/Pulp
|
|
|
|
|
Here is another one. This is from a little app I hope to be posting here soon :
<br />
BYTE InterpColor( BYTE top, BYTE bottom, int linendx, int maxlines )<br />
{<br />
if( top == bottom )<br />
return top;<br />
<br />
double cval = (double)linendx * (double)( bottom - top ) / (double)maxlines;<br />
cval += (double)top;<br />
return (BYTE)cval;<br />
}<br />
<br />
<br />
void GetGradientColor( int count, int index, COLORREF top, COLORREF bottom )<br />
{<br />
BYTE r = InterpColor( GetRValue( top ), GetRValue( bottom ), index, count );<br />
BYTE g = InterpColor( GetGValue( top ), GetGValue( bottom ), index, count );<br />
BYTE b = InterpColor( GetBValue( top ), GetBValue( bottom ), index, count );<br />
COLORREF color = RGB( r, g, b );<br />
return color;<br />
}<br />
<br />
This is not the absolutely most efficient algorithm but it works well for me. There are some easy optimizations that could be made but I have never seen the speed of this to be a problem.
|
|
|
|
|
Rick York wrote:
void GetGradientColor( int count, int index, COLORREF top, COLORREF bottom )
That's nice, but what about some dithering? Does anyone know how to implement one (at least of 'ordered' style)?
* Origin: Silence Must Be Heard (2:5030/844.235)
|
|
|
|