|
Giorgi Moniava wrote:
return LRESULT();
What the hell is this? You have to learn C++ I said!
I think you don't know anything about C++, windows, MFC and everything you have talking about!
It is not intelligent at all to handle WM_MOUSEMOVE, and even if you would handle the tray icon messages the right way, then it would be still bad.
Mouse move messages are transmitted when the cursor moves on a window, or in that case, on the tray icon. So if the mouse enters the icon area, your message box will occur. Better use a button down message to do that.
And as I said before: Learn C++ before posting source codes, that are wrong, wrong, wrong!
Don't try it, just do it!
|
|
|
|
|
A simple Copy button:
void CTestDlg::OnCopyButton()
{
// TODO: Add your control notification handler code here
FILE *fin = fopen(m_InfileStatic, "r");
if ( fin )
{
FILE *fout = fopen(m_OutfileStatic, "w");
if ( fout )
{
char buf[2048];
while ( fread(buf,2048,1,fin) ){
fwrite(buf,2048,1,fout);
}
fclose(fout);
MessageBox("Done ",",NULL,MB_OK|MB_ICONINFORMATION);
}
fclose(fin);
}
}
input is always multiple of 2 KB. after several loops fread returns 0 (if input is 100 KB it should make 50 loops) producing only 2-8 KB output.
Your explanation would be much appreciated. Thanks.
Lynsen
|
|
|
|
|
try openeing the file as a binary.....might be becoz u r encoutering the ascii value 26(opening in text mode,the function stopz when iit encounterz the value 26)so open in binary format(thiz might be te prob!).....
eg:
FILE *fin = fopen(m_InfileStatic, "rb");
FILE *fout = fopen(m_OutfileStatic, "wb");
hope that helpz.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
Yap, that fixed it! Thanks for your ultra rapid answer.
Lynsen
|
|
|
|
|
God Bless.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
While you already know the answer, you might be interested in knowing how you could have discovered it yourself. Try this:
...
char buf[2048];
int x;
while ((x = fread(buf, sizeof(char), 2048, fin)) == 2048)
{
cout << "Read " << x << " bytes" << endl;
fwrite(buf,sizeof(char),x,fout);
}
if (x > 0)
{
cout << "Read " << x << " bytes" << endl;
fwrite(buf, sizeof(char), x, fout);
} With my 160KB test file, it produced:
Read 2048 bytes
Read 2048 bytes
Read 304 bytes
I simply opened up the source file and looked at offset 4400 which was indeed the ASCII 26 character. BTW, you need to swap the second and third parameters in the calls to fread() and fwrite() . Currently, you are telling fread() to read 1 character whose size is 2048, when instead you should be reading 2048 characters whose size is 1.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi
I have tocreate global variable in ATL project .
When i created and used in another class file of same prject it gives error.
If i declare in another file and include that file in another two class file then it gives redeclaration error.
what should i do.
jhon
|
|
|
|
|
Declare your variable with extern keyword in stdafx.h the global header file of project and declare same variable in .cpp where you want to use that variable file (remember .cpp file)
cheers,
Alok Gupta
|
|
|
|
|
hi
Thanx alok.My problem has been solved.
cheers
|
|
|
|
|
hi
I have created ATk project in that i have on atl class and two dialog classes.I have to access the member functions and the public data members of that class in dialog box function.Remember this are in same ATL project.
waiting for reply
Best Regards
Ganesh
|
|
|
|
|
Anonymous wrote:
I have to access the member functions and the public data members of that class in dialog box function.
Could you explain which class in which class, as you mentioned there two dialog class and one ATL Class.
Could you throw more light on this topic
Anonymous wrote:
Remember this are in same ATL project.
Are we coding for you!
cheers,
Alok Gupta
|
|
|
|
|
hi
I habe problem in setting one value:
I have created the ATL component int that i have one metohd which gives call to first dialogbox and i am setting one value which will be return from add property method.
In that i am calling one dialog box and OnCancel of that that dialog i am calling anther dialog box.So here OnCancel() i have written some code and i want to set the value which is in The Component class.
If this is set i can retreive i from add property method because i am deciding on that value to load the components or not.
It's Urgent. Waiting for reply as soon as possible
Thanx
Best Regards
Ganesh
|
|
|
|
|
below is my code the whole program is for prompting user to enter 10 nos. b/w 20 to 100 it will while is there to check wheter the user entr the corect number or not, it will also check that the entered number is unique and was not previously entered by the user. at end of program simply it will display the non dublicate nos. whole program is correct but at end it is not displaying correct result . plz check the code n tell me wherz my mistake.
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
main()
{
int nTmp,j;
//declares variable bflag th be of type bool & intializes bflag to false
//bool is a data type whose value may be false or true
bool bFlag=false;
int a[10];
cout<<"entr 10 numbers b/w 20 and 100"<<endl;
="" for(int="" i="0;i<10;i++)" {="" cout<<"enter="" value"<<endl;
="" cin="">>nTmp;
while(!bFlag)
{
////Here we check first Condition
// no between 20 and 100
while((nTmp<20)||(nTmp>100))
{
cout<<"enter no b/w 20 and 100"<<endl;
="" cin="">>nTmp;
}
j=0;
while(j<=i)
{
if(a[j++]==nTmp)
{
bFlag=false;
}
bFlag=true;
}
if(bFlag==true)
{
//save variable
a[i]=nTmp;
}
}
//again make it false
bFlag=false;
}
cout<<" the non dublicate nos are "<
|
|
|
|
|
Madame Rose
rose aashii wrote:
cout<<" the non dublicate nos are "<<a[i]<<endl;< i="">
you forget to insert a Loop here i.e.
for(i=0;i<10;i++)
cout<<" the non dublicate nos are "<<a[i]<<endl;
cheers,
Alok Gupta
|
|
|
|
|
thnx but it is giving wrong output plz chk it n reply soon
rose
|
|
|
|
|
Here is full sourcecode i created for you because you are showing efforts, but i still insist that you read your Text Book.
#include<iostream.h>
void main()
{
int nTmp,j;
bool bFlag=false;
int a[10];
for(int i=0;i<10;i++)
{
cin>>nTmp;
while(!bFlag)
{
while((nTmp<20)||(nTmp>100))
{
cout<<"enter no b/w 20 and 100"<<endl;
cin>>nTmp;
}
j=0;
while(j<=i)
{
if(a[j++]==nTmp)
{
bFlag=false;
cout<<"You already entered this Number!enter unique no "<<endl;
cin>>nTmp;
break;
}
bFlag=true;
}
if(bFlag==true)
{
a[i]=nTmp;
}
}
bFlag=false;
}
for(i=0;i<10;i++)
cout<<a[i]<<endl;
}
cheers,
Alok Gupta
|
|
|
|
|
the same code i tried.. my prob is that i need to print only dat numbers that r not repeated.like if i entered 50, 60, 80, 90, 99, 56, 50,98, 45, 99 so here 50 and 99 are reapeating so in the output ony 8 nos that r 50, 60, 80, 90, 99, 56, 98, 45 such that the nos that r repeating should not be displayed as u observe it in output.this is not diaplyind the ouput which i want.
for(i=0;i<10;i++)
cout<<" the non dublicate nos are "<
|
|
|
|
|
I have programed it that way that it will take only 10 unique numbers!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Is there anyway that I can cast a graphics path to a bitmap?
Im trying to make a freehand sketch program using John Buettner's example, the problem is that when changing the pen color and width it effects everything drawn into that path previously. I figured the best way to do it would be casting the graphicspath into bitmap format on mouseup and then resetting the graphicspath though after playing around with it quite a bit im still not sure how to go about it.
Any help appreciated thanks.
|
|
|
|
|
Why not just save the pen size and colour information along side every path?
cheers,
-B
|
|
|
|
|
OnKeyDown(UINT nChar, ...)
{
char lschar = char(nChar);
if (lschar=='A') AfxMessageBox("Key A is pressed");
}
In the same way, how to test when key: UPARROW, LEFTARROW, RIGHTARROW, DOWNARROW, NumPad-, NumPad+ is pressed.
thanks for help me!
don't stop me now!!!
|
|
|
|
|
I use an easy method it seems to work.
onkeydown(UINT nChar....)
{
CString string;
string.Format("%d",nChar);
AfxMessageBox(string);
}
This func. tells you the code whic you press.
|
|
|
|
|
switch (nChar)
{
case VK_UP:
// up arrow
break;
case VK_LEFT:
// left arrow
break;
case VK_RIGHT:
// right arrow
break;
case VK_DOWN:
// down arrow
.
.
.
}
suhredayan There is no spoon.
|
|
|
|
|
as usual you are always FAST
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
as usual you are always FAST
hope you don mind
suhredayan There is no spoon.
|
|
|
|