|
Two ways, although they are practically the same. Create another exported function in your DLL that accepts as a parameter, the HWND of the EXE's window. The DLL will store that value for later use. Or, modify the other exported function in your DLL to accept an additional HWND parameter. Make sense?
|
|
|
|
|
just pass athe valid Device context of that view to the function in ur DLL and by using that u can display .
Like void DiaplayText(CDC*pDc, char* pszText)
CodeTheDreams();
|
|
|
|
|
I am looking for some ideas on a way to implement a copy file function w/o using WriteFile or CopyFile. I know this sounds tough. This is what I am wanting to do. WriteFile and CopyFile are fairly intensive on a network and I need to come up with a way to write a file (copy it) from one network drive to another and have it be fast, really fast. Unfortunately, I haven't been able to come up with a way for this to happen. Any thoughts?
|
|
|
|
|
ever tried SHFileOperation ?
i don't think that it is faster than CopyFile.. but maybe you should give it a try..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Whatever you do, you'll still have to physically transfer the file across the network and there's no way around that - it will be just as network intensive using CopyFile/WriteFile as it would using some other method. Possibly the only thing you could do is compress the file before it is transferred, but if its big enough for you to worry about the network then its going to take some time to compress and decompress it (and that presumes its something that can be compressed).
|
|
|
|
|
You can use the function SHFileOperation. With this you can move, copy, rename or delete files and folders. It handles most of the checks like a file or directory with the same name existing at the destination etc.
Ankush
|
|
|
|
|
Hi,
Actually I'm a PowerBuilder developer but I'm trying to do some C++ programming also. Because of the rather poor UI PowerBuilder offers (especially for menus), I like to make an ActiveX control that creates a menu based on settings the developer can enter and, at runtime, set that menu as the menu for the powerbuilder application. By ownerdrawing the menu I wish to make an OfficeXp like menu.
I have no idea how I can do this. I know how to create an ActiveX control I can use within my PowerBuilder application but not how to make an ActiveX that creates something in the background and shows it within my application.
I hope some of you can give some hints and/or tips how to accomplish this.
Regards,
Aart Onkenhout
|
|
|
|
|
Hi,
My application logs data during an experiment. I need to prevent silly users from shutting the application half way through an experiment.
So, how can I disable the 'exit' button and menu option?
How can I intercept the exit command so that I can ask the user if they wish to save any 'unsaved' data?
Thanks for any suggestions,
Ali
|
|
|
|
|
Check the docs for the WM_CLOSE notification message.
HTH
|
|
|
|
|
i think it is better to put a flag for it, for enable the flag when u start the process , and disable the flag when ur opertaions completed.
and you will get all the message to the window if you override
PostQuitMessage().you just check the status of the flag there and decide whcih operation you want to do.
Hope that you got the idea...
CodeTheDreams();
|
|
|
|
|
Yeah, I think I understand. I'll give it a go.
Thanks,
Ali
|
|
|
|
|
If you doing this in MFC, override the documents SaveModified() function. As long as you set the modified flag to true during the experiment, you can return FALSE to stop the document and the application closing.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Another option is to override BOOL CDocument::CanCloseFrame(CFrameWnd* pFrameArg)
and do whatever you need to do to check/verify that it is ok to close the frame.
|
|
|
|
|
How to change Dialog background color in dialog based applications.
yakkalas
|
|
|
|
|
Handle WM_ERASEBKGND yourself. In MFC parlance:
BOOL CSomeDialog::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);
// yellow !
CBrush brush(RGB(255,255,0));
pDC->FillRect(rect,&brush);
// tell the framework we handled this
return TRUE; // CDialog::OnEraseBkgnd(pDC);
}
HTH
|
|
|
|
|
override OnCtlColor() and return the color of the brush , you want to paint the background. remember to put the flag to CTLCOLOR_DLG bcz u want to change the color of the dialog
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
Derive your own class from CSplitterWnd and handle WM_MOUSEMOVE and WM_LBUTTONDOWN. Do not pass these onto CSplitterWnd. That'll stop mouse operations. There may be a more elegant solution but this one is simple enough.
HTH
|
|
|
|
|
Derive a new class from CSplitterWnd. Lets call it mySplitterWnd. Then make the following changes:
void mySplitterWnd::OnLButtonDown(...)
{
CWnd::OnLButtonDown(...);
}
void mySplitterWnd::OnMouseMove(...)
{
CWnd::OnMouseMove(...);
}
BOOL mySplitterWnd::OnSetCursor(...)
{
return CWnd::OnSetCursor(...);
}
Trust in the code Luke. Yea right!
|
|
|
|
|
Hi,
Can anyone help me with this? i get this error and i can't figure out what is meant by that error C2102: '&' requires l-value.
My piece of code is the following
#include <stdio.h>
#include <math.h>
double tailing = 0;
double trl_values = 0;
double y_int_1 = 0;
int rest = 0;
double leading = 0;
double histogram_ram = 0;
double i_index;
double Trl_values;
double y_int = 0;
/*******************************************************************************************
Transfer function:
1
----------------
3.333e-005 s + 1
Transfer function:
0.1829 z + 0.11829
-----------------------
z - 0.6341
Sampling time: 1.9113e-008
********************************************************************************************/
unsigned char Slice_level(unsigned char x) // Function accessible only from this file
{
double b0=0.1829,b1=0.11829;
double a1= 0.6341;
double temp_x1,temp_x2;
double temp_y1;
unsigned char y;
int static xn_1;
int static yn_1,yn_2; // y(n-1)
temp_x1 = x * b0;
temp_x2 = xn_1* b1;
temp_y1 = yn_1 * a1;
y = temp_x1+ temp_x2 + temp_y1;
xn_1 = x;
yn_1 = y;
return y;
}
//main()
void SLFilter (long amount, unsigned char* pData)
{
long n;
unsigned char y;
for (n=0; n<amount; n++)
="" {
="" y="Slice_level(pData[n]);
" pdata[n]="y;
"
="" printf("%8d="" n",y);
="" }
}
="" *******************************************************************************************
="" this="" code="" shows="" the="" trl_values="" calculation.="" it="" is="" going="" to="" help="" determining="" histogram=""
********************************************************************************************=""
void="" trl_calculation(int="" amount,="" unsigned="" char*pdata)
{
="" long="" n;
="" for="" (int="" i="1;" <="amount;" i++)
="" if="" ((y_int_1)="" -="" 0)="" &="" (y_int=""> 0)
tailing = 1 - (y_int- pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest;
leading = 1 - tailing;
rest = 0;
if ((y_int_1- pData[n] > 0)&(y_int- pData[n] < 0))
tailing = 1 - (y_int - pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest;
leading = 1 - tailing;
rest = 0;
rest = rest + 1;
y_int_1 = y_int;
}
}
void histogram(int amount, unsigned char*pData)
{
const double Duration = amount/4096;
for (int i=1; i <= amount; i++)
{
i_index = ceil(Trl_values(i)/Duration)+1;
histogram_ram(i_index)=histogram_ram(i_index)+1;
}
}
Besides, i also have errors like
error C2064: term does not evaluate to a function
Thx
F.K
|
|
|
|
|
Try using && instead of & (Please indicate in which lines errors are, is not easy to guess it).
~RaGE();
|
|
|
|
|
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
h:\visualc++\trl_calculation\trl.cpp(90) : error C2102: '&' requires l-value
cpp(92) : error C2064: term does not evaluate to a function
cpp(98) : error C2064: term does not evaluate to a function
cpp(116) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
F.K
|
|
|
|
|
What i was trying to say is : indicate the line of code where you error happens. I still cannot guess which line 92 indicates in the statement :
cpp(92) : error C2064: term does not evaluate to a function
Like :
int bla = 0 // This is throwing an error
so it is possible for us to answer
it's because you've forgotten a ;
So repost your code and indicate which line are bringing up errors.
~RaGE();
|
|
|
|
|
#include <stdio.h>
#include <math.h>
double tailing = 0;
double trl_values = 0;
double y_int_1 = 0;
int rest = 0;
double leading = 0;
double histogram_ram = 0;
double i_index;
double Trl_values;
double y_int = 0;
/*******************************************************************************************
Transfer function:
1
----------------
3.333e-005 s + 1
Transfer function:
0.1829 z + 0.11829
-----------------------
z - 0.6341
Sampling time: 1.9113e-008
********************************************************************************************/
unsigned char Slice_level(unsigned char x) // Function accessible only from this file
{
double b0=0.1829,b1=0.11829;
double a1= 0.6341;
double temp_x1,temp_x2;
double temp_y1;
unsigned char y;
int static xn_1;
int static yn_1,yn_2; // y(n-1)
temp_x1 = x * b0;
temp_x2 = xn_1* b1;
temp_y1 = yn_1 * a1;
y = temp_x1+ temp_x2 + temp_y1; // warning C4244
xn_1 = x;
yn_1 = y;
return y;
}
//main()
void SLFilter (long amount, unsigned char* pData)
{
long n;
unsigned char y;
for (n=0; n<amount; n++)
="" {
="" y="Slice_level(pData[n]);
" pdata[n]="y;
"
="" printf("%8d="" n",y);
="" }
}
="" *******************************************************************************************
="" this="" code="" shows="" the="" trl_values="" calculation.="" it="" is="" going="" to="" help="" determining="" histogram=""
********************************************************************************************=""
void="" trl_calculation(int="" amount,="" unsigned="" char*pdata)
{
="" long="" n;
="" for="" (int="" i="1;" <="amount;" i++)
="" if="" ((y_int_1)="" -="" 0)="" &="" (y_int=""> 0); //error C2102
tailing = 1 - (y_int- pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest; // error C2064
leading = 1 - tailing;
rest = 0;
if ((y_int_1- pData[n] > 0)&(y_int- pData[n] < 0))
tailing = 1 - (y_int - pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest; //error C2064
leading = 1 - tailing;
rest = 0;
rest = rest + 1;
y_int_1 = y_int;
}
}
void histogram(int amount, unsigned char*pData)
{
const double Duration = amount/4096;
for (int i=1; i <= amount; i++)
{
i_index = ceil(Trl_values(i)/Duration)+1; //error C2064
histogram_ram(i_index)=histogram_ram(i_index)+1; //error C2064
}
}
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
cpp(90) : error C2102: '&' requires l-value
cpp(92) : error C2064: term does not evaluate to a function
cpp(98) : error C2064: term does not evaluate to a function
cpp(116) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
F.K
|
|
|
|
|
flora_k wrote:
y = temp_x1+ temp_x2 + temp_y1; // warning C4244
Exactly as the warning says: You are pressing the result of adding three double s into an unsigned char (which is the size of a byte ). If you really intend to do that, use y = static_cast< unsigned int >(temp_x1+ temp_x2 + temp_y1);
For the Errors: you probably intended to use the logical AND operator. This is spelled && instead of & .
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
flora_k wrote:
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
explicit : you return an unsigned char, which is a value between 0 and 256, and you want to assign it a sum of doubles, which is a value between -2^63 and 2^63 ... so you may lose some data in the operation.
flora_k wrote:
cpp(90) : error C2102: '&' requires l-value
Your if statement is missing a ). Use && operator instead of & which should only be used to do bitwise operation. Test is done with && or ||.
flora_k wrote:
cpp(92) : error C2064: term does not evaluate to a function
In c++ or c, functions looks like function(parameter) and tables of value like value[] (spot the square brackets). The compiler thinks you are trying to assign the result of the sum to a function call, which does not mean anything at all.
So better try :
histogram_ram[i_index]=histogram_ram[i_index]+1;
you also need to declare the table correctly :
double histogram_ram[SizeOfTable];
Replace SizeOfTable by the size of your table (3 or 255 or ...);
That's the same for the other values. You must be pretty new to c/c++ language ?
~RaGE();
|
|
|
|