|
Windows documentation CLAIMS that the folder from which the parent process was loaded will also be searched. With the DLL in the same folder as the EXE it should have worked. What is more likely is that some OTHER DLL that MyDLL depends upon is missing.
|
|
|
|
|
hi,
i am working in win32 application using MFC.
actually i have to draw moving concentric circles i.e dynamically 10 circles , one above another should open like a flower and close it, and this should continue until i stop it. whichever position i stop it , in that stage it should show.
e.g,
when i click my mouse on client area of window. concentric circles should be generated in a moving fashion , not at the same time all circles should be displayed. up on reaching 10th circle automatically it should decrease in the same moving fashion. this process should be continued until i reclick my mouse on the client area.
thanku for ur patience in reading,
could u provide me any suggestions
thanks
|
|
|
|
|
You can use CDC::Ellipse[^] to draw circles.
As for drawing concentric circles, you need to use a timer[^] to progressively draw smaller/larger circles. On each tick of the timer, check if you are expanding or collapsing, then use the appropriate radius for the circle and draw it.
You also need to check if the mouse has been clicked between two ticks of the timer and if so, prevent further drawing.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I've tried looking up this error elsewhere with no luck. Here is what im doing to cause the error. First creating a pointer to a byte(or char, whatever) of data:
char* data = (char*)malloc(sizeof(char));
memset( data, 0, sizeof(char) );
Then read in a char from a open file:
file.Read( data, sizeof(char) );
Then check for either '\t' or '\n'... All variables have been declared as follows
bool out;
CString str;
CFile file; // this has been opened properly, and ready for reading.
UINT32 tmp;
byteSwap bs; // All this does is change a UINT32 to a float, and vice versa.
do
{
out = false;
str.Empty();
do
{
file.Read( data, sizeof(char) );
if( *data == '\t' )
{
tmp = (UINT32)atoi( str.GetBuffer() );
bs.i = tmp;
msg.icd.gimary.points[i][0] = bs.f;
str.Empty();
} else if ( *data == '\n' ){
tmp = (UINT32)atoi( str.GetBuffer() );
bs.i = tmp;
msg.icd.gimary.points[i][1] = bs.f;
out = true;
} else {
char ch = data[0];
str.AppendChar(ch); // Error here
}
}
while( !out );
i++;
}
while( i < msg.icd.gimary.numPoints );
After a large portion of the file has been read, i get an error in dbgheap.c @ line:612, which is a _CrtCheckMemory() failure... Any ideas on how this is caused? If you need more info, just post. I'll reply within 5 mins or so. Thanks in advance!
|
|
|
|
|
Jader89 wrote: char* data = (char*)malloc(sizeof(char));
memset( data, 0, sizeof(char) );
Then read in a char from a open file:
file.Read( data, sizeof(char) );
This is pointless. Why are you bothering the memory manager for something so trivial?
char data;
file.Read(&data, sizeof(char));
Jader89 wrote: tmp = (UINT32)atoi( str.GetBuffer() );
Unless you have plans on modifying str , the call to GetBuffer() is not necessary.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
yes your right, ive been changing it around alot trying to solve this error, and wasnt paying attention to that aspect. Its changed now, but this doesnt help the fact that this error is caused by the AppendChar() which calls a ReAllocate method, and after the 1024, (default) time through, it calls the _crtCheckMemory() and fails, I've even tried doing it after 16 times through by changing a crt flag, still fails... My problem is that i dont see why this check is failure, and why my heap is losing integrety.
|
|
|
|
|
Jader89 wrote: ...this error is caused by the AppendChar()...
What class is this a method of? Are you using VC++ v6 or .Net?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Its a method of CString, and im using .NET ... Sorry for the late response.
|
|
|
|
|
I have been working on this all night and into the day. Can someone please help me with the mistakes that I have made. Please help.
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <math.h>
//#using <mscorlib.dll>
//using namespace System;
void display_statement (double, double, double, double, int, double);
double Tinterest_paid(double, int);
double payment_amount (double, double, int);
int main(void)
{
double a=1;
double b=1;
double c=1;
double d=1;
double e=1;
double x=1;
double i; // Interest_Rate Monthly
double p; // Principal
int n ; // Number Payments display_statement
double Payment_Amount;
double payment;
double Total_Amount;
double total_amount;
double Tamount_paid;
double total_interest;
double Tinterest_paid(double, int);
double payment_amount (double, double, int);
printf("Please Enter Interest Rate "); // Key As n.n
scanf("%lf",&i);
printf("Please Enter Loan Amount "); // Amount of Loan
scanf("%lf",&p);
printf("Please Number Of Monthly payments "); // Number Of Monthly
scanf("%d",&n);
payment = Payment_Amount (i,p,n);
Total_Amount = Tamount_paid(payment,n);
total_interest=Tinterest_paid(total_amount,p);
void display_statement (double, double, double, double, int, double);
}
{
double x;
x = Tinterest_paid(200000, 150000);
printf("The result is\n\n %f', X);
return 0;
}
double Tinterest_paid (double amount_paid, double Principal)
{
double int_paid;
int_paid = amount_paid - Principal;
return (int_paid);
{
double x;
x = Payment_Amount(5.5, 100000, 60);
}
double Payment_Amount (double Interest_Rate, double Principle, int Number_Payments)
{
double a, payment;
a = Interest_Rate/100;
a= a/12;
payment = (a* Principle)/ (1 - pow((1+a), -Number_Payments));
return(payment);
}
{
display_statement (a, b, c, d, x, e);
return 0;
void display_statement (double payment, double loan_payment, double Tinterest, double Principal, int Number_Payments, double interestrate)
{
printf("Monthy Payment: $%.2f\n\n", payment);
printf("Total Loan Amount; $%.2f\n\n", loan_Amount);
printf("Total Interest Payment: $%.2f\n\n", Tinterest);
printf("Principal: $%.2f\n\n", Principal);
printf("Number Of Payments: %d\n\n", Number_Payments);
printf("Interest Rate %.3f percent\n\n", interestrate);
}
Joseph L. Gelsomino
|
|
|
|
|
can you help us a bit here ?
what is not working ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
none of it, I can't seem to get pass the build
Joseph L. Gelsomino
|
|
|
|
|
WackoWolf wrote: #include
//#using
//using namespace System;
void display_statement (double, double, double, double, int, double);
I'm going to guess that your first problem is that the compiler can't find include file void.
You need to start small wirte a hello world progam get that to compile then try agin with this project. Its had for us to help with compile erros when you don't post the messages.
a programmer trapped in a thugs body
|
|
|
|
|
Your problem is that you have a lot of NON matching braces
for example:
{ <-------------------------------- here
display_statement (a, b, c, d, x, e);
return 0;
void display_statement (double payment, double loan_payment, double Tinterest, double Principal, int Number_Payments, double interestrate)
{ <-------------------------------- here
printf("Monthy Payment: $%.2f\n\n", payment);
printf("Total Loan Amount; $%.2f\n\n", loan_Amount);
printf("Total Interest Payment: $%.2f\n\n", Tinterest);
printf("Principal: $%.2f\n\n", Principal);
printf("Number Of Payments: %d\n\n", Number_Payments);
printf("Interest Rate %.3f percent\n\n", interestrate);
} <-------------------------------- here
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I am looking for shared memory wrapper class that encrypts the shared memory. Does anyone know about this, or if there is any article on codeproject on this?
Thanks.
|
|
|
|
|
:(hi
I'm using in a MFC project thread by AfxBeginThread. I have a dialog window like a main window. Into this window I create a thread. Into this thread I create another dialog window. Into this dialog window I create a instance of a class and try to make a reference the second window. I don't know how to do it using standard functions so I pass a pointer as a parameter to constructor of this object. Example:
threadFunc(LPVOID pvParam){
.
.
.
CDlg* pDlg = new CDlg();
pDlg->DoModal();
}
now the in the second window:
BOOL CDlg::OnInitDialog(){
//here the address in the pointer "this" is 0x3322c9 like example
m_MyObject = new CMyObject(this);
}
in MyObject:
CMyObject::CMyObject(CWnd* pWnd){
//but here the address in "pWnd" is 0xdc3829 -.-"
m_pWnd = (CWnd*)pWnd;
}
Can someone to explain me what is happening?
Thanks for to spend time reading it =)
.Bispo
^_____^
[www.bispenho.com]
|
|
|
|
|
It's usually a mistake for one thread to access an object, especially a UI object, that belongs to another thread. If you must do this, consider using HWND instead of CWnd . A better solution is to post messages between threads.
bispenho wrote:
CDlg* pDlg = new CDlg();
pDlg->DoModal();
Calling the memory manager is not necessary. Why not do this instead:
CDlg dlg;
dlg.DoModal();
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
It isn't an UI object. So do I need to send message to another thread passing m_MyObject as parameter? If is correct how can I do that?
|
|
|
|
|
bispenho wrote: So do I need to send message to another thread passing m_MyObject as parameter?
Probably not, as long as the object is only accessed by one thread at a time.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Is it the same to pointers?
=^_______^=
[www.bispenho.com]
|
|
|
|
|
It's true for any object that is not thread-safe.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Because you are going to be doing complex things, you should consider using a user-interface thread. Just using a single thread function (threadFunc as you described) is considered a worker thread. I have recent experience with them, and here's what you need.
1. Derive a class from CWinThread that will be used
2. Add any pointer or whatever you want to the class definition
3. Override the OnIdle function (may be automatically overridden)
a. put all functionality in there
b. return a nonzero value if you need more CPU time, return 0 if the thread is finished
4. In your main function where the thread will start, the thread will be started like this:
CMyThread * thread = (CMyThread *) AfxBeginThread (RUNTIME_CLASS(CMyThread), THREAD_PRIORITY_IDLE, 0, CREATE_SUSPENDED, NULL);<br />
<transfer data to the thread to be used by the thread here><br />
thread->ResumeThread();
At this point, the thread will be running.
Note: you will not create your own instance of the thread, the AfxBeginThread does all the creation of the data you need. Also, put whatever data that you would normally put in the constructor and destructor, put them in InitInstance and ExitInstance respectively. The threads constructor and destructor
Note: the thread written above will be created but will not be started automatically, hence the CREATE_SUSPENDED option. This gives you a time to pass as much data to the thread as you need. Run ResumeThread() to start the thread. At this point, the InitInstance member function will be run and can do the work of the constructor. Then the OnIdle member function will continually be called repeatedly until there is either a message to handle, or you return 0 and tell the thread no more work is needed. Message passing is considered a vital but relatively uncommon task so it's given a high priority. Since message passing is uncommon, the thread will consume practically it's entire time doing your work but it still needs to occaisionally checked and dispatched messages if needed.
You can use AfxEndThread() to stop the thread inside the threads' functions, and ExitInstance will be run to do the work of the destructor.
I've used worker threads and unless you need pure work done and aren't concerned with any message passing or anything else besides pure work, then UI threads provide many benefits.
|
|
|
|
|
Thanks a lot LighthouseJ, I will test it when I get home. I'm at work and steeling a few time to resolve a private life problem. XD
=^_______^=
[www.bispenho.com]
|
|
|
|
|
I am using some object refrence and boolean variables, these are declared golbally. I know this isn't a good practice but, it is required.
I want to know Can i use nampespace to store these globals and is it of any importance.
Also I don't know how to create and use namespace.
Can you help me plz.
|
|
|
|
|
yes, you can put them in a namespace, and it's good style to do so.
to declare:
namespace myNameSpace
{
bool globalBool;
CMyObject globalObject;
...
};
...
to use:
myNameSpace::globalBool = false;
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|