|
When you created the program, did you select in application wizard, "Use in a shared dll", or "Use in a static library"? Windows shares many .dll files and if you chose a static library, Windows may not be able to access the program you are trying to deploy because the program is telling Windows that it has it's own dll's. Are you trying to deploy to computers with different operating systems, or are they the same? If they are different, you may need to find out what .dll's are needed for the program to work. I know that is not much help, but it's all I can think of.
Richard
|
|
|
|
|
If I chose static linking was Windows supposed to embed the library code I use in my binaries so that I don't need dlls at all? Anyway I'm using shared dll. The operating system in both machines is WinXP SP2.
Any idea what are these manifest files I got produced with each one of my dlls? Do I have to distribute them along with my app?
Themis
|
|
|
|
|
Themis wrote: Any idea what are these manifest files I got produced with each one of my dlls?
Please note: this is a rough explanation, based on my limited understanding.
Manifest files are how applications and their DLL's can specify their dependencies on each other. You probably need to include them in your installation. You can include the manifest in the resources for your DLL/EXE, which then avoids needing to worry about copying the manifest file.
Software Zen: delete this;
|
|
|
|
|
|
I am trying to fully justify text in CRichEditView. (MFC)When I compile and test the program, the text selected seems to default to left justification not full interword. I have RichEdit 4.1 installed, running windows xp pro, with all critical updates installed. If PFA_LEFT, PFA_RIGHT, AND PFA_CENTER work with pf.wAlignment, why won't PFA_FULL_INTERWORD? This is supported in RichEdit 4.1, and even in 3.0, but for some reason when the function is called below, Left justification is the only response. Maybe I shoud contact Microsoft? Any suggestions? Thank you so much if you can help.
GetParaFormatSelection();
PARAFORMAT2 pf;
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_FULL_INTERWORD;
VERIFY(SetParaFormat(pf));
Richard
|
|
|
|
|
Hi,
I'm wondering if I can use the ANSI String Class in normal classes.
I tried yesterday and got an error.
Product.h
#include "string.h"
#include "iostream.h"
using namespace std;
class Product
{
public:
Product(Product&);
Product(string name, int amount , float price);
float GetPrice();
void SetPrice(float price);
void SetAmount(int Amount);
int GetAmount();
void SetName(string name);
string GetName();
Product();
virtual ~Product();
private:
float itsPrice;
int itsAmount;
string itsName;
};
Product.cpp
Product::Product()
{
}
Product::~Product()
{
}
string Product::GetName()
{
return itsName;
}
void Product::SetName(string name)
{
itsName = name;
}
int Product::GetAmount()
{
return itsAmount;
}
void Product::SetAmount(int Amount)
{
itsAmount = Amount;
}
void Product::SetPrice(float price)
{
itsPrice = price;
}
float Product::GetPrice()
{
return itsPrice;
}
Product::Product(string name, int amount, float price)
{
itsName = name;
itsAmount = amount;
itsPrice = price;
}
Product::Product(Product &rhs)
{
itsName = rhs.GetName();
itsPrice = rhs.GetPrice();
itsAmount = rhs.GetAmount();
}
main.cpp
#include "iostream.h"
#include "Product.h"
using namespace std;
int main()
{
Product p1("Apple",0.25,50);
cout << p1.GetName();
int s;
std::cin >> s;
return 0;
}
The error is : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptable conversion)
Please help.
Thanks in advance
Tom
|
|
|
|
|
Instead of
#include "string.h"
#include "iostream.h"
use
#include <string>
#include <iostream>
<hr>
<a href = http://www.codeproject.com/script/profile/whos_who.asp?id=14112#Blog> My programming blahblahblah blog</a>. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I did! I typed in the '"' in the post because it wouldnt show in the preformatted way
Tom
|
|
|
|
|
I mean skip the ".h" part.
#include<string>
NOT
#include<string.h>
|
|
|
|
|
For the last few days I have been trying to find the cause of my stack overflow problem, I have a possible solution, but I'm not sure if I am correct.
within a class, I declare a vector of type <record>, RECORD is quite a large struct
struct _RECORD {
int exam_data;
bool needs_saving;
char *name;
char *english_name;
char *year;
char *room;
char *exam[40];
char *chinese[40];
char *math[40];
char *english[40];
char *physics[40];
char *chemistry[40];
char *politics[40];
char *biology[40];
char *history[40];
char *geography[40];
char *total[40];
char *average[40];
char *class_rank[40];
char *grade_rank[40];
char *class_imp[40];
char *grade_imp[40];
char *comment;
}; I have tried various ways of representing this data, this struct was in my opinion the best choice.
Anyway, I have read that creating very large arrays can eat away at the stack, but I am not sure if that is the case with my vector. I thought vectors were dynamic and adjusted their memory accordingly. Another note, throughout my program I only refrence this vector, ie I pass a pointer to functions.
Could this be the cause of my problems, if so are there any suggestions of how to fix it?
|
|
|
|
|
Why do you need an array of char * ? I think you mean one or the other, and either way, std::string would be more managable.
A stack overflow means generally that a function calls itself until the stack blows. What code is causing it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: A stack overflow means generally that a function calls itself until the stack blows. What code is causing it ?
This is the problem, I can't find. Somewhere the stack is being filled thats pretty much obvious, but I am damned if I can find the cause. There are no functions calling themselves, so the only other possible case I can think of is that I am creating a very large array on the stack and not cleaning it after. But looking through my code, the only large array, which is not within the scope of a function, is this vector. But surely this is created in memory rather than on the stack.
|
|
|
|
|
I was looking in totaly the wrong place. The problem lies within WM_NOTIFY
case WM_NOTIFY:
switch(LOWORD(wParam))
{
case IDC_LIST:
if((((LPNMHDR)lParam)->code == NM_DBLCLK)||
(((LPNMLVKEYDOWN)lParam)->wVKey == VK_SPACE)||
(((LPNMLVKEYDOWN)lParam)->wVKey == VK_RIGHT)) {
data->display_student_record();
}
if(((LPNMLVKEYDOWN)lParam)->wVKey == VK_LEFT) {
data->display_view_options(ID_VIEW_CLASS);
}
if(((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) {
}
break;
}
break;
For some reason the LPNMLVKEYDOWN is being triggered, first when drawing more than 32 items, and when scrolling (while holding the up down keys). I can't understand why this is happening. In the above code I check for specific virtual keys, they are being sent even though they have not been pressed. I have also noticed that it makes no difference by returning true or false. Unless they 'real' key is pressed the app just fills the stack. I wonder if this is a bug in the library?
I have had to comment out those lines, which now leaves my app feeling like a brick boat. I am unable to navigate through the list view using they keys :/
|
|
|
|
|
I hope you find a solution, I just wanted to note that WM_NOTIFY is what is being triggered, LPNMLVKEYDOWN is a pointer to the structure. That code should be layed out as if{} if else {} if else{} , or you will be wasting processing time. I do not know if the code LVN_ITEMCHANGED and VK_LEFT (or VK_RIGHT) can occur at the same time, but if they can you will be calling two methods on the same message.
I would probably insert some trace messages into the code to see what is happening. I have also been known to open a file, append a message to it and close the file, each time something occured, that is if it was crashing the whole system.
INTP
Every thing is relative...
|
|
|
|
|
John R. Shaw wrote: code should be layed out as if{} if else {} if else{}, or you will be wasting processing time.
The origional code was set up like that, but due to these overflow problems I had to comment out certain parts in order to locate the problem.
John R. Shaw wrote: I hope you find a solution
I have indeed. The documentation on MSDN is a little misleading, It states that when a key is pressed a LVN_KEYDOWN notification is sent to the parent window, the lParam of which holds a pointer to a NMLVKEYDOWN structure. However the documentation doesn't state that the user should first check for the LVN_KEYDOWN. This was my mistake, I was directly checking the value of the NMLVKEYDOWN.
My code now looks like this
case WM_NOTIFY:
switch(LOWORD(wParam))
{
case IDC_LIST:
if(((LPNMHDR)lParam)->code == NM_DBLCLK) {
data->display_student_record();
}
else if(((LPNMHDR)lParam)->code == LVN_KEYDOWN) {
if(((LPNMLVKEYDOWN)lParam)->wVKey == VK_LEFT) {
data->display_view_options(ID_VIEW_CLASS);
}
else if ((((LPNMLVKEYDOWN)lParam)->wVKey == VK_SPACE)||
(((LPNMLVKEYDOWN)lParam)->wVKey == VK_RIGHT)) {
data->display_student_record();
}
}
else if(((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) {
data->display_extra_data();
}
break;
}
break;
And it is working perfectly, just wish I hadn't changed so much of my code in order in order to find it
|
|
|
|
|
You sound a bit like me ("my mistake"). Yes it was and No it was not, it should have been in the documentation. Yes because you should have realised it, and No because you should not have needed too (it should have been in the docs). This is a reacuring theme in Microsoft documentation, been there.
Example:
The documentation (since Windows 3.1) has always stated that the text output functions support approximately 8192 characters. Why don't they just tell us that it depends on the width of the characters in pixels? In VC6 the limit was still 32767 pixels (I do not know it that has changed) for the entire string, the number of chacaters is not [really] relivant. Yes in a text based world they are, but they should have state why 8192 was an approximation.
Sorry, I get a little carried away. I wrote an code editor a while back and stange things happen when you exceed the pixel limit (position value wrapping [at maximum font point size]).
waldermort wrote: just wish I hadn't changed so much of my code
I understand, that's why I try to remember to drop a copy of my current code in a seperate directory. Otherwise I am liable to forget why I changed it to begin with (notes, notes, notes, ...).
Whoops!
I did it again (carried away).
John R. Shaw
INTP
Every thing is relative...
|
|
|
|
|
Like memcpy(), is there any method for appending the array i,e memcat()....how could i use it???
|
|
|
|
|
There isn't a memcat() function that corresponds to the strcat() function. If you think about it, a 'memcat ' function doesn't make sense. strcat() does string concatenation. A string is a sequence of bytes, terminated by a zero byte. The mem* functions operate on mem ory, which is a sequence of bytes, but not terminated. Instead, the mem*() functions require that you specify a size for the region of memory you are copying.
Given that explanation, memcpy() will do 'memory concatenation' for you:
memcpy(destination + destination_length,source,source_length);
destination_length += source_length; In this case, you are 'concatenating' a source buffer that is source_length bytes long to the end of a destination buffer that is, prior to the concatenation, destination_length bytes long.
Software Zen: delete this;
|
|
|
|
|
How can i append two different arrays?
|
|
|
|
|
You will need to be more specific. We need to know how the arrays where created to begin with. How about a little code, becuase there is more than one way depending on how your created them.
INTP
Every thing is relative...
|
|
|
|
|
Given different files...the code should count the no of words using threading
Nanjesh b.J.
|
|
|
|
|
|
Given different files...the code should count the no of words using threading
Nanjesh
|
|
|
|
|
I am going to implement Dekker's algorithm to
guarantee mutex exclusion between P1 and P2.The
pseudocode are:
<br />
void p1( )<br />
{<br />
flag = 0;<br />
...<br />
"critical section..."<br />
...<br />
}<br />
<br />
void p2( )<br />
{<br />
flag = 1;<br />
...<br />
"critical section..."<br />
...<br />
} <br />
<br />
<br />
void main()<br />
{<br />
parbegin(p1,p2);<br />
...<br />
}<br />
Do you know how to treat(write) pseudocode "parbegin(p1,p2)". I want to simulate a real race condition, p1 and p2 needs to be concurrent.
Can I just express them as:
void main()
{
p1;
p2;
...
}
|
|
|
|
|
Hi,
I'm wondering if I can use the ANSI String Class in normal classes.
I tried yesterday and got an error.
Product.h
#include
#include
using namespace std;
class Product
{
public:
Product(Product&);
Product(string name, int amount , float price);
float GetPrice();
void SetPrice(float price);
void SetAmount(int Amount);
int GetAmount();
void SetName(string name);
string GetName();
Product();
virtual ~Product();
private:
float itsPrice;
int itsAmount;
string itsName;
};
Product.cpp
Product::Product()
{
}
Product::~Product()
{
}
string Product::GetName()
{
return itsName;
}
void Product::SetName(string name)
{
itsName = name;
}
int Product::GetAmount()
{
return itsAmount;
}
void Product::SetAmount(int Amount)
{
itsAmount = Amount;
}
void Product::SetPrice(float price)
{
itsPrice = price;
}
float Product::GetPrice()
{
return itsPrice;
}
Product::Product(string name, int amount, float price)
{
itsName = name;
itsAmount = amount;
itsPrice = price;
}
Product::Product(Product &rhs)
{
itsName = rhs.GetName();
itsPrice = rhs.GetPrice();
itsAmount = rhs.GetAmount();
}
main.cpp
#include "iostream.h"
#include "Product.h"
using namespace std;
int main()
{
Product p1("Apple",0.25,50);
cout << p1.GetName();
int s;
std::cin >> s;
return 0;
}
The error is : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptable conversion)
Please help.
Thanks in advance
Tom
-- modified at 8:04 Saturday 4th March, 2006
|
|
|
|
|