|
You can use CString's Compare() function.
|
|
|
|
|
Anu_Bala wrote: CString ExeMonFile=_T("");
int NoExeMonFile=1;
if(strcmp(ExeMonFile,"")!=0)
NoExeMonFile=0;
Why do you mix the _T("") literal with the "" one?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
My problem is ExeMonFile is not initialized to null,
Its have someother value.
In my applciation all Uninitialized CString Value have this ex:BL001 string.
Even when initialized with _T(""),
it doesnot get initialized.
Anu
|
|
|
|
|
Anu_Bala wrote: Even when initialized with _T(""),
it doesnot get initialized.
You know that is a nonsense, doesn't you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Bytes following a null byte are not compared.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
hi,
i want to send a click message to a window button. i am able to enumerate the window and also find the handle of button as well but not able to send the click message. Actually the default focus is set on some another message if i send BM_CLICK message that call goes to other button not the one i am sending..... attached code is below
CWnd* pWnd = NULL;
CWnd* pWndBtn = NULL;
DWORD dwErr = 0;
while(true)
{
CWnd* WindowHandle = NULL;
CWnd* ButtonHandle = NULL;
WindowHandle = FindWindow(NULL, L"Microsoft Office Outlook");
if(WindowHandle)
{
ButtonHandle = FindWindowEx(WindowHandle->GetSafeHwnd(), 0, L"Button", L"Allow");
if(ButtonHandle)
{
CString strWnd ;
ButtonHandle->GetWindowText(strWnd);
WindowHandle->SetActiveWindow();
ButtonHandle->SendMessage(BM_CLICK ,0,0);
}
}
}
plz help.. i tried even setting window active also but dint work
|
|
|
|
|
Can't you associate a member variable to that button and then send the BM_Click to that particular button?
Does this[^] help you?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
no event that dint help....
|
|
|
|
|
Typically its the parent window that handles the BN_CLICKED event for a child window. As you can find the actual window you want to send the BN_CLICKED event for, all you need to do is get the control ID number using the GetDlgCtrlID() function on the button window.
You can then use PostMessage to the buttons parent window using:
parentWindow->PostMessage(WM_COMMAND, MAKELONG(buttonId, BN_CLICKED), buttonHwnd)
(I only had a quick and dirty look at the docs for this but I think it should work, you may have to sort out the parameters to make sure their correct)
If you vote me down, my score will only get lower
|
|
|
|
|
i have tried this also... but this also does not work.. You know what happend if i click anywhere on my desktop or elsewhere than message starts going. i dont quiet understand whats happening.
|
|
|
|
|
Have you tried SendMessage instead? Other than that I am not sure what to suggest.
If you vote me down, my score will only get lower
|
|
|
|
|
i have tried that also i am afraid that also does not work.. i tried SendInput() with MOUSE_EVENT just to simulate the click event than this message is going but sometimes what happens this SendMessage goes to the default button in the window. The button i want to send the message is not the default button. 
|
|
|
|
|
The following code snippet read data from keyboard and write into one file;
and read that file and display it on screen....But it displays junk characters....
What may be the problem ...?
// main.c
#include <stdio.h>
int main(void){
char ch;
FILE *fp;
fp = fopen("test_file_src","w");
printf("\n Eneter the data (type Ctrl^D at end :\n");
if (fp != NULL) {
while(ch = getchar() != EOF)
fputc(ch ,fp);
} else {
printf("\n Unable to create file \n");
}
fclose(fp);
printf("\n\n Reading from file\n\n ");
fp = fopen("test_file_src","r");
if (fp != NULL) {
while(!feof(fp)) { // Move up to end of file
ch = fgetc(fp);
putchar(ch);
}
} else {
printf("\n Unable to process file \n");
}
fclose(fp); // Close file
printf("\n\n\n");
return 0;
}
/* Output
Enter the data (type Ctrl^D at end :
11111111111111222
2222222222222222222
22222222222222222
Reading from file
|
|
|
|
|
while(ch = getchar() != EOF)
should be
while((ch = getchar()) != EOF)
The assignment operator has lowest precedence of all in C.
|
|
|
|
|
I am having a strange problem. When debugging using Code::Blocks, the following function returns the correct answers. However, when I am not debugging, it gives a correct answer the first time. Subsequent calls to the SAME function using the SAME parameter results in different answers, but not without a pattern:
The first three calls result in return values that are close to each other, after that, the return values are completely different from the first three, but identical to each other.
like so:
0.29012
0.29013
0.29102
0.42030
0.42030
...
double CalculateMSE( std::vector< complex<double> > inputv)
{
int N = inputv.size();
int M = 2*N+int(0.1*double(N) + 0.5);
int K = 100;
int T = M;
std::vector<double> m = mylinspace(0, M-1, M);
std::vector<double> k = mylinspace( -1 * ceil(K/2), K/2, K+1);
std::vector<double> freq_samples;
for( int i=0; i < k.size(); i++)
freq_samples.push_back( k[i] / T );
std::vector<double> sinc_pulse( freq_samples.size() );
sinc_pulse = mysinc(freq_samples);
std::vector< std::vector< double > > sinc_pulse2;
for(int i=0; i < m.size(); i++)
{
sinc_pulse2.push_back( sinc_pulse );
}
std::vector< matrix< std::complex<double> > > B;
matrix< std::complex<double> > exp_freq_samples;
std::complex<double> cplx_j(0,1);
matrix< double > mx_freq_samples( 1, freq_samples.size() );
for( int i=0; i < freq_samples.size(); i++)
{
mx_freq_samples(0,i) = freq_samples[i];
}
matrix< double > mx_m(1, m.size());
for( int i=0; i < m.size(); i++)
{
mx_m(0,i) = m[i];
}
matrix< double > mx_sinc_pulse( sinc_pulse2.size(), sinc_pulse2[0].size() );
for( int i=0; i<mx_sinc_pulse.size1(); i++)
{
for( int j=0; j<mx_sinc_pulse.size2(); j++)
{
mx_sinc_pulse(i, j) = sinc_pulse2[i][j];
}
}
mx_sinc_pulse = trans(mx_sinc_pulse);
matrix< double > mx_pp(1, m.size());
matrix< double > trans_freq_samples( trans(mx_freq_samples) );
complex< double > cplx_tmp = -1.0 * cplx_j * 2.0 * PI;
for( int i=0; i<N; i++)
{
matrix< std::complex<double> > Bmat;
for (unsigned j = 0; j <mx_pp.size1 (); j++)
for (unsigned jj = 0; jj <mx_pp.size2 (); jj++)
mx_pp (j, jj) = i + m[jj];
Bmat = prod(trans_freq_samples, mx_pp);
Bmat *= cplx_tmp;
for( int j=0; j < Bmat.size1(); j++)
{
for( int jj=0; jj < Bmat.size2(); jj++)
{
Bmat(j, jj) = mx_sinc_pulse(j, jj) * exp(Bmat(j, jj));
}
}
B.push_back( Bmat );
}
matrix< complex<double> > P(K+1,M);
for (int i=0; i < inputv.size(); i++)
{
P = inputv[i] * B[i] + P;
}
matrix< double > Kg(M, 1);
for( int i=0; i<Kg.size1(); i++)
Kg(i, 0) = 1;
matrix< complex<double> > transP;
matrix< complex<double> > tmpP = prod(herm(P) , P);
matrix<double> mag_pi_sqrd(tmpP.size2(), 1);
for( int i=0; i<mag_pi_sqrd.size1(); i++)
{
mag_pi_sqrd(i, 0) = real(tmpP(i,i));
}
matrix< double > MSE_tmp(M, 1);
double sumtotal = 0;
for( int i = 0; i < M; i++)
{
matrix< complex<double> > p_i(P.size1(), 1);
matrix< complex<double> > p_j(P.size1(), M-1);
for(int j=0; j < P.size1(); j++)
{
p_i(j, 0) = P(j, i);
}
for(int j=0; j < M-1; j++)
{
int ix = j;
if( j >= i )
ix++;
for(int jj=0; jj < P.size1(); jj++)
p_j(jj, j) = P(jj, ix);
}
matrix< complex<double> > hp_i = herm(p_i);
matrix< complex<double> > prodhpi_pj = prod( hp_i, p_j );
matrix< complex<double> > hermprodhpi_pj = herm(prodhpi_pj);
matrix< double > mag_rhoij = real( prod( prodhpi_pj , hermprodhpi_pj ) );
MSE_tmp(i, 0) = (Kg(i,0) * mag_rhoij(0,0)) / (mag_pi_sqrd(i,0)*mag_pi_sqrd(i,0));
sumtotal += MSE_tmp(i, 0);
}
sumtotal = sumtotal/double(M);
return sumtotal;
}
Any ideas?
|
|
|
|
|
this might give you ideas at some things to look for Surviving the Release Version[^]
apart from that, you dont seriously expect anyone here to read that code do you ? with no comments/clue as to what it's supposed to achieve ?
'g'
|
|
|
|
|
The code is meant to calculate the MSE of a transmit code for synthetic aperture radar systems. I really only included it in case someone wanted to dig through it. I guess I meant my question to be more general. As in, "Given any function with only local variables, why would this behavior occur? (by the way, here's such a function)"
|
|
|
|
|
sorry, didnt see this - my b/berry didnt synch or was off the network for some reason ..
As KarstenK says below, which was a also the point of the link I pasted, make sure everything is initialised to a value you expect - even a matrix, where the system has gone out and grabbed chunks of memory for the cells, may not be 'clean' - so if you're doing a calc across the matrix and there's cr@p in the middle, bingo
'g'
|
|
|
|
|
Posted code contains many instances of your own classes. Since we don't know about them, how could help?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Ah, my mistake, I did not copy the includes. The classes used are all defined in the boost ( http://www.boost.org/[^]) template library and in the STL. Matrix is boost's ublas implementation, complex and vector are STL.
|
|
|
|
|
if debug != release it is often an contruction issue.
is std::vector< complex<double> > properly initilized?
or the use of some static members can often lead to damages
make som output in the long function to find WHERE it happens
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I am trying to save the content in IPicture to JPG. CImage seems to promising. However I can't use MFC or ALT. Thanks in advance...
|
|
|
|
|
Have you tried this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks very much for your reply. I figured out the solution by myself. I ended up with using Gdi+. What I did was:
1) Create IStream and save content of IPicture to this stream;
2) call Gdiplus::Image::FromStream to load this BMP format stream into image;
3) By passing in the JPG format ClsID, I called Save to save this image to JPG format stream. This is all I needed. Of course, you can save it out as a file.
|
|
|
|
|
Here is simplest way for save jpg and... formats CImage class.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|